ethereum.rb: Cannot unmarshal non-string into Go struct

Trying to access an already deployed contract on Ropsten network using an Infura Http client.

At first I was getting this error

irb(main):1621:0> contract = Ethereum::Contract.create(client: client, name: 'BlipCompetition', address: '0xd3dcb2493c6c35213042cb7d95cb5baa2d2430eb', abi: abi_json)
=> #<Ethereum::Contract::BlipCompetition:0x00007faa2ca81d98>
irb(main):1622:0> contract.call.owner
Traceback (most recent call last):
        7: from bin/console:14:in `<main>'
        6: from (irb):1622
        5: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:344:in `block (2 levels) in create_function_proxies'
        4: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:188:in `call'
        3: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:182:in `call_raw'
        2: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/client.rb:137:in `block (2 levels) in <class:Client>'
        1: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/client.rb:129:in `send_command'
IOError (invalid argument 0: json: cannot unmarshal non-string into Go struct field CallArgs.from of type common.Address)

And then I followed the suggestion here And now I have this error (running from console in this gem’s directory to get full stack trace):

irb(main):1627:0> contract = Ethereum::Contract.create(client: client, name: 'BlipCompetition', address: '0xd3dcb2493c6c35213042cb7d95cb5baa2d2430eb', abi: abi_json)
=> #<Ethereum::Contract::BlipCompetition:0x00007faa2da93a38>
irb(main):1628:0> contract.call.owner
Traceback (most recent call last):
       13: from bin/console:14:in `<main>'
       12: from (irb):1628
       11: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:344:in `block (2 levels) in create_function_proxies'
       10: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:188:in `call'
        9: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/contract.rb:183:in `call_raw'
        8: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `decode_arguments'
        7: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `map'
        6: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `each'
        5: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `with_index'
        4: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `each'
        3: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:76:in `block in decode_arguments'
        2: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:14:in `decode'
        1: from /Users/carlos/Desktop/imthatcarlos/ethereum.rb/lib/ethereum/decoder.rb:51:in `decode_address'
ArgumentError (ArgumentError)

Not sure which of the two is a valid bug… anyone running into the same issues?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 22 (5 by maintainers)

Most upvoted comments

@client = Ethereum::HttpClient.new(RINKEBY_NETWORK_URL)

After setting @client.default_account. It’s worked. This in seems a bit absurd. We need to reconsider the flow here

@longhoangwkm Thank you, your solution worked for me as well . 👍

Thanks for the trace. I’ll take a look as soon as I get back to the studio.