Call a function via JSON-RPC

kenmazsymakenmazsyma tokyoMember Posts: 13
have a following contract.
(This contract is in my local test net and already mined.)

contract Test {
function get() constant returns (uint8 retVal) {
return 1;
}
}

This contract address is 0x27301b747ce0d8c0ba7304c094f43aed1c5f1ba9 .

I'm trying to call getfunction via JSON RPC.

According to the following wiki entry, I can do it by setting the method id of get function to data property.
https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI

the method id of get function is 0x6817c00f.
(I got this id from web3_sha3method.)

I sent following JSON-RPC code, but response value was 0x.

{
‘jsonrpc': '2.0',
‘id' : 1,
‘method': ‘eth_call’,
‘params' : [ {
‘to’ : ‘0x27301b747ce0d8c0ba7304c094f43aed1c5f1ba9’,
‘data’ : '0x6817c00f'
} ]
};

Please tell me what is wrong?

I’m sorry for my poor English :s

Best Answer

Answers

Sign In or Register to comment.