0 votes
1 view
in Blockchain by (12.8k points)

'm learning ethereum blockchain with Ruby and using this library:

https://github.com/EthWorks/ethereum.rb

I follow the guide and use the file greeter.sol here:

https://github.com/marekkirejczyk/ruby_ethereum_example/blob/master/contracts/greeter.sol

But I always got this error:

invalid argument 0: json: cannot unmarshal non-string into Go struct field SendTxArgs.from of type common.Address

This is my current code:

contract = Ethereum::Contract.create file: File.join(File.dirname(__FILE__), '../contracts/greeter.sol')

address = contract.deploy_and_wait("Hello from ethereum.rb!")

Anyone can help me, I'm very new to this. Thanks.

1 Answer

0 votes
by (29.8k points)

Hi, you should specify the default_account for client(sender address).

Something like this:

client = Ethereum::IpcClient.new("your path to .ipc", true)
client.default_account = '0xa9db3f4efe....

then

contract = Ethereum::Contract.create( abi: abi, name: name, client:client, address: address)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...