Nice Sprites And Scary Daemons



Daemon JSON RPC documentation

Yay Documentation!

As a heads up, all of these examples will be in a cURL format to give you a basic idea of how to format your JSON RPC request. If you have used JSON RPC in various other languages, the API should click with you pretty well.

I know that for a fact because the API clicked for me and I don't know JSON RPC in any language.



List of Daemon JSON RPC Commands:



get_block_count

Returns the current block height of the main chain.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json'



on_get_block_hash

Returns block hash for specifed block height.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"on_get_block_hash","params":[912345]}' -H 'Content-Type: application/json'



get_block_template

Returns block template, used to mine new blocks

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_template","params":{"wallet_address":"foUr42...","reserve_size":60}' -H 'Content-Type: application/json'



submit_block

Allows you to sumbit a block via the daemon

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"submit_block","params":["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]' -H 'Content-Type: application/json'



get_last_block_header

Returns the last blocks header.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' -H 'Content-Type: application/json'



get_block_header_by_hash

Retrieves block header based on block hash

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_hash","params":{"hash":"e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"}}' -H 'Content-Type: application/json'



get_block_header_by_height

Returns the block header based on height

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":912345}}' -H 'Content-Type: application/json'



get_block_headers_range

Returns block headers from a specified range of blocks

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_headers_range","params":{"start_height":1545999,"end_height":1546000}}' -H 'Content-Type: application/json'



get_block

Returns blocks info based on height pr hash

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"height":912345}}' -H 'Content-Type: application/json'

Looking up a block based on hash example

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block","params":{"hash":"510ee3c4e14330a7b96e883c323a60ebd1b5556ac1262d0bc03c24a3b785516f"}}' -H 'Content-Type: application/json'



get_connections

Returns information about your current ingoing and outgoing connections

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_connections"}' -H 'Content-Type: application/json'



get_info

Returns information about your node and the network.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_info"}' -H 'Content-Type: application/json'



hard_fork_info

Returns information about the current hard fork and related info.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"hard_fork_info"}' -H 'Content-Type: application/json'



set_bans

Ban another nodes IP address

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_bans","params":{"bans":[{"host":"192.168.1.51","ban":true,"seconds":30}]}}' -H 'Content-Type: application/json'



get_bans

Returns list of banned IP addresses.

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bans"}' -H 'Content-Type: application/json'



flush_txpool

Flushes all transactions currently in the mempool

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"flush_txpool","params":{"txids":["dc16fa8eaffe1484ca9014ea050e13131d3acf23b419f33bb4cc0b32b6c49308",""]}}' -H 'Content-Type: application/json'



get_output_histogram

Returns a histogram of output amounts

curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_histogram","params":{"amounts":[20000000000]}}' -H 'Content-Type: application/json'



get_coinbase_tx_sum

Returns the coinbase amount and fees for specified amount of blocks starting at specified height

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_coinbase_tx_sum","params":{"height":1563078,"count":2}}' -H 'Content-Type: application/json'



get_version

Returns current software version

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_version"}' -H 'Content-Type: application/json'



get_fee_estimate

Returns current software version

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_fee_estimate"}' -H 'Content-Type: application/json'



get_alternate_chains

Returns all known alternate chains

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_alternate_chains"}' -H 'Content-Type: application/json'



relay_tx

Relays transaction hashes to the network

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"relay_tx","params":{"txids":[9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613]}}' -H 'Content-Type: application/json'



sync_info

Returns sync information

curl -X POST http://127.0.0.1:4242/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sync_info"}' -H 'Content-Type: application/json'



get_txpool_backlog

Returns information about current txpool backlog

curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_txpool_backlog"}' -H 'Content-Type: application/json'



get_output_distribution

curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_output_distribution","params":{"amounts":[628780000],"from_height":1462078}}' -H 'Content-Type: application/json'





Github   Subreddit   Twitter