From b44800277277903e11d5382c8406be128a67db46 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Mon, 18 May 2015 15:55:03 +0200 Subject: [PATCH] [Docs] fix and improve REST documentation - fix bad formatting of getutxos - added getztxos example - fix different command syntax --- doc/REST-interface.md | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 11af040ad..0b718d664 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -7,7 +7,7 @@ Supported API ------------- ####Transactions -`GET /rest/tx/TX-HASH.{bin|hex|json}` +`GET /rest/tx/.` 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/.` +`GET /rest/block/notxdetails/.` 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.` -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 -------------