My contract has a function defined like this:
{"constant":true,"inputs":[],"name":"queryNumEscrows","outputs":
[{"name":"","type":"uint256"}],"payable":false,"type":"function"}
Having no inputs. Its Solidity source code is pretty simple:
function queryNumEscrows() constant returns (uint) {
return numEscrows;
}
how do I call it from JSON RPC? I've tried this:
endpoint = "queryNumEscrows()"
web3_sha3(endpoint) = 0x0127efc52bcbe2b7f6d6a1ee29a7acd32c5f2e824b791cd7c97b9c57981bc5ac
no arguments...
data = 0x0127efc5
and when performing the query:
eth_call([{"from": "0xf28dafbfeb41bf32869c9d498da0d651d0206ed4", "to":
"0x27c042342c9ba937214117e11a4970a6145034cb", "data": "0x0127efc5"}])
this is the error it throws:
-32602: invalid or missing value for params[1]
So, I guess probably is something wrong when encoding void parameters into data. How should I do that?
By the way, I used this great explanation: How to call a contract method using the eth_call JSON-RPC API as a reference.