Subscribe to Untitled
Subscribe to Untitled
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
查看地址:https://github.com/ethereum/wiki/wiki/JSON-RPC#curl-examples-explained
1.查看web3的版本
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
2.查看同步的网络net_version
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'
"1": Ethereum Mainnet "2": Morden Testnet (deprecated) "3": Ropsten Testnet "4": Rinkeby Testnet "42": Kovan Testnet
3.是否在监听网络连接
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'
4.返回当前连接到客户机的对等点的数量
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'
5.返回当前ethereum协议版本
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}'
6.获取当前的同步状态(返回的结果是16进制)
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'
7.返回节点的主地址 client coinbase address
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}'
8.节点是否在挖矿
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":71}'
9.查询当前的gas price ,单位wei
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
10.查询该节点的账户eth_accounts
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
11.查询最新的区块高度
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
12.查询账户余额
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'
13.获取某个地址的交易次数
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}'
14.查询某一个块的hash的交易数(没测试成功)
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f"],"id":1}'
15.查询某一个块的交易数
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x6ea7ce"],"id":1}'
1.如果提示The method net_version does not exist/is not available 可能是对应的rpc接口没打开
查看地址:https://github.com/ethereum/wiki/wiki/JSON-RPC#curl-examples-explained
1.查看web3的版本
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
2.查看同步的网络net_version
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'
"1": Ethereum Mainnet "2": Morden Testnet (deprecated) "3": Ropsten Testnet "4": Rinkeby Testnet "42": Kovan Testnet
3.是否在监听网络连接
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'
4.返回当前连接到客户机的对等点的数量
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'
5.返回当前ethereum协议版本
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}'
6.获取当前的同步状态(返回的结果是16进制)
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'
7.返回节点的主地址 client coinbase address
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}'
8.节点是否在挖矿
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":71}'
9.查询当前的gas price ,单位wei
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
10.查询该节点的账户eth_accounts
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
11.查询最新的区块高度
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
12.查询账户余额
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'
13.获取某个地址的交易次数
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}'
14.查询某一个块的hash的交易数(没测试成功)
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f"],"id":1}'
15.查询某一个块的交易数
curl localhost:7777 -H 'content-type:application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x6ea7ce"],"id":1}'
1.如果提示The method net_version does not exist/is not available 可能是对应的rpc接口没打开
No activity yet