Introduction
Welcome to the Monero API! The documentation divided into two parts - Daemon and Wallet. Majority of Daemon's RPC calls uses JSON RPC interface while some use their own interfaces, as demonstrated below. In contrast requests Wallet RPC calls are served through the JSON RPC interface entirely.
The JSON RPC endpont is /json_rpc
Daemon JSON RPC Calls
getblockcount
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "getblockcount"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result" :{
"count": 993163,
"status": "OK"
}
}
Look up how many blocks are in the longest chain known to the node.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
count | unsigned int | Number of blocks in longest chain seen by the node. |
status | string | General RPC error code. "OK" means everything looks good. |
on_getblockhash
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0","id": "0","method": "on_getblockhash", "params": [912345]}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":"e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"
}
Look up a block's hash by its height.
Inputs
Parameter | Type | Description |
---|---|---|
block height | int array | int array of length 1 |
Outputs
Parameter | Type | Description |
---|---|---|
block hash | string | Block's hash |
getblocktemplate
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getblocktemplate",
"params": {
"wallet_address": "44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns",
"reserve_size": 60
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"blocktemplate_blob":"01029af88cb70568b84a11dc9406ace9e635918ca03b008f7728b9726b327c1b482a98d81ed83000000000018bd03c01ffcfcf3c0493d7cec7020278dfc296544f139394e5e045fcda1ba2cca5b69b39c9ddc90b7e0de859fdebdc80e8eda1ba01029c5d518ce3cc4de26364059eadc8220a3f52edabdaf025a9bff4eec8b6b50e3d8080dd9da417021e642d07a8c33fbe497054cfea9c760ab4068d31532ff0fbb543a7856a9b78ee80c0f9decfae01023ef3a7182cb0c260732e7828606052a0645d3686d7a03ce3da091dbb2b75e5955f01ad2af83bce0d823bf3dbbed01ab219250eb36098c62cbb6aa2976936848bae53023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f12d7c87346d6b84e17680082d9b4a1d84e36dd01bd2c7f3b3893478a8d88fb3",
"difficulty":982540729,
"height":993231,
"prev_hash":"68b84a11dc9406ace9e635918ca03b008f7728b9726b327c1b482a98d81ed830",
"reserved_offset":246,
"status":"OK"
}
}
Lookup block template
Inputs
Parameter | Type | Description |
---|---|---|
wallet_address | string | Address of wallet to receive coinbase transactions if block is successfully mined. |
difficulty | unsigned int | Reserve size. |
Outputs
Parameter | Type | Description |
---|---|---|
blocktemplate_blob | string | Blob on which to try to mine a new block. |
difficulty | unsigned int | Difficulty of next block. |
height | unsigned int | Height on which to mine. |
prev_hash | string | Hash of the most recent block on which to mine the next block. |
reserved_offset | unsigned int | Reserved offset. |
status | string | General RPC error code. "OK" means everything looks good. |
submitblock
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "submitblock",
"params": "XXX"
}'
Submit a mined block to the network.
Inputs
Parameter | Type |
---|---|
Block blob data | string |
Outputs
Parameter | Type | Description |
---|---|---|
status | string | Block submission status. |
getlastblockheader
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getlastblockheader",
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"depth": 0,
"difficulty": 746963928,
"hash": "ac0f1e226268d45c99a16202fdcb730d8f7b36ea5e5b4a565b1ba1a8fc252eb0",
"height": 990793,
"major_version": 1,
"minor_version": 1,
"nonce": 1550,
"orphan_status": false,
"prev_hash": "386575e3b0b004ed8d458dbd31bff0fe37b280339937f971e06df33f8589b75c",
"reward": 6856609225169,
"timestamp": 1457589942
},
"status": "OK"
}
}
Block header information for the most recent block is easily retrieved with this method. No inputs are needed.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
block_header | object | A structure containing block header information. |
block_header
field structure
Parameter | Type | Description |
---|---|---|
depth | string | Blob on which to try to mine a new block. |
depth | unsigned int | The number of blocks succeeding this block on the blockchain. A larger number means an older block. |
difficulty | unsigned int | The strength of the Monero network based on mining power. |
hash | string | The hash of this block. |
height | unsigned int | The number of blocks preceding this block on the blockchain. |
major_version | unsigned int | The major version of the monero protocol at this block height. |
minor_version | unsigned int | The minor version of the monero protocol at this block height. |
nonce | unsigned int | a cryptographic random one-time number used in mining a Monero block. |
orphan_status | boolean | Usually false. If true, this block is not part of the longest chain. |
prev_hash | string | The hash of the block immediately preceding this block in the chain. |
reward | unsigned int | The amount of new atomic units generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 atomic units. |
timestamp | unsigned int | The time the block was recorded into the blockchain. |
status | string | General RPC error code. "OK" means everything looks good. |
getblockheaderbyhash
In this example, block
912345
is looked up by its hash:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getblockheaderbyhash",
"params": {
"hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"depth": 78376,
"difficulty": 815625611,
"hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
"height": 912345,
"major_version": 1,
"minor_version": 2,
"nonce": 1646,
"orphan_status": false,
"prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78",
"reward": 7388968946286,
"timestamp": 1452793716
},
"status": "OK"
}
}
Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.
Inputs
Parameter | Type | Description |
---|---|---|
hash | string | The block's sha256 hash. |
Outputs
Parameter | Type | Description |
---|---|---|
block_header | object | A structure containing block header information. See getlastblockheader. |
getblockheaderbyheight
Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getblockheaderbyheight",
"params": {
"height": 912345
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"depth": 78376,
"difficulty": 815625611,
"hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
"height": 912345,
"major_version": 1,
"minor_version": 2,
"nonce": 1646,
"orphan_status": false,
"prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78",
"reward": 7388968946286,
"timestamp": 1452793716
},
"status": "OK"
}
}
Similar to getblockheaderbyhash above, this method includes a block's height as an input parameter to retrieve basic information about the block.
Inputs
Parameter | Type | Description |
---|---|---|
height | unsigned int | The block's height. |
Outputs
Parameter | Type | Description |
---|---|---|
block_header | object | A structure containing block header information. |
block_header
field structure
Parameter | Type | Description |
---|---|---|
depth | string | Blob on which to try to mine a new block. |
depth | unsigned int | The number of blocks succeeding this block on the blockchain. A larger number means an older block. |
difficulty | unsigned int | The strength of the Monero network based on mining power. |
hash | string | The hash of this block. |
height | unsigned int | The number of blocks preceding this block on the blockchain. |
major_version | unsigned int | The major version of the monero protocol at this block height. |
minor_version | unsigned int | The minor version of the monero protocol at this block height. |
nonce | unsigned int | a cryptographic random one-time number used in mining a Monero block. |
orphan_status | boolean | Usually false. If true, this block is not part of the longest chain. |
prev_hash | string | The hash of the block immediately preceding this block in the chain. |
reward | unsigned int | The amount of new atomic units generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 atomic units. |
timestamp | unsigned int | The time the block was recorded into the blockchain. |
status | string | General RPC error code. "OK" means everything looks good. |
getblock
Look up by height: In the following example, block
912345
is looked up by its height. Note that block912345
does not have any non-coinbase transactions. (See the next example for a block with extra transactions):
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getblock",
"params": {
"height": 912345
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blob": "…",
"block_header": {
"depth": 80694,
"difficulty": 815625611,
"hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
"height": 912345,
"major_version": 1,
"minor_version": 2,
"nonce": 1646,
"orphan_status": false,
"prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78",
"reward": 7388968946286,
"timestamp": 1452793716
},
"json": "{
\"major_version\": 1,
\"minor_version\": 2,
\"timestamp\": 1452793716,
\"prev_id\": \"b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78\",
\"nonce\": 1646,
\"miner_tx\": {
\"version\": 1,
\"unlock_time\": 912405,
\"vin\": [
{
\"gen\": {
\"height\": 912345
}
}
],
\"vout\": [
{
\"amount\": 8968946286,
\"target\": {
\"key\": \"378b043c1724c92c69d923d266fe86477d3a5ddd21145062e148c64c57677008\"
}
},
{
\"amount\": 80000000000,
\"target\": {
\"key\": \"73733cbd6e6218bda671596462a4b062f95cfe5e1dbb5b990dacb30e827d02f2\"
}
},
{
\"amount\": 300000000000,
\"target\": {
\"key\": \"47a5dab669770da69a860acde21616a119818e1a489bb3c4b1b6b3c50547bc0c\"
}
},
{
\"amount\": 7000000000000,
\"target\": {
\"key\": \"1f7e4762b8b755e3e3c72b8610cc87b9bc25d1f0a87c0c816ebb952e4f8aff3d\"
}
}
],
\"extra\": [
1, 253, 10, 119, 137, 87, 244, 243, 16, 58, 131, 138, 253, 164, 136, 195, 205, 173, 242, 105, 123, 61, 52,
173, 113, 35, 66, 130, 178, 250, 217, 16, 14, 2, 8, 0, 0, 0, 11, 223, 194, 193, 108
],
\"signatures\": [
]
},
\"tx_hashes\": [
]
}",
"status": "OK"
}
}
Look up by hash: In the following example, block
993056
is looked up by its hash. Note that block993056
has 3 non-coinbase transactions:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getblock",
"params": {
"hash": "510ee3c4e14330a7b96e883c323a60ebd1b5556ac1262d0bc03c24a3b785516f"
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blob": "…",
"block_header": {
"depth": 12,
"difficulty": 964985344,
"hash": "510ee3c4e14330a7b96e883c323a60ebd1b5556ac1262d0bc03c24a3b785516f",
"height": 993056,
"major_version": 1,
"minor_version": 2,
"nonce": 2036,
"orphan_status": false,
"prev_hash": "0ea4af6547c05c965afc8df6d31509ff3105dc7ae6b10172521d77e09711fd6d",
"reward": 6932043647005,
"timestamp": 1457720227
},
"json": {
\"major_version\": 1,
\"minor_version\": 2,
\"timestamp\": 1457720227,
\"prev_id\": \"0ea4af6547c05c965afc8df6d31509ff3105dc7ae6b10172521d77e09711fd6d\",
\"nonce\": 2036,
\"miner_tx\": {
\"version\": 1,
\"unlock_time\": 993116,
\"vin\": [
{
\"gen\": {
\"height\": 993056
}
}
],
\"vout\": [
{
\"amount\": 2043647005,
\"target\": {
\"key\": \"59e9d685b3484886bc7b47c133e6099ecdf212d5eaa16ce19cd58e8c3c1e590a\"
}
},
{
\"amount\": 30000000000,
\"target\": {
\"key\": \"4c5e2f542d25513c46b9e3b7d40140a22d0ae5314bfcae492ad9f56fff8185f0\"
}
},
{
\"amount\": 900000000000,
\"target\": {
\"key\": \"13dd8ffdac9e6a2f71e327dad65328198dc879a492d145eae72677c0703a3515\"
}
},
{
\"amount\": 6000000000000,
\"target\": {
\"key\": \"62bda00341681dccbc066757862da593734395745bdfe1fdc89b5948c86a5d4c\"
}
}
],
\"extra\": [
1, 182, 145, 133, 28, 240, 87, 185, 195, 2, 163, 219, 202, 135, 158, 28, 186, 76, 196, 80, 97, 202, 85, 170,
166, 224, 60, 220, 103, 171, 158, 69, 80, 2, 8, 0, 0, 0, 12, 97, 127, 223, 22
],
\"signatures\": [
]
},
\"tx_hashes\": [
\"79c6b9f00db027bde151705aafe85c495883aae2597d5cb8e1adb2e0f3ae1d07\",
\"d715db73331abc3ec588ef07c7bb195786a4724b08dff431b51ffa32a4ce899b\",
\"b197066426c0ed89f0b431fe171f7fd62bc95dd29943daa7cf3585cf1fdfc99d\"
]
}",
"status": "OK",
"tx_hashes": [
"79c6b9f00db027bde151705aafe85c495883aae2597d5cb8e1adb2e0f3ae1d07",
"d715db73331abc3ec588ef07c7bb195786a4724b08dff431b51ffa32a4ce899b",
"b197066426c0ed89f0b431fe171f7fd62bc95dd29943daa7cf3585cf1fdfc99d"
]
}
}
Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters.
Inputs
Parameter | Type | Description |
---|---|---|
height | unsigned int | The block's height. |
hash | string | The block's hash. |
Outputs
Parameter | Type | Description |
---|---|---|
blob | string | Hexadecimal blob of block information. |
block_header | object | A structure containing block header information. |
json | json string | JSON formatted block details |
status | string | General RPC error code. "OK" means everything looks good. |
block_header
field structure
Parameter | Type | Description |
---|---|---|
depth | string | Blob on which to try to mine a new block. |
depth | unsigned int | The number of blocks succeeding this block on the blockchain. A larger number means an older block. |
difficulty | unsigned int | The strength of the Monero network based on mining power. |
hash | string | The hash of this block. |
height | unsigned int | The number of blocks preceding this block on the blockchain. |
major_version | unsigned int | The major version of the monero protocol at this block height. |
minor_version | unsigned int | The minor version of the monero protocol at this block height. |
nonce | unsigned int | a cryptographic random one-time number used in mining a Monero block. |
orphan_status | boolean | Usually false. If true, this block is not part of the longest chain. |
prev_hash | string | The hash of the block immediately preceding this block in the chain. |
reward | unsigned int | The amount of new atomic units generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 atomic units. |
timestamp | unsigned int | The time the block was recorded into the blockchain. |
status | string | General RPC error code. "OK" means everything looks good. |
json
field structure(when parsed)
Parameter | Type | Description |
---|---|---|
major_version | unsigned int | Same as in block header. |
minor_version | unsigned int | Same as in block header. |
timestamp | unsigned int | Same as in block header. |
prev_id | string | Same as prev_hash in block header. |
miner_tx | object | Miner transaction information(see below). |
tx_hashes | array | List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list. |
miner_tx
field structure
Parameter | Type | Description |
---|---|---|
version | - | Transaction version number. |
unlock_time | - | The block height when the coinbase transaction becomes spendable. |
vin | array | List of transaction inputs(see below) |
vout | array | List of transaction outputs(see below). |
extra | - | Usually called the "transaction ID" but can be used to include any random 32 byte/64 character hex string. |
signatures | - | Contain signatures of tx signers. Coinbased txs do not have signatures. |
miner_tx.vin[]
field structure (transaction inputs list)
Parameter | Type | Description |
---|---|---|
gen | array | Miner txs are coinbase txs, or "gen"(see below). |
miner_tx.vin[].gen
field structure (transaction inputs list)
Parameter | Type | Description |
---|---|---|
height | - | This block height, a.k.a. when the coinbase is generated. |
miner_tx.vout[]
field structure
Parameter | Type | Description |
---|---|---|
amount | - | Amount of transaction output, in atomic units.. |
target | object | Output destination information(see below). |
miner_tx.vout[].target
field structure
Parameter | Type | Description |
---|---|---|
key | - | The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output. |
get_connections
Following is an example of
get_connections
and it's return:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "get_connections"
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"connections": [
{
"avg_download": 0,
"avg_upload": 0,
"current_download": 0,
"current_upload": 0,
"incoming": false,
"ip": "76.173.170.133",
"live_time": 1865,
"local_ip": false,
"localhost": false,
"peer_id": "3bfe29d6b1aa7c4c",
"port": "18080",
"recv_count": 116396,
"recv_idle_time": 23,
"send_count": 176893,
"send_idle_time": 1457726610,
"state": "state_normal"
}
],
"status": "OK"
}
}
Retrieve information about incoming and outgoing connections to your node.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
connections | array | List of all connections and their info(see below). |
connections[]
field structure
Parameter | Type | Description |
---|---|---|
avg_download | unsigned int | Average bytes of data downloaded by node. |
avg_upload | unsigned int | Average bytes of data uploaded by node. |
current_download | unsigned int | Current bytes downloaded by node. |
current_upload | unsigned int | Current bytes uploaded by node. |
incoming | boolean | Is the node getting information from your node? |
ip | string | The node's IP address. |
live_time | unsigned int | - |
local_ip | boolean | - |
localhost | boolean | - |
peer_id | string | The node's ID on the network. |
port | string | The port that the node is using to connect to the network. |
recv_count | unsigned int | - |
recv_idle_time | unsigned int | - |
send_count | unsigned int | - |
send_idle_time | unsigned int | - |
state | unsigned int | - |
get_info
Following is an example of
get_info
and it's return:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "get_info"
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"alt_blocks_count": 5,
"difficulty": 972165250,
"grey_peerlist_size": 2280,
"height": 993145,
"incoming_connections_count": 0,
"outgoing_connections_count": 8,
"status": "OK",
"target": 60,
"target_height": 993137,
"testnet": false,
"top_block_hash": "",
"tx_count": 564287,
"tx_pool_size": 45,
"white_peerlist_size": 529
}
}
Retrieve general information about the state of your node and the network.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
alt_blocks_count | unsigned int | Number of alternative blocks to main chain. |
difficulty | unsigned int | Network difficulty (analogous to the strength of the network) |
grey_peerlist_size | unsigned int | Grey Peerlist Size |
height | unsigned int | Current length of longest chain known to daemon. |
incoming_connections_count | unsigned int | Number of peers connected to and pulling from your node. |
outgoing_connections_count | unsigned int | Number of peers that you are connected to and getting information from. |
target | unsigned int | Current target for next proof of work. |
target_height | unsigned int | The height of the next block in the chain. |
testnet | boolean | States if the node is on the testnet (true) or mainnet (false). |
top_block_hash | string | Hash of the highest block in the chain. |
tx_count | unsigned int | Total number of non-coinbase transaction in the chain. |
tx_pool_siz | unsigned int | Number of transactions that have been broadcast but not included in a block. |
white_peerlist_size | unsigned int | White Peerlist Size |
status | string | General RPC error code. "OK" means everything looks good. |
hard_fork_info
Following is an example of
hard_fork_info
and it's return:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "hard_fork_info"
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"earliest_height": 1009827,
"enabled": false,
"state": 2,
"status": "OK",
"threshold": 0,
"version": 1,
"votes": 7277,
"voting": 2,
"window": 10080
}
}
Look up information regarding hard fork voting and readiness.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
earliest_height | unsigned int | Block height at which hard fork would be enabled if voted in. |
enabled | boolean | Tells if hard fork is enforced. |
state | unsigned int | Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good). |
threshold | unsigned int | Minimum percent of votes to trigger hard fork. Default is 80. |
version | unsigned int | The major block version for the fork. |
votes | unsigned int | Number of votes towards hard fork. |
voting | unsigned int | Hard fork voting status. |
window | unsigned int | Number of blocks over which current votes are cast. Default is 10080 blocks. |
status | string | General RPC error code. "OK" means everything looks good. |
setbans
Following is an example of
setbans
and it's return:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"setbans",
"params":{
"bans":[
{
"ip":838969536,
"ban":true,
"seconds":30
}
]
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"status":"OK"
}
}
Ban another node by IP.
Inputs
Parameter | Type | Description |
---|---|---|
bans | array | A list of nodes to ban(see below) |
bans[]
field structure
Parameter | Type | Description |
---|---|---|
ip | unsigned int | Banned IP address, in Int format. |
ban | boolean | Set true to ban. |
seconds | unsigned int | Local Unix time that IP is banned until. |
Outputs
Parameter | Type | Description |
---|---|---|
status | string | General RPC error code. "OK" means everything looks good. |
getbans
Following is an example of
getbans
and it's return:
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "getbans"
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"bans":[
{
"ip":838969536,
"seconds":1457748792
}
],
"status":"OK"
}
}
Look up banned IPs
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
bans | array | List of banned nodes(see below) |
status | string | General RPC error code. "OK" means everything looks good. |
bans[]
field structure
Parameter | Type | Description |
---|---|---|
ip | unsigned int | Banned IP address, in Int format. |
seconds | unsigned int | Local Unix time that IP is banned until. |
get_fee_estimate
curl -X POST http://127.0.0.1:18081/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "get_fee_estimate"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result" :{
"fee": 382440000,
"status": "OK"
}
}
Lookup up fee information
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
fee | unsigned int | Current fee in atomic units per kB |
status | string | General RPC error code. "OK" means everything looks good. |
Other Daemon RPC Calls
Not all daemon RPC calls use the JSON_RPC interface. This section gives examples of these calls.
The data structure for these calls is different than the JSON RPC calls. Whereas the JSON RPC methods were called using the /json_rpc
extension and specifying a method, these methods are called at their own extensions. For example:
curl -X POST http://127.0.0.1:18081/gettransactions \
-H 'Content-Type: application/json' \
-d '{
"txs_hashes": [
"d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"
]
}'
getheight
Following is an example of
getheight
and it's return:
curl -X POST http://127.0.0.1:18081/getheight \
-H 'Content-Type: application/json'
The above command returns JSON structured like this:
{
"height": 993488,
"status": "OK"
}
Get the node's current height.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
height | unsigned int | Current length of longest chain known to daemon. |
status | string | General error code."OK" means everything looks good. |
gettransactions
Example 1: Return transaction information in binary format and it's return:
curl -X POST http://127.0.0.1:18081/gettransactions \
-H 'Content-Type: application/json' \
-d '{
"txs_hashes": [
"d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"
]
}'
The above command returns JSON structured like this:
{
"txs_as_hex": ["…"]
"status": "OK",
}
Example 2: Decode returned transaction information in JSON format and it's return. Note: the
vout
list has been truncated in the displayed return for space considerations.
curl -X POST http://127.0.0.1:18081/gettransactions \
-H 'Content-Type: application/json' \
-d '{
"txs_hashes": [
"d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"
],
"decode_as_json": true
}'
The above command returns JSON structured like this:
{
"status":"OK",
"txs_as_hex":[
"…"
],
"txs_as_json": "[
{
\"version\":1,
\"unlock_time\":0,
\"vin\":[
{
\"key\":{
\"amount\":70000000,
\"key_offsets\":[
35952
],
\"k_image\":\"d16908468dff9438a9814fe96bdaa575f06fe8da85772b72e54926428712293d\"
}
},
{
\"key\":{
\"amount\":400000000000000,
\"key_offsets\":[
6830
],
\"k_image\":\"c7a7024b763df1181ae6fe821b70669735e38a68162ac02362e33acbe829b605\"
}
}
],
\"vout\":[
{
\"amount\":50000,
\"target\":{
\"key\":\"f6be43f7be4f06adcb1d06f4a07c637c7359e009cf3e57bb32b8c9ea636509c3\"
}
},
{
\"amount\":200000,
\"target\":{
\"key\":\"b0a7a8e32f2b5302552bcd8d85112c62838b1f56cccd844eb9b63e0a732d0353\"
}
}
],
\"extra\":[
1, 225, 240, 98, 34, 169, 73, 47, 237, 117, 192, 30, 192, 60, 155, 47, 4, 115, 20, 21, 11, 13, 252, 219, 129, 13, 174, 37, 36, 78, 191, 141, 109
],
\"signatures\":[
\"e6a3be8003d481d2855c8127f56871de3d28a4fb52385b999eb986c831c5cc08361c126b0db24a21b6c4299b438ee2be201d44d57a371230b9cd04395ab8c400\",
\"8309851abaf2cf2a7091e0cdb9c83704fa7d68838a7a8ef8c178bb55a1e93a038dd18bb4a7549dc056b7a70e037cabd80911a03f427e36f712756d4c00f38f0b\"
]
}
]"
}
Look up one or more transactions by hash.
Inputs
Parameter | Type | Description |
---|---|---|
txs_hashes | array | List of transaction hashes to look up. |
decode_as_json | boolean | Optional. If set true , the returned transaction information will be decoded rather than binary. |
Outputs
Parameter | Type | Description |
---|---|---|
txs_as_json | string | json string; (Optional - returned if set in inputs.) List of transaction info(see below). |
txs_as_hex | string | Full transaction information as a hex string. |
status | string | General error code."OK" means everything looks good. |
txs_as_json[]
field structure
Parameter | Type | Description |
---|---|---|
version | unsigned int | Transaction version. |
unlock_time | unsigned int | If not 0, this tells when a transaction output is spendable. |
vin | array | List of inputs into transaction(see below). |
vout | array | List of outputs from transaction(see below) |
extra | array | Usually called the "payment ID" but can be used to include any random 32 bytes. |
singatures | array | List of ignatures used in ring signature to hide the true origin of the transaction. |
txs_as_json[].vin[]
field structure
Parameter | Type | Description |
---|---|---|
key | object | The public key of the previous output spent in this transaction(see below). |
txs_as_json[].vin[].key
field structure
Parameter | Type | Description |
---|---|---|
amount | - | The amount of the input, in atomic units. |
key_offsets | - | A list of integer offets to the input. |
k_image | - | The key image for the given input |
txs_as_json[].vout[]
field structure
Parameter | Type | Description |
---|---|---|
amount | - | Amount of transaction output, in atomic units.. |
target | object | Output destination information(see below). |
txs_as_json[].vout[].target
field structure
Parameter | Type | Description |
---|---|---|
key | - | The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output. |
is_key_image_spent
Following is an example of
is_key_image_spent
and it's return:
curl -X POST http://127.0.0.1:18081/is_key_image_spent \
-H 'Content-Type: application/json' \
-d '{
"key_images": [
"8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3",
"7319134bfc50668251f5b899c66b005805ee255c136f0e1cecbb0f3a912e09d4"
]
}'
The above command returns JSON structured like this:
{
"spent_status": [1,2],
"status": "OK"
}
Check if outputs have been spent using the key image associated with the output.
Inputs
Parameter | Type | Description |
---|---|---|
key_images | array of strings | List of key image hex strings to check. |
Outputs
Parameter | Type | Description |
---|---|---|
spent_status | array of unsigned ints | List of statuses for each image checked. Statuses are follows:
|
status | string | General error code."OK" means everything looks good. |
sendrawtransaction
Following is an example of
sendrawtransaction
and it's return:
curl -X POST http://127.0.0.1:18081/sendrawtransaction \
-H 'Content-Type: application/json' \
-d '{
"tx_as_hex":"de6a3…"
}'
The above command returns JSON structured like this:
{
"status": "OK"
}
Broadcast a raw transaction to the network.
Inputs
Parameter | Type | Description |
---|---|---|
tx_as_hex | string | Full transaction information as hexidecimal string. |
Outputs
Parameter | Type | Description |
---|---|---|
status | string | General error code."OK" means everything looks good. |
get_transaction_pool
Following is an example of
get_transaction_pool
and it's return:
curl -X POST http://127.0.0.1:18081/get_transaction_pool \
-H 'Content-Type: application/json'
The above command returns JSON structured like this:
{
"spent_key_images": [
{
"id_hash": "1edb9ecc39602040282d326070ad22cb473c952c0d6280c9c4c3b853fb34f3bc",
"txs_hashes": [
"409911b2be02e3f0e930b326c67ab9e74675885ce23d71bb3bd28b62bc3e7803"
]
},
{
"id_hash": "4adb4bb63b3397027340ca4e6c45f4ce2147dfb3a4e0fafdec18834ae594a05e",
"txs_hashes": [
"946f1f4c52e3426a41959c93b60078f314813bc4bdebcf69b8ee11d593b2bd14"
]
}
],
"status": "OK",
"transactions": [
{
"blob_size": 25761,
"fee": 290000000000,
"id_hash": "11d4cff23e610fac6a2b89187ad61d429a5e226652693dcac5d83d506eb92b96",
"kept_by_block": false,
"last_failed_height": 0,
"last_failed_id_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"max_used_block_height": 954508,
"max_used_block_id_hash": "03f96b374778bc059e47b96e2beec2e6d4d9e0ad39afeabdbcd77e1bd5a62f81",
"receive_time": 1457676127,
"tx_json": "{
\"version\": 1,
\"unlock_time\": 0,
\"vin\": [
{
\"key\": {
\"amount\": 70000000000,
\"key_offsets\": [
63408,
18978,
78357,
16560
],
\"k_image\": \"7319134bfc50668251f5b899c66b005805ee255c136f0e1cecbb0f3a912e09d4\"
}
}
],
\"vout\": [
{
\"amount\": 80000000000,
\"target\": {
\"key\": \"094e6a1b187385533665f89db741149f42d95fdc50bdd2a2384bcd1dc5209c55\"
}
}
],
\"extra\": [
2, 33, 0, 15, 56, 190, 21, 169, 77, 13, 182, 209, 51, 35, 54, 96, 89, 237, 96, 23, 24, 107, 240, 79, 40, 86, 64, 68, 45, 166, 119, 192, 17, 225, 23, 1, 31, 159, 145, 15, 173, 255, 165, 192, 55, 84, 127, 154, 163, 25, 85, 204, 212, 127, 147, 133, 118, 218, 166, 52, 78, 188, 131, 235, 9, 159, 105, 158
],
\"signatures\": [
"966e5a67fbdbf72d7dc0364b705121a58e0ced7e2ab45747b6b154c05a1afe04fac4aac7f64faa2dc6dd4d51b8277f11e2f2ec7729fac225088befe3b8399c0b71a4cb55b9d0e20f93d305c78cebceff1bcfcfaf225428dfcfaaec630c88720ab65bf5d3399dd1ac82ea0ecf308b3f80d9780af7742fb157692cd60515a7e2086878f082117fa80fff3d257de7d3a2e9cc8b3472ef4a5e545d90e1159523a60f38d16cece783579627124776813334bdb2a2df4171ef1fa12bf415da338ce5085c01e7a715638ef5505aebec06a0625aaa72d13839838f7d4f981673c8f05f08408e8b372f900af7227c49cfb1e1febab6c07dd42b7c26f921cf010832841205"
]
}"
}
]
}
Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information in the node's memory.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
spent_key_images | array | List of spent output key images(see below) |
transactions | array | List of transactions in the mempool that have not been included in a block(See below) |
status | string | General error code."OK" means everything looks good. |
spent_key_images[]
field structure
Parameter | Type | Description |
---|---|---|
id_hash | string | Key image ID hash. |
txs_hashes | array of strings | Key image transaction hashes. |
transactions[]
field structure
Parameter | Type | Description |
---|---|---|
blob_size | unsigned int | The size of the full transaction blob. |
fee | unsigned int | The amount of the mining fee included in the transaction, in atomic units. |
id_hash | string | The transaction ID hash. |
kept_by_block | boolean | We do not accept transactions that timed out before, unless set true. |
last_failed_height | unsigned int | If the transaction has previously timed out, this tells at what height that occured. |
last_failed_id_hash | string | Like the previous, this tells the previous transaction ID hash. |
max_used_block_height | unsigned int | Tells the height of the most recent block with an output used in this transaction. |
max_used_block_hash | string | Tells the hash of the most recent block with an output used in this transaction. |
receive_time | unsigned int | The Unix time that the transaction was first seen on the network by the node. |
tx_json | json string | JSON structure of all information in the transaction(See below). |
transactions[].tx_json
field structure
Parameter | Type | Description |
---|---|---|
version | - | Transaction version |
unlock_time | - | If not 0, this tells when a transaction output is spendable. |
vin | - | List of inputs into transaction(See below). |
vout | - | List of outputs from transaction(See below). |
extra | - | Usually called the "transaction ID" but can be used to include any random 32 bytes. |
signatures | - | List of ignatures used in ring signature to hide the true origin of the transaction. |
transactions[].tx_json.vin[]
field structure
Parameter | Type | Description |
---|---|---|
key | object | The public key of the previous output spent in this transaction(see below). |
transactions[].tx_json.vin[].key
field structure
Parameter | Type | Description |
---|---|---|
amount | - | The amount of the input, in atomic units. |
key_offsets | - | A list of integer offets to the input. |
k_image | - | The key image for the given input |
txs_as_json.vout[]
field structure
Parameter | Type | Description |
---|---|---|
amount | - | Amount of transaction output, in atomic units.. |
target | object | Output destination information(see below). |
txs_as_json.vout[].target
field structure
Parameter | Type | Description |
---|---|---|
key | - | The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output. |
stop_daemon
Following is an example of
stop_daemon
and it's return:
curl -X POST http://127.0.0.1:18081/stop_daemon \
-H 'Content-Type: application/json'
The above command returns JSON structured like this:
{
"status": "OK"
}
Send a command to the daemon to safely disconnect and shut down.
Inputs
Inputs: None.
Outputs
Parameter | Type | Description |
---|---|---|
status | string | General error code."OK" means everything looks good. |
Wallet JSON RPC Calls
Authentication
This is a list of the monero-wallet-rpc calls, their inputs and outputs, and examples of each. The program monero-wallet-rpc replaced the rpc interface that was in simplewallet and then monero-wallet-cli.
All monero-wallet-rpc methods use the same JSON RPC interface.
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"make_integrated_address",
"params":{
"payment_id":"1234567890123456789012345678900012345678901234567890123456789000"
}
}'
If the monero-wallet-rpc was executed with the --rpc-login
argument as username:password
, then follow this example:
curl -X POST http://127.0.0.1:18082/json_rpc \
-u username:password --digest \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"make_integrated_address",
"params":{
"payment_id":"1234567890123456789012345678900012345678901234567890123456789000"
}
}'
getbalance
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "getbalance"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"balance": 140000000000,
"unlocked_balance": 50000000000
}
}
Return the wallet's balance.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
balance | unsigned int | The total balance of the current monero-wallet-rpc in session. |
unlocked_balance | string | Unlocked funds are those funds that are sufficiently deep enough in the Monero blockchain to be considered safe to spend. |
getaddress
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "getaddress"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"address": "427ZuEhNJQRXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQGaDsaBA"
}
}
Return the wallet's address.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
address | string | The 95-character hex address string of the monero-wallet-rpc in session. |
getheight
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "getheight"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"address": "994310"
}
}
Returns the wallet's current block height.
Inputs
None
Outputs
Parameter | Type | Description |
---|---|---|
height | string | ; The current monero-wallet-rpc's blockchain height. If the wallet has been offline for a long time, it may need to catch up with the daemon. |
transfer
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"transfer",
"params":{
"destinations":[
{
"amount":100000000,
"address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBLwtaC5RQgJ8rm"
},
{
"amount":200000000,
"address":"9vH5D7Fv47mbpCpdcthcjU34rqiiAYRCh1tYywmhqnEk9iwCE9yppgNCXAyVHG5qJt2kExa42TuhzQfJbmbpeGLkVbg8xit"
}
],
"mixin":4,
"get_tx_key":true
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"fee":48958481211,
"tx_hash":"985180f468637bc6d2f72ee054e1e34b8d5097988bb29a2e0cb763e4464db23c",
"tx_key":"8d62e5637f1fcc9a8904057d6bed6c697618507b193e956f77c31ce662b2ee07"
}
}
Send monero to a number of recipients.
Inputs
Parameter | Type | Description |
---|---|---|
destinations | array | Array of destinations to receive XMR(see below). |
fee | unsigned int | Ignored, will be automatically calculated. |
mixin | unsigned int | Number of outpouts from the blockchain to mix with (0 means no mixing). |
unlock_time | unsigned int | Number of blocks before the monero can be spent (0 to not add a lock). |
payment_id | string | (Optional) Random 32-byte/64-character hex string to identify a transaction. |
get_tx_key | boolean | (Optional) Return the transaction key after sending. |
do_not_relay | boolean | (Optional) avoid relaying the transaction to the network |
destinations[]
field structure (transaction inputs list)
Parameter | Type | Description |
---|---|---|
amount | unsigned int | Amount to send to each destination, in atomic units. |
address | string | Destination public address. |
Outputs
Parameter | Type | Description |
---|---|---|
fee | unsigned int | Integer value of the fee charged for the txn. |
tx_hash | string | String for the publically searchable transaction hash |
tx_key | string | String for the transaction key if get_tx_key is true, otherwise, blank string. |
transfer_split
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"transfer_split",
"params":{
"destinations":[
{
"amount":100000000,
"address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBwtaC5RQgJ8rm"
},
{
"amount":200000000,
"address":"9vH5D7Fv47mbpCpdcthcjU34rqiiAYRCh1tYywmhqnEk9iwCE9yppgNCXAyVHG5qJt2kExa42TuhzQfJbmbpeGLkVbg8xit"
},
{
"amount":200000000,
"address":"9vC5Q25cR1d3WzKX6dpTaLJaqZyDrtTnfadTmVuB1Wue2tyFGxUhiE4RGa74pEDJv7gSySzcd1Ao6G1nzSaqp78vLfP6MPj"
},
{
"amount":200000000,
"address":"A2MSrn49ziBPJBh8ZNEhhbfyLMou6mao4C1F5TLGUatmUnCxZArDYkcbAnVkVEopWVeak2rKDrmc8JpoS7n5dvfN9YDPBTG"
},
{
"amount":200000000,
"address":"9tEDyVQ8zgRQbDYiykTdpw5kZ6qWQWcKfExEj9eQshjpGb3sdr3UyWE2AHWzUGzJjaH9HN1DdGBdyQQ4AqGMc7rr5xYwZWW"
}
],
"mixin":4,
"get_tx_key":true,
"new_algorithm":true
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"fee_list":[
97916962422
],
"tx_hash_list":[
"c5c389846e701c27aaf1f7ab8b9dc457b471fcea5bc9710e8020d51275afbc54"
]
}
}
Same as transfer, but can split into more than one tx if necessary.
Inputs
Parameter | Type | Description |
---|---|---|
destinations | array | Array of destinations to receive XMR(see below). |
fee | unsigned int | Ignored, will be automatically calculated. |
mixin | unsigned int | Number of outpouts from the blockchain to mix with (0 means no mixing). |
unlock_time | unsigned int | Number of blocks before the monero can be spent (0 to not add a lock). |
payment_id | string | (Optional) Random 32-byte/64-character hex string to identify a transaction. |
get_tx_key | boolean | (Optional) Return the transaction key after sending. |
new_algorithm | boolean | True to use the new transaction construction algorithm, defaults to false. |
do_not_relay | boolean | (Optional) avoid relaying the transaction to the network |
destinations[]
field structure (transaction inputs list)
Parameter | Type | Description |
---|---|---|
amount | unsigned int | Amount to send to each destination, in atomic units. |
address | string | Destination public address. |
Outputs
Parameter | Type | Description |
---|---|---|
fee_list | array of unsigned int | Integer value of the fee charged for the txn. |
tx_hash_list | array of string | String for the publically searchable transaction hash |
sweep_dust
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "sweep_dust"}'
The above command returns JSON structured like this (In this example,
sweep_dust
returns an error due to insufficient funds to sweep):
{
"error":{
"code":-4,
"message":"not enough money"
},
"id":"0",
"jsonrpc":"2.0"
}
Send all dust outputs back to the wallet's, to make them easier to spend (and mix).
Inputs
Parameter | Type | Description |
---|---|---|
do_not_relay | boolean | (Optional) avoid relaying the transaction to the network |
get_tx_keys | boolean | (Optional) Return the transaction keys after sending. |
get_tx_hex | boolean | (Optional) Return the transaction as hex encoded string. |
Outputs
Parameter | Type | Description |
---|---|---|
tx_hash_list | array of string | - |
sweep_all
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"sweep_all",
"params":{
"address":"9sS8eRU2b5ZbN2FPSrpkiab1bjbHE5XtL6Ti6We3Fhw5aQPudRfVVypjgzKDNkxtvTQSPs122NKggb2mqcqkKSeMNVu59S",
"mixin":2,
"unlock_time":0,
"get_tx_keys":true
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"tx_hash_list":[
"53a3648797d5524dd037d4105e067fa61468faecab41927fc43adbb26c202d22"
],
"tx_key_list":[
"e83b3b78235e36cd7e4d9695efd81a3b3e64c7d1f1ebd61892f0a7add6a50301"
]
}
}
Send all unlocked balance to an address.
Inputs
Parameter | Type | Description |
---|---|---|
address | string | - |
priority | unsigned in | (Optional) |
mixin | unsigned int | Number of outpouts from the blockchain to mix with (0 means no mixing) |
unlock_time | unsigned int | Number of blocks before the monero can be spent (0 to not add a lock). |
payment_id | string | (Optional) Random 32-byte/64-character hex string to identify a transaction. |
get_tx_keys | boolean | (Optional) Return the transaction keys after sending. |
below_amount | unsigned int | (Optional) |
do_not_relay | boolean | (Optional) avoid relaying the transaction to the network |
get_tx_hex | boolean | (Optional) return the transactions as hex encoded string |
Outputs
Parameter | Type | Description |
---|---|---|
tx_hash_list | array of string | - |
tx_key_list | array of string | - |
tx_blob_list | array of string | - |
store
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "0", "method": "store"}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
}
}
Save the blockchain.
Inputs
None
Outputs
None
get_payments
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"get_payments",
"params":{
"payment_id":"4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030"
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"payments":[
{
"amount":10350000000000,
"block_height":994327,
"payment_id":"4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
"tx_hash":"c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"unlock_time":0
}
]
}
}
Get a list of incoming payments using a given payment id.
Inputs
Parameter | Type | Description |
---|---|---|
payment_id | string | - |
Outputs
Parameter | Type | Description |
---|---|---|
payments | array | (see below). |
payments[]
field structure
Parameter | Type | Description |
---|---|---|
payment_id | string | - |
tx_hash | string | - |
amount | unsigned int | - |
block_height | unsigned int | - |
unlock_time | unsigned int | - |
get_bulk_payments
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"get_bulk_payments",
"params":{
"payment_ids":[
"4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030"
],
"min_block_height":990000
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"payments":[
{
"amount":10350000000000,
"block_height":994327,
"payment_id":"4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
"tx_hash":"c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
"unlock_time":0
}
]
}
}
Get a list of incoming payments using a given payment id, or a list of payments ids, from a given height. This method is the preferred method over get_payments because it has the same functionality but is more extendable. Either is fine for looking up transactions by a single payment ID.
Inputs
Parameter | Type | Description |
---|---|---|
payment_ids | array of string | - |
min_block_height | unsigned int | The block height at which to start looking for payments. |
Outputs
Parameter | Type | Description |
---|---|---|
payments | array | (see below). |
payments[]
field structure
Parameter | Type | Description |
---|---|---|
payment_id | string | - |
tx_hash | string | - |
amount | unsigned int | - |
block_height | unsigned int | - |
unlock_time | unsigned int | - |
get_transfers
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"get_transfers",
"params":{
"pool":true
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"pool":[
{
"amount":500000000000,
"fee":0,
"height":0,
"note":"",
"payment_id":"758d9b225fda7b7f",
"timestamp":1488312467,
"txid":"da7301d5423efa09fabacb720002e978d114ff2db6a1546f8b820644a1b96208",
"type":"pool"
}
]
}
}
Returns a list of transfers.
Inputs
Parameter | Type | Description |
---|---|---|
in | boolean | - |
out | boolean | - |
pending | boolean | - |
failed | boolean | - |
pool | boolean | - |
filter_by_height | boolean | - |
min_height | unsigned int | - |
max_height | unsigned int | - |
Outputs
Parameter | Type | Description |
---|---|---|
in | array | List of transfers(see below). |
out | array | List of transfers(see below). |
pending | array | List of transfers(see below). |
failed | array | List of transfers(see below). |
pool | array | List of transfers(see below). |
in
/out
/pending
/failed
/pool
fields structure
Parameter | Type | Description |
---|---|---|
txid | string | - |
payment_id | string | - |
height | unsigned int | - |
timestamp | unsigned int | - |
amount | unsigned int | - |
fee | unsigned int | - |
note | string | - |
destinations | array | - |
type | string | - |
incoming_transfers
Example (Return
all
transaction types):
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"incoming_transfers",
"params":{
"transfer_type":"all"
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"transfers":[
{
"amount":10000000000000,
"global_index":711506,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
},
{
"amount":300000000000,
"global_index":794232,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
},
{
"amount":50000000000,
"global_index":213659,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
}
]
}
}
Example (Return
available
transaction types):
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"incoming_transfers",
"params":{
"transfer_type":"available"
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
"transfers":[
{
"amount":10000000000000,
"global_index":711506,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
},
{
"amount":300000000000,
"global_index":794232,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
},
{
"amount":50000000000,
"global_index":213659,
"spent":false,
"tx_hash":"<c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1>",
"tx_size":5870
}
]
}
}
Example (Return
unavailable
transaction. Note that this particular example returns 0 unavailable transactions):
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"incoming_transfers",
"params":{
"transfer_type":"available"
}
}'
The above command returns JSON structured like this:
{
"id":"0",
"jsonrpc":"2.0",
"result":{
}
}
Return a list of incoming transfers to the wallet.
Inputs
Parameter | Type | Description |
---|---|---|
transfer_type | string |
|
Outputs
Parameter | Type | Description |
---|---|---|
transfers | array | (see below). |
transfers[]
fields structure
Parameter | Type | Description |
---|---|---|
amount | unsigned int | - |
spent | boolean | - |
global_index | unsigned int | Mostly internal use, can be ignored by most users. |
tx_hash | string | Several incoming transfers may share the same hash if they were in the same transaction. |
tx_size | unsigned int | - |
query_key
Example (Query view key):
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"query_key",
"params":{
"key_type":"view_key"
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"key": "7e341d..."
}
}
Example (Query mnemonic key):
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"query_key",
"params":{
"key_type":"mnemonic"
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"key": "adapt adapt nostril..."
}
}
Return the spend or view private key.
Inputs
Parameter | Type | Description |
---|---|---|
key_type | string | Which key to retrieve: "mnemonic" - the mnemonic seed (older wallets do not have one) OR "view_key" - the view key. |
Outputs
Parameter | Type | Description |
---|---|---|
key | string | The view key will be hex encoded, while the mnemonic will be a string of words. |
make_integrated_address
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "make_integrated_address",
"params": {
"payment_id": ""
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"integrated_address": "4BpEv3WrufwXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQQ8H2RRJveAtUeiFs6J"
}
}
Make an integrated address from the wallet address and a payment id.
Inputs
Parameter | Type | Description |
---|---|---|
payment_id | string | Hex encoded; can be empty, in which case a random payment id is generated. |
Outputs
Parameter | Type | Description |
---|---|---|
integrated_address | string | - |
split_integrated_address
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "split_integrated_address",
"params": {
"integrated_address": "4BpEv3WrufwXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQQ8H2RRJveAtUeiFs6J"
}
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"payment_id": "<420fa29b2d9a49f5>",
"standard_address": "427ZuEhNJQRXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQGaDsaBA"
}
}
Retrieve the standard address and payment id corresponding to an integrated address.
Inputs
Parameter | Type | Description |
---|---|---|
integrated_address | string | - |
Outputs
Parameter | Type | Description |
---|---|---|
standard_address | string | - |
payment | string | Hex encoded. |
stop_wallet
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "0",
"method": "stop_wallet"
}'
The above command returns JSON structured like this:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
}
}
Stops the wallet, storing the current state.
Inputs
None
Outputs
None
make_uri
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"make_uri",
"params":{
"address":"44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
"amount":10,
"payment_id":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"tx_description":"Testing out the make_uri function.",
"recipient_name":"Monero Project donation address"
}
}'
The above command returns JSON structured like this:
{
"id":0,
"jsonrpc":"2.0",
"result":{
"uri":"monero:44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A?tx_payment_id=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef&tx_amount=0.000000000010&recipient_name=Monero%20Project%20donation%20address&tx_description=Testing%20out%20the%20make_uri%20function."
}
}
Create a payment URI using the official URI spec.
Inputs
Parameter | Type | Description |
---|---|---|
address | string | wallet address string |
amount | - | (Optional) the integer amount to receive, in atomic units |
payment_id | string | (Optional) 16 or 64 character hexadecimal payment id |
recipient_name | string | (Optional) name of the payment recipient |
tx_description | string | (Optional) tx reason description |
Outputs
Parameter | Type | Description |
---|---|---|
uri | string | a string containing all the payment input information as a properly formatted payment URI |
parse_uri
curl -X POST http://127.0.0.1:18082/json_rpc \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0",
"id":"0",
"method":"parse_uri",
"params":{
"uri":"monero:44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A?tx_payment_id=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef&tx_amount=0.000000000010&recipient_name=Monero%20Project%20donation%20address&tx_description=Testing%20out%20the%20make_uri%20function."
}
}'
The above command returns JSON structured like this:
{
"id":0,
"jsonrpc":"2.0",
"result":{
"uri":{
"address":"44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
"amount":10,
"payment_id":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"recipient_name":"Monero Project donation address",
"tx_description":"Testing out the make_uri function."
}
}
}
Parse a payment URI to get payment information.
Inputs
Parameter | Type | Description |
---|---|---|
uri | string | a string containing all the payment input information as a properly formatted payment URI |
Outputs
Parameter | Type | Description |
---|---|---|
uri | object | JSON object containing payment information(see below). |
uri
field structure
Parameter | Type | Description |
---|---|---|
address | string | wallet address string |
amount | - | the integer amount to receive, in atomic units |
payment_id | string | 16 or 64 character hexadecimal payment id |
recipient_name | string | name of the payment recipient |
tx_description | string | tx reason description |