vechain / web3-gear

Proxy Thor's RESTful API to Eth JSON-RPC, to support Remix, Truffle and more.
MIT License
30 stars 17 forks source link

Malformatted numbers (i.e. hex digits) #5

Closed plainerman closed 6 years ago

plainerman commented 6 years ago

Numbers in the Web3 implementation of ethereum are sent as hexadecimal numbers, for example:

{
    "method": "eth_blockNumber",
    "params": []
}

should return (according to the ethereum implementation)

{
    "jsonrpc": "2.0",
    "result": "0x80023"
}

but they are sent as decimal numbers (not even strings!):

{
    "jsonrpc": "2.0",
    "result": 524323
}

Many implementations (e..g web3j) require the values to be formatted as hex-strings instead of decimal numbers (enforcing the actual ethereum-style). This issue is not only for the eth_blockNumbermethod but most numbers (actually, I do not know of any number that is sent as decimal number).