Skip to content

Latest commit

 

History

History
469 lines (322 loc) · 12.6 KB

rpc_requests.md

File metadata and controls

469 lines (322 loc) · 12.6 KB

outdated

Frontier: RPC requests templates in curl

eth: block_number

Get the current block number

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_estimateGas

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_estimateGas", "params": [{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "finalized"], "id": 0}' \
        http://localhost:9944

eth: eth_sendRawTransaction

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": ["0x0000000000000000"], "id": 0}' \
        http://localhost:9944

eth: eth_sendTransaction

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "finalized"], "id": 0}' \
        http://localhost:9944

eth: eth_call

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "finalized"], "id": 0}' \
        http://localhost:9944

eth: eth_getBlockTransactionCountByHash

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: eth_getBlockByNumber

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": [12345, false], "id": 0}' \
        http://localhost:9944

eth: eth_getBlockByHash

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getBlockByHash", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000", false], "id": 0}' \
        http://localhost:9944

eth: eth_getTransactionReceipt

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getTransactionReceipt", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: eth_getTransactionByBlockNumberAndIndex

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getTransactionByBlockNumberAndIndex", "params": ["latest", 0], "id": 0}' \
        http://localhost:9944

eth: eth_getTransactionByBlockHashAndIndex

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getTransactionByBlockHashAndIndex", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000", 0], "id": 0}' \
        http://localhost:9944

eth: eth_getTransactionByHash

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: eth_getTransactionCount

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getTransactionCount", "params": ["0x0000000000000000000000000000000000000000", "latest"], "id": 0}' \
        http://localhost:9944

eth: eth_syncing

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_syncing", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_getStorageAt

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getStorageAt", "params": ["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000", "latest"], "id": 0}' \
        http://localhost:9944

eth: eth_gasPrice

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_blockNumber

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_getCode

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getCode", "params": ["0x0000000000000000000000000000000000000000", "latest"], "id": 0}' \
        http://localhost:9944

eth: eth_chainId

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_getBalance

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0x0000000000000000000000000000000000000000", "latest"], "id": 0}' \
        http://localhost:9944

eth: coinbase

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_coinbase", "params": [], "id": 0}' \
        http://localhost:9944

eth: accounts

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 0}' \
        http://localhost:9944

eth: eth_getUncleByBlockNumberAndIndex

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getUncleByBlockNumberAndIndex", "params": [0, 0], "id": 0}' \
        http://localhost:9944

eth: eth_getUncleByBlockHashAndIndex

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getUncleByBlockHashAndIndex", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000", 0], "id": 0}' \
        http://localhost:9944

eth: eth_getUncleCountByBlockNumber

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getUncleCountByBlockNumber", "params": [707], "id": 0}' \
        http://localhost:9944

eth: eth_getUncleCountByBlockHash

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getUncleCountByBlockHash", "params": [ "0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: getWork

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getWork", "params": [], "id": 0}' \
        http://localhost:9944

eth: submitWork

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_submitWork", "params": ["0x0000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: submitHashrate

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_submitHashrate", "params": ["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000"], "id": 0}' \
        http://localhost:9944

eth: protocolVersion

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_protocolVersion", "params": [], "id": 0}' \
        http://localhost:9944

eth: hashrate

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_hashrate", "params": ["0x3", 10, []], "id": 0}' \
        http://localhost:9944

eth: eth_maxPriorityFeePerGas

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_maxPriorityFeePerGas", "params": [], "id": 0}' \
        http://localhost:9944

eth: fee_history

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_feeHistory", "params": ["0x3", 10, []], "id": 0}' \
        http://localhost:9944

eth: eth_mining

Get the current block number

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_mining", "params": [], "id": 0}' \
        http://localhost:9944 | jq ".result"

eth: block_by_number

Get block by number

   curl --header "Content-Type: application/json" \
        --request POST \
        --data '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": [3, false], "id": 0}' \
        http://localhost:9944 | jq ".result.hash"