daemon-rpc.md 81.1 KB
Newer Older
1001
{
1002
1003
1004
1005
1006
1007
1008
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "fee": 187610000,
    "status": "OK",
    "untrusted": false
  }
1009
1010
1011
1012
}
```


1013
### **get_alternate_chains**
1014

1015
Display alternative chains seen by the node.
1016

1017
Alias: *None*.
1018

1019
Inputs: *None*.
1020
1021
1022

Outputs:

1023
1024
1025
1026
1027
1028
* *chains* - array of chains, the following structure:
  * *block_hash* - string; the block hash of the first diverging block of this alternative chain.
  * *difficulty* - unsigned int; the cumulative difficulty of all blocks in the alternative chain.
  * *height* - unsigned int; the block height of the first diverging block of this alternative chain.
  * *length* - unsigned int; the length in blocks of this alternative chain, after divergence.
* *status* - string; General RPC error code. "OK" means everything looks good.
1029

1030
Example:
1031
1032

```
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_alternate_chains"}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "chains": [{
      "block_hash": "697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625",
      "difficulty": 14114729638300280,
      "height": 1562062,
      "length": 2
    }],
    "status": "OK"
  }
}
1048
1049
1050
```


1051
### **relay_tx**
1052

1053
Relay a list of transaction IDs.
1054

1055
1056
1057
1058
1059
Alias: *None*.

Inputs:

* *txids* - array of string; list of transaction IDs to relay
1060
1061
1062
1063
1064

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good.

1065
Example:
1066
1067

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

{
1071
1072
1073
1074
1075
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "status": "OK"
  }
1076
1077
1078
1079
}
```


1080
### **sync_info**
1081

1082
1083
1084
Get synchronisation informations

Alias: *None*.
1085
1086
1087
1088
1089

Inputs: *None*.

Outputs:

1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
* *height* - unsigned int;
* *peers* - array of peer structure, defined as follows:
  * *info* - structure of connection info, as defined in [get_connections](#get_connections)
* *spans* - array of span structure, defined as follows (optional, absent if node is fully synced):
  * *connection_id* - string; Id of connection
  * *nblocks* - unsigned int; number of blocks in that span
  * *rate* - unsigned int; connection rate
  * *remote_address* - string; peer address the node is downloading (or has downloaded) than span from
  * *size* - unsigned int; total number of bytes in that span's blocks (including txes)
  * *speed* - unsigned int; connection speed
  * *start_block_height* - unsigned int; block height of the first block in that span
1101
* *status* - string; General RPC error code. "OK" means everything looks good.
1102
* *target_height* - unsigned int; target height the node is syncing from (optional, absent if node is fully synced)
1103
1104
1105
1106

Example:

```
1107
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sync_info"}' -H 'Content-Type: application/json'
1108
1109

{
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "height": 1563543,
    "peers": [{
      "info": {
        "address": "70.109.53.128:60064",
        "avg_download": 0,
        "avg_upload": 5,
        "connection_id": "204067223b9b3415c265dd25ad29ee48",
        "current_download": 0,
        "current_upload": 1,
        "height": 1559975,
        "host": "70.109.53.128",
        "incoming": true,
        "ip": "70.109.53.128",
        "live_time": 38,
        "local_ip": false,
        "localhost": false,
        "peer_id": "96b8545dbc7a8866",
        "port": "60064",
        "recv_count": 1580,
        "recv_idle_time": 28,
        "send_count": 203603,
        "send_idle_time": 8,
        "state": "state_normal",
        "support_flags": 1
      }
    },{
      "info": {
        ...
      }
    },{
      ...
    },{
      ...
    },{
      ...
    }],
    "status": "OK",
    "target_height": 1564067
  }
1152
}
1153
```
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965


### **get_txpool_backlog**

Get all transaction pool backlog

Alias: *None*.

Inputs: *None*.

Outputs:

* *backlog*: array of structures *tx_backlog_entry* (in binary form):
  * *blob_size* - unsigned int (in binary form)
  * *fee* - unsigned int (in binary form)
  * *time_in_pool* - unsigned int (in binary form)
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

Example:

```
$ 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'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "backlog": "...Binary...",
    "status": "OK",
    "untrusted": false
  }
}
```


### **get_output_distribution**



Alias: *None*.

Inputs:

* *amounts* - array of unsigned int; amounts to look for
* *cumulative* - boolean; (optional, default is `false`) States if the result should be cumulative (`true`) or not (`false`)
* *from_height* - unsigned int; (optional, default is 0) starting height to check from
* *to_height* - unsigned int; (optional, default is 0) ending height to check up to

Outputs:

* *distributions* - array of structure distribution as follows:
  * *amount* - unsigned int
  * *base* - unsigned int
  * *distribution* - array of unsigned int
  * *start_height* - unsigned int
* *status* - string; General RPC error code. "OK" means everything looks good.

Example:

```
$ 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'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "distributions": [{
      "amount": 2628780000,
      "base": 0,
      "distribution": "",
      "start_height": 1462078
    }],
    "status": "OK"
  }
}
```


---

## 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:

    IP=127.0.0.1
    PORT=18081
    METHOD='gettransactions'
	PARAMS='{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}'
	curl \
		-X POST http://$IP:$PORT/$METHOD \
		-d $PARAMS \
		-H 'Content-Type: application/json'

Note: It is recommended to use JSON RPC where such alternatives exist, rather than the following methods. For example, the recommended way to get a node's height is via the JSON RPC methods [get_info](#getinfo) or [get_last_block_header](#get_last_block_header), rather than [getheight](#getheight) below.

For calls that end with **.bin**, the data is exchanged in the form of binary, serialized objects, as defined in the [Core RPC Server](https://github.com/monero-project/monero/blob/master/src/rpc/core_rpc_server_commands_defs.h).


### **/get_height**

Get the node's current height.

Alias: */getheight*.

Inputs: *None*.

Outputs:

* *height* - unsigned int; Current length of longest chain known to daemon.
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

```
$ curl -X POST http://127.0.0.1:18081/get_height -H 'Content-Type: application/json'

{
  "height": 1564055,
  "status": "OK",
  "untrusted": false
}
```



### **/get_blocks.bin**

Get all blocks info. Binary request.

Alias: */getblocks.bin*.

Inputs:

* *block_ids* - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
* *start_height* - unsigned int
* *prune* - boolean

Outputs:

* *blocks* - array of block complete entries
* *current_height* - unsigned int
* *output_indices* - structure as follows:
  * *indices* - array of tx output indices, structure as follows:
    * *indices* - array of unsigned int
* *start_height* - unsigned int
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

<!-- Cannot get this working
Example:

```
$ curl -X POST http://127.0.0.1:18081/get_blocks.bin -d '{"block_ids":["d109a406528a7b44fef8bc03e75eaabb0f919f852884b43b550b8b3be80a49e7"],"start_height":1562062}' -H 'Content-Type: application/json'

```
--->

### **/get_blocks_by_height.bin**

Get blocks by height. Binary request.

Alias: */getblocks_by_height.bin*.

Inputs:

* *heights* - array of unsigned int; list of block heights

Outputs:

* *blocks* - array of block complete entries
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

<!-- Cannot get this working
Example:

```
$ echo -e '\x7B\x22\x68\x65\x69\x67\x68\x74\x73\x22\x3A\x5B\x31\x35\x36\x34\x32\x34\x36\x5D\x7D\x' | curl -X POST --data-binary @- http://127.0.0.1:18081/get_blocks_by_height.bin
$ echo -e '1564246' | curl -X POST --data-binary @- http://127.0.0.1:18081/get_blocks_by_height.bin
curl -X POST http://127.0.0.1:18081/get_blocks_by_height.bin --data-binary '{"heights":[1564246]}'

```
--->


### **/get_hashes.bin**

Get hashes. Binary request.

Alias: */gethashes.bin*.

Inputs:

* *block_ids* - binary array of hashes; first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block
* *start_height* - unsigned int

Outputs:

* *current_height* - unsigned int
* *m_block_ids* - binary array of hashes; see *block_ids* above.
* *start_height* - unsigned int
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

<!-- Cannot get this working
Example:

```
$ curl -X POST http://127.0.0.1:18081/get_hashes.bin -d '{"block_ids":["d109a406528a7b44fef8bc03e75eaabb0f919f852884b43b550b8b3be80a49e7"],"start_height":1562062}' -H 'Content-Type: application/json'

```
--->


### **/get_o_indexes.bin**

Get global outputs of transactions. Binary request.

Alias: *None*.

Inputs:

* *txid* - binary txid

Outputs:

* *o_indexes* - array of unsigned int; List of output indexes
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

<!-- Cannot get this working
Example:

```
$ curl -X POST http://127.0.0.1:18081/get_o_indexes.bin --data-binary '{"txid":"d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"}'

```
--->


### **/get_outs.bin**

Get outputs. Binary request.

Alias: *None*.

Inputs:

* *outputs* - array of structure *get_outputs_out* as follows:
  * *amount* - unsigned int;
  * *index* - unsigned int;

Outputs:

* *outs* - array of structure *outkey* as follows:
  * *amount* - unsigned int;
  * *height* - unsigned int; block height of the output
  * *key* - the public key of the output
  * *mask*
  * *txid* - transaction id
  * *unlocked* - boolean; States if output is locked (`false`) or not (`true`)
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

<!-- Cannot get this working
Example:

```
$ curl -X POST http://127.0.0.1:18081/get_o_indexes.bin --data-binary '{"txid":"d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"}'

```
--->


### **/get_transactions**

Look up one or more transactions by hash.

Alias: */gettransactions*.

Inputs:

* *txs_hashes* - string list; List of transaction hashes to look up.
* *decode_as_json* - boolean; Optional (`false` by default). If set `true`, the returned transaction information will be decoded rather than binary.
* *prune* - boolean; Optional (`false` by default).

Outputs:

* *missed_tx* - array of strings. (Optional - returned if not empty) Transaction hashes that could not be found.
* *status* - General RPC error code. "OK" means everything looks good.
* *txs* - array of structure *entry* as follows:
  * *as_hex* - string; Full transaction information as a hex string.
  * *as_json* - json string; List of transaction info:
    * *version* - Transaction version
    * *unlock_time* - If not 0, this tells when a transaction output is spendable.
    * *vin* - List of inputs into transaction:
      * *key* - The public key of the previous output spent in this transaction.
        * *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
    * *vout* - List of outputs from transaction:
      * *amount* - Amount of transaction output, in @atomic-units.
      * *target* - Output destination information:
        * *key* - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
    * *extra* - Usually called the "payment ID" but can be used to include any random 32 bytes.
    * *signatures* - List of signatures used in ring signature to hide the true origin of the transaction.
  * *block_height* - unsigned int; block height including the transaction
  * *block_timestamp* - unsigned int; Unix time at chich the block has been added to the blockchain
  * *double_spend_seen* - boolean; States if the transaction is a double-spend (`true`) or not (`false`)
  * *in_pool* - boolean; States if the transaction is in pool (`true`) or included in a block (`false`)
  * *output_indices* - array of unsigned int; transaction indexes
  * *tx_hash* - string; transaction hash
* *txs_as_hex* - string; Full transaction information as a hex string (old compatibility parameter)
* *txs_as_json* - json string; (Optional - returned if set in inputs. Old compatibility parameter) List of transaction as in *as_json* above:

Example 1: Return transaction information in binary format.

```
$ curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' -H 'Content-Type: application/json'

{
  "status": "OK",
  "txs": [{
    "as_hex": "...",
    "as_json": "",
    "block_height": 993442,
    "block_timestamp": 1457749396,
    "double_spend_seen": false,
    "in_pool": false,
    "output_indices": [198769,418598,176616,50345,509],
    "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"
  }],
  "txs_as_hex": ["..."],
  "untrusted": false
}
```

Example 2: Decode returned transaction information in JSON format. Note: the "vin", "vout" and "signatures" list have been truncated in the displayed return for space considerations.

```
$ curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"],"decode_as_json":true}' -H 'Content-Type: application/json'

{
  "status": "OK",
  "txs": [{
    "as_hex": "...",
    "as_json": "{\n  \"version\": 1, \n  \"unlock_time\": 0, \n  \"vin\": [ {\n      \"key\": {\n        \"amount\": 9999999999, \n        \"key_offsets\": [ 691\n        ], \n        \"k_image\": \"6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012\"\n      }\n    }, {\n      \"key\": {\n        \"amount\": 9000000000000, \n        \"key_offsets\": [ 175760\n        ], \n        \"k_image\": \"200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069\"\n      }\n    }, ... \n  ], \n  \"vout\": [ {\n      \"amount\": 60000000000, \n      \"target\": {\n        \"key\": \"8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d\"\n      }\n    }, {\n      \"amount\": 700000000000, \n      \"target\": {\n        \"key\": \"1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71\"\n      }\n    }, ... \n  ], \n  \"extra\": [ 1, 3, 140, 109, 156, 205, 47, 148, 153, 9, 17, 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140, 242, 124, 143, 219, 172\n  ], \n  \"signatures\": [ \"fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e\", \"8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08\", ... ]\n}",
    "block_height": 993442,
    "block_timestamp": 1457749396,
    "double_spend_seen": false,
    "in_pool": false,
    "output_indices": [198769,418598,176616,50345,509],
    "tx_hash": "d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"
  }],
  "txs_as_hex": ["..."],
  "txs_as_json": ["{\n  \"version\": 1, \n  \"unlock_time\": 0, \n  \"vin\": [ {\n      \"key\": {\n        \"amount\": 9999999999, \n        \"key_offsets\": [ 691\n        ], \n        \"k_image\": \"6ebee1b651a8da723462b4891d471b990ddc226049a0866d3029b8e2f75b7012\"\n      }\n    }, {\n      \"key\": {\n        \"amount\": 9000000000000, \n        \"key_offsets\": [ 175760\n        ], \n        \"k_image\": \"200bd02b70ee707441a8863c5279b4e4d9f376dc97a140b1e5bc7d72bc508069\"\n      }\n    }, ... \n  ], \n  \"vout\": [ {\n      \"amount\": 60000000000, \n      \"target\": {\n        \"key\": \"8c792dea94dab48160e067fb681edd6247ba375281fbcfedc03cb970f3b98e2d\"\n      }\n    }, {\n      \"amount\": 700000000000, \n      \"target\": {\n        \"key\": \"1ab33e69737e157d23e33274c42793be06a8711670e73fa10ecebc604f87cc71\"\n      }\n    }, ... \n  ], \n  \"extra\": [ 1, 3, 140, 109, 156, 205, 47, 148, 153, 9, 17, 93, 83, 33, 162, 110, 152, 1, 139, 70, 121, 19, 138, 10, 44, 6, 55, 140, 242, 124, 143, 219, 172\n  ], \n  \"signatures\": [ \"fd82214a59c99d9251fa00126d353f9cf502a80d8993a6c223e3c802a40ab405555637f495903d3ba558312881e586d452e6e95826d8e128345f6c0a8f9f350e\", \"8c04ef50cf34afa3a9ec19c457143496f8cf7045ed869b581f9efa2f1d65e30f1cec5272b00e9c61a34bdd3c78cf82ae8ef4df3132f70861391069b9c255cd08\", ... ]\n}"],
  "untrusted": false
}
```

Example 3: Returned a missed (unexisting) transaction.

```
curl -X POST http://127.0.0.1:18081/get_transactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409"]}' -H 'Content-Type: application/json'

{
  "missed_tx": ["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090409"],
  "status": "OK",
  "untrusted": false
}
```


### **/get_alt_blocks_hashes**

Get the known blocks hashes which are not on the main chain.

Alias: *None*.

Inputs: *None*

Outputs:

* *blks_hashes* - array of strings; list of alternative blocks hashes to main chain
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

Example:

```
$ curl -X POST http://127.0.0.1:18081/get_alt_blocks_hashes -H 'Content-Type: application/json'

{
  "blks_hashes": ["9c2277c5470234be8b32382cdf8094a103aba4fcd5e875a6fc159dc2ec00e011","637c0e0f0558e284493f38a5fcca3615db59458d90d3a5eff0a18ff59b83f46f","6f3adc174a2e8082819ebb965c96a095e3e8b63929ad9be2d705ad9c086a6b1c","697cf03c89a9b118f7bdf11b1b3a6a028d7b3617d2d0ed91322c5709acf75625","d99b3cf3ac6f17157ac7526782a3c3b9537f89d07e069f9ce7821d74bd9cad0e","e97b62109a6303233dcd697fa8545c9fcbc0bf8ed2268fede57ddfc36d8c939c","70ff822066a53ad64b04885c89bbe5ce3e537cdc1f7fa0dc55317986f01d1788","b0d36b209bd0d4442b55ea2f66b5c633f522401f921f5a85ea6f113fd2988866"],
  "status": "OK",
  "untrusted": false
}
```


### **/is_key_image_spent**

Check if outputs have been spent using the key image associated with the output.

Alias: *None*.

Inputs:

* *key_images* - string list; List of key image hex strings to check.

Outputs:

* *spent_status* - unsigned int list; List of statuses for each image checked. Statuses are follows: 0 = unspent, 1 = spent in blockchain, 2 = spent in transaction pool
* *status* - string; General RPC error code. "OK" means everything looks good.
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).

Example:

```
$ curl -X POST http://127.0.0.1:18081/is_key_image_spent -d '{"key_images":["8d1bd8181bf7d857bdb281e0153d84cd55a3fcaa57c3e570f4a49f935850b5e3","7319134bfc50668251f5b899c66b005805ee255c136f0e1cecbb0f3a912e09d4"]}' -H 'Content-Type: application/json'

{
  "spent_status": [1,2],
  "status": "OK"
  "untrusted": false
}
```


### **/send_raw_transaction**

Broadcast a raw transaction to the network.

Alias: */sendrawtransaction*.

Inputs:

* *tx_as_hex* - string; Full transaction information as hexidecimal string.
* *do_not_relay* - boolean; Stop relaying transaction to other nodes (default is `false`).

Outputs:

* *double_spend* - boolean;  Transaction is a double spend (`true`) or not (`false`).
* *fee_too_low* - boolean; Fee is too low (`true`) or OK (`false`).
* *invalid_input* - boolean; Input is invalid (`true`) or valid (`false`).
* *invalid_output* - boolean; Output is invalid (`true`) or valid (`false`).
* *low_mixin* - boolean; Mixin count is too low (`true`) or OK (`false`).
* *not_rct* - boolean; Transaction is a standard ring transaction (`true`) or a ring confidential transaction (`false`).
* *not_relayed* - boolean; Transaction was not relayed (`true`) or relayed (`false`).
* *overspend* - boolean; Transaction uses more money than available (`true`) or not (`false`).
* *reason* - string; Additional information. Currently empty or "Not relayed" if transaction was accepted but not relayed.
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
* *too_big* - boolean; Transaction size is too big (`true`) or OK (`false`).
* *untrusted* - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).


Example (No return information included here.):


```
$ curl -X POST http://127.0.0.1:18081/send_raw_transaction -d '{"tx_as_hex":"de6a3...", "do_not_relay":false}' -H 'Content-Type: application/json'
```


### **/start_mining**

Start mining on the daemon.

Alias: *None*.

Inputs:

* *do_background_mining* - boolean; States if the mining should run in background (`true`) or foreground (`false`).
* *ignore_battery* - boolean; States if batery state (on laptop) should be ignored (`true`) or not (`false`).
* *miner_address* - string; Account address to mine to.
* *threads_count* - unsigned int; Number of mining thread to run.

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

```
$ curl -X POST http://127.0.0.1:18081/start_mining -d '{"do_background_mining":false,"ignore_battery":true,"miner_address":"47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc","threads_count":1}' -H 'Content-Type: application/json'

{
  "status": "OK"
}
```


### **/stop_mining**

Stop mining on the daemon.

Alias: *None*.

Inputs: *None*.

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

```
$ curl -X POST http://127.0.0.1:18081/stop_mining -H 'Content-Type: application/json'

{
  "status": "OK"
}
```


### **/mining_status**

Get the mining status of the daemon.

Alias: *None*.

Inputs: *None*.

Outputs:

* *active* - boolean; States if mining is enabled (`true`) or disabled (`false`).
* *address* - string; Account address daemon is mining to. Empty if not mining.
* *is_background_mining_enabled* - boolean; States if the mining is running in background (`true`) or foreground (`false`).
* *speed* - unsigned int; Mining power in hashes per seconds.
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
* *threads_count* - unsigned int; Number of running mining threads.

Example while mining:

```
$ curl -X POST http://127.0.0.1:18081/mining_status -H 'Content-Type: application/json'

{
  "active": true,
  "address": "47xu3gQpF569au9C2ajo5SSMrWji6xnoE5vhr94EzFRaKAGw6hEGFXYAwVADKuRpzsjiU1PtmaVgcjUJF89ghGPhUXkndHc",
  "is_background_mining_enabled": false,
  "speed": 20,
  "status": "OK",
  "threads_count": 1
}
```

Example while not mining:

```
$ curl -X POST http://127.0.0.1:18081/mining_status -H 'Content-Type: application/json'

{
  "active": false,
  "address": "",
  "is_background_mining_enabled": false,
  "speed": 0,
  "status": "OK",
  "threads_count": 0
}
```


### **/save_bc**

Save the blockchain. The blockchain does not need saving and is always saved when modified, however it does a sync to flush the filesystem cache onto the disk for safety purposes against Operating System or Harware crashes.

Alias: *None*.

Inputs: *None*.

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

```
$ curl -X POST http://127.0.0.1:18081/save_bc -H 'Content-Type: application/json'

{
  "status": "OK"
}
```


### **/get_peer_list**

Get the known peers list.

Alias: *None*.

Inputs: *None*.

Outputs:

* *gray_list* - array of offline *peer* structure as follows:
  * *host* - unsigned int; IP address in integer format
  * *id* - string; Peer id
  * *ip* - unsigned int; IP address in integer format
  * *last_seen* - unsigned int; unix time at which the peer has been seen for the last time
  * *port* - unsigned int; TCP port the peer is using to connect to monero network.
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.
* *white_list* - array of online *peer* structure, as above.

Example (truncated lists):

```
$ curl -X POST http://127.0.0.1:18081/get_peer_list -H 'Content-Type: application/json'

{
  "gray_list": [{
    "host": "640304833",
    "id": 5345237316225602120,
    "ip": 640304833,
    "last_seen": 1525540510,
    "port": 18080
  },{
    "host": "2183731038",
    "id": 14955030573998424430,
    "ip": 2183731038,
    "last_seen": 1525540499,
    "port": 28080
  }, ...
  ],
  "status": "OK",
  "white_list": [{
    "host": "1221637955",
    "id": 10354694710033118926,
    "ip": 1221637955,
    "last_seen": 1525540511,
    "port": 18080
  },{
    "host": "1780407354",
    "id": 17193661050352240890,
    "ip": 1780407354,
    "last_seen": 1525540510,
    "port": 18080
  }, ...
  ]
}
```


### **/set_log_hash_rate**

Set the log hash rate display mode.

Alias: *None*.

Inputs:

* *visible* - boolean; States if hash rate logs should be visible (`true`) or hidden (`false`)

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example while mining:

```
$ curl -X POST http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json'

{
  "status": "OK"
}
```

Error while not mining:

```
$ curl -X POST http://127.0.0.1:18081/set_log_hash_rate -d '{"visible":true}' -H 'Content-Type: application/json'

{
  "status": "NOT MINING"
}
```


### **/set_log_level**

Set the daemon log level.
By default, log level is set to `0`.

Alias: *None*.

Inputs:

* *level* - integer; daemon log level to set from `0` (less verbose) to `4` (most verbose)

Outputs:

* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example:

```
$ curl -X POST http://127.0.0.1:18081/set_log_level -d '{"level":1}' -H 'Content-Type: application/json'

{
  "status": "OK"
}
```


### **/set_log_categories**

Set the daemon log categories.
Categories are represented as a comma separated list of `<Category>:<level>` (similarly to syslog standard `<Facility>:<Severity-level>`), where:
* *Category*  is one of the following:
  * *\** - All facilities
  * *default*
  * *net*
  * *net.http*
  * *net.p2p*
  * *logging*
  * *net.throttle*
  * *blockchain.db*
  * *blockchain.db.lmdb*
  * *bcutil*
  * *checkpoints*
  * *net.dns*
  * *net.dl*
  * *i18n*
  * *perf*
  * *stacktrace*
  * *updates*
  * *account*
  * *cn*
  * *difficulty*
  * *hardfork*
  * *miner*
  * *blockchain*
  * *txpool*
  * *cn.block_queue*
  * *net.cn*
  * *daemon*
  * *debugtools.deserialize*
  * *debugtools.objectsizes*
  * *device.ledger*
  * *wallet.gen_multisig*
  * *multisig*
  * *bulletproofs*
  * *ringct*
  * *daemon.rpc*
  * *wallet.simplewallet*
  * *WalletAPI*
  * *wallet.ringdb*
  * *wallet.wallet2*
  * *wallet.rpc*
  * *tests.core*
* *Level* is one of the following:
  * *FATAL* - higher level
  * *ERROR*
  * *WARNING*
  * *INFO*
  * *DEBUG*
  * *TRACE* - lower level
A level automatically includes higher level.
By default, categories are set to `*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO`.
Setting the categories to "" prevent any logs to be outputed.

Alias: *None*.

Inputs:

* *categories* - string; Optional, daemon log categories to enable

Outputs:

* *categories* - string; daemon log enabled categories
* *status* - string; General RPC error code. "OK" means everything looks good. Any other value means that something went wrong.

Example to set all facilities to Security Level `Info`:

```
$ curl -X POST http://127.0.0.1:18081/set_log_categories -d '{"categories": "*:INFO"}' -H 'Content-Type: application/json'

{
  "categories": "*:INFO",
  "status": "OK"
}
```

Example without input to set the default categories:

```
$ curl -X POST http://127.0.0.1:18081/set_log_categories -H 'Content-Type: application/json'

{
  "categories": "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO",
  "status": "OK"
}
```


### **/get_transaction_pool**

Show information about valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the txpool in the node's memory.

Alias: *None*.

Inputs: *None*.

Outputs:

* *spent_key_images* - List of spent output key images:
  * *id_hash* - string; Key image.
  * *txs_hashes* - string list; tx hashes of the txes (usually one) spending that key image.
* *status* - string; General RPC error code. "OK" means everything looks good.
el00ruobuob's avatar
el00ruobuob committed
1966
* *transactions* - List of transactions in the mempool are not in a block on the main chain at the moment:
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
  * *blob_size* - unsigned int; The size of the full transaction blob.
  * *double_spend_seen* - boolean; States if this transaction has been seen as double spend.
  * *do_not_relay*; boolean; States if this transaction should not be relayed
  * *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; States if the tx was included in a block at least once (`true`) or not (`false`).
  * *last_failed_height* - unsigned int; If the transaction validation has previously failed, this tells at what height that occured.
  * *last_failed_id_hash* - string; Like the previous, this tells the previous transaction ID hash.
  * *last_relayed_time* - unsigned int; Last unix time at which the transaction has been relayed.
  * *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.
  * *relayed* - boolean; States if this transaction has been relayed
  * *tx_blob* - unsigned int; Hexadecimal blob represnting the transaction.
  * *tx_json* - json string; JSON structure of all information in the transaction:
    * *version* - Transaction version
    * *unlock_time* - If not 0, this tells when a transaction output is spendable.
    * *vin* - List of inputs into transaction:
      * *key* - The public key of the previous output spent in this transaction.
        * *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
    * *vout* - List of outputs from transaction:
      * *amount* - Amount of transaction output, in @atomic-units.
      * *target* - Output destination information:
        * *key* - The stealth public key of the receiver. Whoever owns the private key associated with this key controls this transaction output.
    * *extra* - Usually called the "transaction ID" but can be used to include any random 32 bytes.
    * *rct_signatures* - Ring signatures:
      * *type*
      * *txnFee*
      * *ecdhInfo* - array of Diffie Helman Elipctic curves structures as follows:
        * *mask* - String
        * *amount* - String
      * *outPk*
For faster browsing, not all history is shown. View entire blame