ethereumproject / go-ethereum

Go language implementation of the original/classic design of the Ethereum protocol
GNU Lesser General Public License v3.0
441 stars 166 forks source link

ethClient missing required field 'v' for txdata #684

Closed oucye closed 5 years ago

oucye commented 5 years ago

when I use ethClient to connect etc node with method BlockByNumber, I get an error "missing required field 'v' for txdata" etc rpc api doesn't return the params "v", "r" and "s" , how to fix this

whilei commented 5 years ago

eth_getBlockByNumber returns for field transactions "Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter".

And as documented here, https://github.com/ethereumproject/go-ethereum/wiki/JSON-RPC#eth_gettransactionbyhash, a "transaction object" doesn't contain a field v (or r or s), as you mentioned. This is for the Ethereum Classic implementation.

However, reading https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash shows that ETH has apparently decided to modify the return value for transaction objects, including v, r, and s.

If I'm correct in thinking that your ethClient in question is from https://ethereum.org/cli -- then this is because you're using an ETH-maintained client in conjunction with an ETC RPC.

I'll begin working a PR to add these fields to transaction objects for this client. In the meantime, you can use https://github.com/ethoxy/multi-geth which should fully support the ETH interfaces for ethClient.