eth json rpc php,eth JSON-RPC接口

本文详细介绍了以太坊网络中常用的JSON-RPC接口,包括获取当前燃气价格、账户地址、账户余额、交易计数、区块高度、区块信息、交易详情等操作。这些接口对于开发者在进行以太坊智能合约交互和区块链数据查询时至关重要。
摘要由CSDN通过智能技术生成

总结一些当前项目中用到的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}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值