Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (12.7k points)

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

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

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.5k points)
edited by

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

Something like this:

client ="your path to .ipc", true)
client.default_account = '0xa9db3f4efe....


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

Know the blockchain better through Blockchain Certification by Intellipaat.

Browse Categories