@@ -49,18 +49,20 @@ Note: "atomic units" refer to the smallest fraction of 1 XMR according to the mo
The majority of monerod RPC calls use the daemon's `json_rpc` interface to request various bits of information. These methods all follow a similar structure, for example:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getlastblockheader"}' -H 'Content-Type:application/json'
{
"id":"0",
"jsonrpc":"2.0",
...
...
@@ -200,9 +210,10 @@ In this example, the most recent block (990793 at the time) is returned:
"status":"OK"
}
}
```
### getblockheaderbyhash
### **getblockheaderbyhash**
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.
...
...
@@ -216,8 +227,9 @@ Outputs:
In this example, block 912345 is looked up by its hash:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getblockheaderbyheight","params":{"height":912345}}' -H 'Content-Type:application/json'
{
"id":"0",
"jsonrpc":"2.0",
...
...
@@ -276,9 +290,10 @@ In this example, block 912345 is looked up by its height (notice that the return
"status":"OK"
}
}
```
### getblock
### **getblock**
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.
...
...
@@ -316,8 +331,9 @@ Outputs:
In the following example, block 912345 is looked up by its height. Note that block 912345 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 -d '{"jsonrpc":"2.0","id":"0","method":"getbans"}' -H 'Content-Type:application/json'
{
"id":"0",
"jsonrpc":"2.0",
...
...
@@ -573,6 +601,7 @@ Example:
"status":"OK"
}
}
```
---
...
...
@@ -595,7 +624,7 @@ The data structure for these calls is different than the JSON RPC calls. Whereas
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 [getlastblockheader](#getlastblockheader), rather than [getheight](#getheight) below.
### /getheight
### **/getheight**
Get the node's current height.
...
...
@@ -605,15 +634,17 @@ Outputs:
**height* - unsigned int; Current length of longest chain known to daemon.
$ curl -X POST http://127.0.0.1:18081/gettransactions -d '{"txs_hashes":["d6e48158472848e6687173a91ae6eebfa3e1d778e65252ee99d7515d63090408"]}' -H 'Content-Type: application/json'
{
"status": "OK",
"txs_as_hex": ["..."]
}
```
Example 2: Decode returned transaction information in JSON format. Note: the "vout" list has been truncated in the displayed return for space considerations.
$ curl -X POST http://127.0.0.1:18081/sendrawtransaction -d '{"tx_as_hex":"de6a3..."}' -H 'Content-Type: application/json'
```
### /get_transaction_pool
### **/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 in the node's memory.
...
...
@@ -740,8 +780,9 @@ Outputs:
Example (Note: Some lists in the returned information have been truncated for display reasons):