[Docs] fix and improve REST documentation

- fix bad formatting of getutxos
- added getztxos example
- fix different command syntax
This commit is contained in:
Jonas Schnelli 2015-05-18 15:55:03 +02:00
parent 26e08a16a6
commit b448002772
1 changed files with 31 additions and 5 deletions

View File

@ -7,7 +7,7 @@ Supported API
-------------
####Transactions
`GET /rest/tx/TX-HASH.{bin|hex|json}`
`GET /rest/tx/<TX-HASH>.<bin|hex|json>`
Given a transaction hash,
Returns a transaction, in binary, hex-encoded binary or JSON formats.
@ -15,8 +15,8 @@ Returns a transaction, in binary, hex-encoded binary or JSON formats.
For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option.
####Blocks
`GET /rest/block/BLOCK-HASH.{bin|hex|json}`
`GET /rest/block/notxdetails/BLOCK-HASH.{bin|hex|json}`
`GET /rest/block/<BLOCK-HASH>.<bin|hex|json>`
`GET /rest/block/notxdetails/<BLOCK-HASH>.<bin|hex|json>`
Given a block hash,
Returns a block, in binary, hex-encoded binary or JSON formats.
@ -46,12 +46,38 @@ Only supports JSON as output format.
* verificationprogress : (numeric) estimate of verification progress [0..1]
* chainwork : (string) total amount of work in active chain, in hexadecimal
`GET /rest/getutxos`
####Query UTXO set
`GET /rest/getutxos.<bin|hex|json>`
The getutxo command allows querying of the UTXO set given a set of of outpoints.
The getutxo command allows querying of the UTXO set given a set of outpoints.
See BIP64 for input and output serialisation:
https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki
Example:
```
$ curl --data '{"checkmempool":true,"outpoints":[{"txid":"b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75","n":0}]}' localhost:18332/rest/getutxos.json 2>/dev/null | json_pp
{
"chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb",
"chainHeight" : 325347,
"utxos" : [
{
"scriptPubKey" : {
"addresses" : [
"mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD"
],
"type" : "pubkeyhash",
"hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac",
"reqSigs" : 1,
"asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG"
},
"value" : 8.8687,
"height" : 2147483647,
"txvers" : 1
}
],
"bitmap" : "1"
}
```
Risks
-------------