以太坊RPC接口文档:
https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion
使用方式:
比如我要调用某个合约的balanceOf(address _owner)
方法。
因为没有改变合约的状态,所以是eth_call接口。
这时候需要请求以太坊节点地址:http://xxx.xxx.xxx.xx:8545 。请求方式POST,请求参数如下:
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"from": "调用者地址",
"to": "合约地址",
"data": "方法和方法参数"
},"latest"],
"id": 1
}
其他接口按照这个方式看文档即可。