bui manhcuong
bui manhcuong

Reputation: 51

Cannot unmarshal non-string into Go struct field SendTxArgs.from of type common.Address

I'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.

Upvotes: 1

Views: 1826

Answers (1)

Yaroslav Hontar
Yaroslav Hontar

Reputation: 41

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

In my case I have added it in this way:

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)

Upvotes: 4

Related Questions