Taking eth_getLogs as an example. Here's the original POST data:

    "id": 67,
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [{
        "fromBlock": 3138480,
        "toBlock": 3138482,
        "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]

If I do that I get:

"error": {
    "code": -32602,
    "message": "invalid argument 0: hex string without 0x prefix"


"params": [{
    "fromBlock": "0x2fe3b0",
    "toBlock": "0x2fe3b2",
    "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]

It works okay. 0x2fe3b0 is the hex representation of 3138480, while 0x2fe3b2 is for 3138482.

The question is if this is the case for all geth calls?


Yes, from the wiki page

At present there are two key datatypes that are passed over JSON: unformatted byte arrays and quantities. Both are passed with a hex encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.