_compute_transaction_hash
dry_run_transaction
get_block
get_block_by_number
get_block_hash
get_blockchain_info
get_cells_by_lock_hash
get_current_epoch
get_epoch_by_number
get_live_cell
get_peers
get_peers_state
get_tip_block_number
get_tip_header
get_transaction
local_node_info
send_transaction
tx_pool_info
Return the transaction id
Deprecated: will be removed in a later version
transaction - The transaction object
version - Transaction version
deps - Dependent cells
inputs - Transaction inputs
outputs - Transaction outputs
witnesses - Witnesses
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
{
"deps": [],
"inputs": [
{
"args": [],
"previous_output": {
"block_hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"cell": {
"index": 0,
"tx_hash": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81"
}
},
"since": "0"
}
],
"outputs": [
{
"capacity": "100000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
}
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": "0xbecff6ee8cf2a40bdf391a03df501791b7946cea9a8d83b3d328a1ea5e1bc000"
}
Dry run transaction and return the execution cycles.
This method will not check the transaction validaty, but only run the lock script and type script and than return the execution cycles.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
{
"deps": [],
"inputs": [
{
"args": [],
"previous_output": {
"block_hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"cell": {
"index": 0,
"tx_hash": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81"
}
},
"since": "0"
}
],
"outputs": [
{
"capacity": "100000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
}
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"cycles": "0"
}
}
Returns the information about a block by hash.
hash - Hash of a block
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"0xa5224507f309ea8e98b5af50cb21e9e957845c6faef730971292df974f6a4e23"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"header": {
"difficulty": "0x3e8",
"epoch": "0",
"hash": "0xa5224507f309ea8e98b5af50cb21e9e957845c6faef730971292df974f6a4e23",
"number": "2",
"parent_hash": "0x47f672dde8811ea859378444b400f80db7c7c3f73dbd35083506c1e46f924858",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"timestamp": "1557310745",
"transactions_root": "0x6dc4b2e7b2ddafa108cb38069e1b3a69aead9f27099e7fb50ed935009ec0d397",
"uncles_count": 0,
"uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"version": 0,
"witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"proposals": [],
"transactions": [
{
"deps": [],
"hash": "0x6dc4b2e7b2ddafa108cb38069e1b3a69aead9f27099e7fb50ed935009ec0d397",
"inputs": [
{
"args": [
"0x0200000000000000"
],
"previous_output": {
"block_hash": null,
"cell": null
},
"since": "0"
}
],
"outputs": [
{
"capacity": "50000000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
}
],
"uncles": []
}
}
Get block by number
block_number - Number of a block
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"1024"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"header": {
"difficulty": "0x3e8",
"epoch": "1",
"hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"number": "1024",
"parent_hash": "0x574d0233963f188b32e8c791a5d063d96c7f4dd07a3eec9267120806ffd979d5",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"timestamp": "1557311767",
"transactions_root": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81",
"uncles_count": 0,
"uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"version": 0,
"witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"proposals": [],
"transactions": [
{
"deps": [],
"hash": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81",
"inputs": [
{
"args": [
"0x0004000000000000"
],
"previous_output": {
"block_hash": null,
"cell": null
},
"since": "0"
}
],
"outputs": [
{
"capacity": "50000000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
}
],
"uncles": []
}
}
Returns the hash of a block in the best-block-chain by block number; block of No.0 is the genesis block.
block_number - Number of a block
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"2"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": "0xa5224507f309ea8e98b5af50cb21e9e957845c6faef730971292df974f6a4e23"
}
Return state info of blockchain
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"chain": "main",
"difficulty": "0x3e8",
"epoch": "1",
"is_initial_block_download": true,
"median_time": "1557311762",
"warnings": ""
}
}
Returns the information about cells collection by the hash of lock script.
lock_hash - Cell lock script hash
from - Start block number
to - End block number
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"0xcb7bce98a778f130d34da522623d7e56705bddfe0dc4781bd2331211134a19a5",
"2",
"5"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": [
{
"capacity": "50000000000000",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"out_point": {
"block_hash": null,
"cell": {
"index": 0,
"tx_hash": "0x6dc4b2e7b2ddafa108cb38069e1b3a69aead9f27099e7fb50ed935009ec0d397"
}
}
},
{
"capacity": "50000000000000",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"out_point": {
"block_hash": null,
"cell": {
"index": 0,
"tx_hash": "0xc7fb8d25f1f52f7cf359d3605e0bb2ceb4774b4062278a557bebdd3d4bbd89d1"
}
}
},
{
"capacity": "50000000000000",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"out_point": {
"block_hash": null,
"cell": {
"index": 0,
"tx_hash": "0xff5a36107851d244e1543821f9f039c3d4eb69d9968750b0b0e82e78da86c987"
}
}
},
{
"capacity": "50000000000000",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"out_point": {
"block_hash": null,
"cell": {
"index": 0,
"tx_hash": "0x6c59c9628bc8473a1fd61ebac23f061e298a766b407aa300a299c746bdce2f6d"
}
}
}
]
}
Returns the information about the current epoch.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"block_reward": "173611111111",
"difficulty": "0x3e8",
"last_block_hash_in_previous_epoch": "0x3577b8bf75a98d563807542a1ab7cff84b9e9d5f1e0f5757fc5c7b712a629701",
"length": "2880",
"number": "1",
"remainder_reward": "320",
"start_number": "1000"
}
}
Return the information corresponding the given epoch number.
epoch_number - Epoch number
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"0"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"block_reward": "500000000000",
"difficulty": "0x3e8",
"last_block_hash_in_previous_epoch": "0x0000000000000000000000000000000000000000000000000000000000000000",
"length": "1000",
"number": "0",
"remainder_reward": "0",
"start_number": "0"
}
}
Returns the information about a cell by out_point.
out_point - OutPoint object {"tx_hash": <tx_hash>, "index": <index>}.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
{
"block_hash": null,
"cell": {
"index": 0,
"tx_hash": "0xff5a36107851d244e1543821f9f039c3d4eb69d9968750b0b0e82e78da86c987"
}
}
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"cell": {
"capacity": "50000000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
},
"status": "live"
}
}
Returns the connected peers information.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": [
{
"addresses": [
{
"address": "/ip4/192.168.0.3/tcp/8115",
"score": 1
}
],
"is_outbound": true,
"node_id": "QmaaaLB4uPyDpZwTQGhV63zuYrKm4reyN2tF1j2ain4oE7",
"version": "unknown"
},
{
"addresses": [
{
"address": "/ip4/192.168.0.4/tcp/8113",
"score": 255
}
],
"is_outbound": false,
"node_id": "QmRuGcpVC3vE7aEoB6fhUdq9uzdHbyweCnn1sDBSjfmcbM",
"version": "unknown"
},
{
"addresses": [],
"node_id": "QmUddxwRqgTmT6tFujXbYPMLGLAE2Tciyv6uHGfdYFyDVa",
"version": "unknown"
}
]
}
Return state info of peers
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": [
{
"blocks_in_flight": "86",
"last_updated": "1557289448237",
"peer": "1"
}
]
}
Returns the number of blocks in the longest blockchain.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": "1024"
}
Returns the information about the tip header of the longest.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"difficulty": "0x3e8",
"epoch": "1",
"hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"number": "1024",
"parent_hash": "0x574d0233963f188b32e8c791a5d063d96c7f4dd07a3eec9267120806ffd979d5",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"timestamp": "1557311767",
"transactions_root": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81",
"uncles_count": 0,
"uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"version": 0,
"witnesses_root": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
}
Returns the information about a transaction requested by transaction hash.
hash - Hash of a transaction
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
"0xbecff6ee8cf2a40bdf391a03df501791b7946cea9a8d83b3d328a1ea5e1bc000"
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"transaction": {
"deps": [],
"hash": "0xbecff6ee8cf2a40bdf391a03df501791b7946cea9a8d83b3d328a1ea5e1bc000",
"inputs": [
{
"args": [],
"previous_output": {
"block_hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"cell": {
"index": 0,
"tx_hash": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81"
}
},
"since": "0"
}
],
"outputs": [
{
"capacity": "100000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
},
"tx_status": {
"block_hash": null,
"status": "pending"
}
}
}
Returns the local node information.
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"addresses": [
{
"address": "/ip4/192.168.0.2/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"score": 255
},
{
"address": "/ip4/0.0.0.0/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"score": 1
}
],
"is_outbound": null,
"node_id": "QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"version": "0.9.0"
}
}
Send new transaction into transaction pool
transaction - The transaction object
version - Transaction version
deps - Dependent cells
inputs - Transaction inputs
outputs - Transaction outputs
witnesses - Witnesses
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": [
{
"deps": [],
"inputs": [
{
"args": [],
"previous_output": {
"block_hash": "0xca97a033aa9765914bc0b7887ff8723037614df11d06783555ff97e9a0e72b55",
"cell": {
"index": 0,
"tx_hash": "0x602b713fac38c0224bc2e8ba0ec9c8363d7d1e508897b33c32f45d7554883c81"
}
},
"since": "0"
}
],
"outputs": [
{
"capacity": "100000000000",
"data": "0x",
"lock": {
"args": [],
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"type": null
}
],
"version": 0,
"witnesses": []
}
]
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": "0xbecff6ee8cf2a40bdf391a03df501791b7946cea9a8d83b3d328a1ea5e1bc000"
}
Return the transaction pool information
echo '{
"id": 2,
"jsonrpc": "2.0",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type:application/json' -d @- \
http://localhost:8114
{
"id": 2,
"jsonrpc": "2.0",
"result": {
"last_txs_updated_at": "0",
"orphan": 0,
"pending": 1,
"staging": 0
}
}