Error with invalid json request

i have try to use some code here

i want to try use amount 9.9 in hexadecimal 0x9.e666666666668
and fee amount 0.1 in hexadecimal 0x0.1999999999999a
and for gas 0 in hexadecimal 0x0

for from, to, data i use default example from this link


{“jsonrpc”:“2.0”,“method”:“eth_call”,“params”: [{“from”: “0xb60e8dd61c5d32be8058bb8eb970870f07233155”,“to”: “0xd46e8dd67c5d32be8058bb8eb970870f07244567”,“gas”: “0x76c0”,“gasPrice”: “0x0.1999999999999a”,“value”: “0x9.e666666666668”,“data”: “0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675”}, “latest”],“id”:1}

but i got response this error

{
“jsonrpc”: “2.0”,
“id”: 1,
“error”: {
“code”: -32602,
“message”: “invalid argument 0: json: cannot unmarshal hex number with leading zero digits into Go struct field CallArgs.gasPrice of type *hexutil.Big”
}
}

if i use this
{“jsonrpc”:“2.0”,“method”:“eth_call”,“params”: [{“from”: “0xb60e8dd61c5d32be8058bb8eb970870f07233155”,“to”: “0xd46e8dd67c5d32be8058bb8eb970870f07244567”,“gas”: “0x76c0”,“gasPrice”: “0x1”,“value”: “0x9.e666666666668”,“data”: “0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675”}, “latest”],“id”:1}

i got error like this

{
“jsonrpc”: “2.0”,
“id”: 1,
“error”: {
“code”: -32602,
“message”: “invalid argument 0: json: cannot unmarshal invalid hex string into Go struct field CallArgs.value of type *hexutil.Big”
}
}
i want to know witch json make this error ?

Hi @yuhu_yuhu - for the first error, check this thread out to see if it helps you fix the leading zero digits.
For the second error, try checking this thread out - it has some good links out to other resources as well.

Thanks for answer my question i will update to my code… I will try again… Thanks Mrs. Leiya sorry if i always ask in this forum.

No problem! That’s what we’re here for :slight_smile: