一、簡介
以太坊的交互操作方式有console和JsonRPC,JsonRPC又有IPC、HTTP、WS等方式,例如開啓挖礦操作可以有以下方式:
-
Console:
miner.start()
-
IPC:
echo '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":1}' | nc -U $datadir/geth.ipc
-
HTTP:
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":74}' localhost:8545
console交互操作在系列四中已作介紹,在此介紹JsonRPC的交互接口(編寫程序時,在代碼中可使用RPC接口)
二、JsonRPC接口
詳情https://github.com/ethereum/wiki/wiki/JSON-RPC
- JavaScript API
- JSON-RPC Endpoint
- JSON-RPC support
- HEX value encoding
- The default block parameter
- Curl Examples Explained
- JSON-RPC methods
- JSON RPC API Reference
- web3_clientVersion
- web3_sha3
- net_version
- net_listening
- net_peerCount
- eth_protocolVersion
- eth_syncing
- eth_coinbase
- eth_mining
- eth_hashrate
- eth_gasPrice
- eth_accounts
- eth_blockNumber
- eth_getBalance
- eth_getStorageAt
- eth_getTransactionCount
- eth_getBlockTransactionCountByHash
- eth_getBlockTransactionCountByNumber
- eth_getUncleCountByBlockHash
- eth_getUncleCountByBlockNumber
- eth_getCode
- eth_sign
- eth_sendTransaction
- eth_sendRawTransaction
- eth_call
- eth_estimateGas
- eth_getBlockByHash
- eth_getBlockByNumber
- eth_getTransactionByHash
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionByBlockNumberAndIndex
- eth_getTransactionReceipt
- eth_pendingTransactions
- eth_getUncleByBlockHashAndIndex
- eth_getUncleByBlockNumberAndIndex
- eth_getCompilers (DEPRECATED)
- eth_compileSolidity (DEPRECATED)
- eth_compileLLL (DEPRECATED)
- eth_compileSerpent (DEPRECATED)
- eth_newFilter
- eth_newBlockFilter
- eth_newPendingTransactionFilter
- eth_uninstallFilter
- eth_getFilterChanges
- eth_getFilterLogs
- eth_getLogs
- eth_getWork
- eth_submitWork
- eth_submitHashrate
- eth_getProof
- db_putString
- db_getString
- db_putHex
- db_getHex
- shh_version
- shh_post
- shh_newIdentity
- shh_hasIdentity
- shh_newGroup
- shh_addToGroup
- shh_newFilter
- shh_uninstallFilter
- shh_getFilterChanges
- shh_getMessages