当前位置: 首页 > 工具软件 > php-JsonRPC > 使用案例 >

eth json rpc php,eth JSON-RPC接口

羊舌新荣
2023-12-01

总结一些当前项目中用到的eth JSON-RPC接口

当前燃气价格

{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}

返回客户端拥有的地址列表 应该是账户地址

{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}

返回给定地址的帐户的余额 参数地址

{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x7eff122b94897ea5b0e2a9abf47b86337fafebdc", "latest"],"id":1}

从这个地址发送的交易数量的整数

{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x7eff122b94897ea5b0e2a9abf47b86337fafebdc", "latest"],"id":1}

应该是最近一个块的高度

{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}

根据高度获取区块信息

{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x476fb", true],"id":1}

根据blockhash获取区块信息

0xfc3477de48611963cb7bdce3b7586838cb591513e810f4fae733b136562273f2

{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xfc3477de48611963cb7bdce3b7586838cb591513e810f4fae733b136562273f2", true],"id":1}

根据块哈希查询当前块里的交易数

{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xfc3477de48611963cb7bdce3b7586838cb591513e810f4fae733b136562273f2"],"id":1}

根据块高度查询当前块里的交易数

{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x476fb"],"id":1}

通过块哈希和事务索引位置返回关于交易的信息

{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xfc3477de48611963cb7bdce3b7586838cb591513e810f4fae733b136562273f2", "0x0"],"id":1}

通过块高度和事务索引位置返回关于交易的信息

{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["0x29c", "0x0"],"id":1}

通过交易哈希获取交易信息

{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}

通过交易哈希获取交易收据

{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}

Returns the number of transactions sent from an address

{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}

获取hashrate

{"jsonrpc":"2.0","method":"eth_hashrate","params":[],"id":1}

发送交易 1234密码

{"method": "personal_sendTransaction", "params": [{"from": "0x7eff122b94437ea5b0e2a9abf47b86337fafebdc", "to": "0x030f694e8ffe2a7tt7e0e0c907dc7882d98cc384", "value": "0x100000"}, "1234"], "id": 1}

 类似资料: