From 8a93b97ce95fc7faae260a4382a074a6b71a2ffc Mon Sep 17 00:00:00 2001 From: Michael Rotarius Date: Wed, 14 Dec 2016 02:53:45 +0100 Subject: [PATCH] REST 0.11, 0.12, 0.13 update references.md, developer-reference.md, _autocrossref.yaml and _config.yml not yet updated --- _includes/devdoc/bitcoin-core/rest/intro.md | 4 +- .../bitcoin-core/rest/quick-reference.md | 11 +- .../rest/requests/get_block-notxdetails.md | 76 ++++-- .../bitcoin-core/rest/requests/get_block.md | 131 +++++---- .../rest/requests/get_chaininfo.md | 250 ++++++++++++++++++ .../rest/requests/get_getutxos.md | 189 +++++++++++++ .../bitcoin-core/rest/requests/get_headers.md | 207 +++++++++++++++ .../rest/requests/get_mempool-contents.md | 169 ++++++++++++ .../rest/requests/get_mempool-info.md | 85 ++++++ .../bitcoin-core/rest/requests/get_tx.md | 131 +++++---- _includes/helpers/summaries.md | 10 +- _includes/references.md | 5 + en/developer-reference.md | 10 + 13 files changed, 1125 insertions(+), 153 deletions(-) create mode 100644 _includes/devdoc/bitcoin-core/rest/requests/get_chaininfo.md create mode 100644 _includes/devdoc/bitcoin-core/rest/requests/get_getutxos.md create mode 100644 _includes/devdoc/bitcoin-core/rest/requests/get_headers.md create mode 100644 _includes/devdoc/bitcoin-core/rest/requests/get_mempool-contents.md create mode 100644 _includes/devdoc/bitcoin-core/rest/requests/get_mempool-info.md diff --git a/_includes/devdoc/bitcoin-core/rest/intro.md b/_includes/devdoc/bitcoin-core/rest/intro.md index d5531377..9844f6e9 100644 --- a/_includes/devdoc/bitcoin-core/rest/intro.md +++ b/_includes/devdoc/bitcoin-core/rest/intro.md @@ -14,7 +14,9 @@ an **unauthenticated** HTTP REST interface. The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet and port 18332 for testnet. It must be enabled by either starting Bitcoin Core with the `-rest` option or by specifying `rest=1` in the -configuration file. +configuration file. Make sure that the RPC interface is also activated. +Set `server=1` in `bitcoin.conf` or supply the `-server` argument when +starting the program. The interface is not intended for public access and is only accessible from localhost by default. diff --git a/_includes/devdoc/bitcoin-core/rest/quick-reference.md b/_includes/devdoc/bitcoin-core/rest/quick-reference.md index bf1e6c85..07ea0f91 100644 --- a/_includes/devdoc/bitcoin-core/rest/quick-reference.md +++ b/_includes/devdoc/bitcoin-core/rest/quick-reference.md @@ -9,8 +9,13 @@ http://opensource.org/licenses/MIT. {% autocrossref %} -* [GET Block][rest get block] {{summary_restGetBlock}} {{NEW0_10_0}} -* [GET Block/NoTxDetails][rest get block-notxdetails] {{summary_restGetBlock-noTxDetails}} {{NEW0_10_0}} -* [GET Tx][rest get tx] {{summary_restGetTx}} {{NEW0_10_0}} +* [GET Block][rest get block] {{summary_restGetBlock}} {{NEW0_10_0}}, {{UPDATED0_13_0}} +* [GET Block/NoTxDetails][rest get block-notxdetails] {{summary_restGetBlock-noTxDetails}} {{NEW0_10_0}}, {{UPDATED0_13_0}} +* [GET ChainInfo][rest get chaininfo] {{summary_restGetChainInfo}} {{NEW0_11_0}}, {{UPDATED0_12_0}} +* [GET GetUtxos][rest get getutxos] {{summary_restGetGetUtxos}} {{NEW0_11_0}} +* [GET Headers][rest get headers] {{summary_restGetHeaders}} {{NEW0_11_0}}, {{UPDATED0_13_0}} +* [GET MemPool/Contents][rest get mempool-contents] {{summary_restGetMemPool-contents}} {{NEW0_12_0}} +* [GET MemPool/Info][rest get mempool-info] {{summary_restGetMemPool-info}} {{NEW0_12_0}} +* [GET Tx][rest get tx] {{summary_restGetTx}} {{NEW0_10_0}}, {{UPDATED0_13_0}} {% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_block-notxdetails.md b/_includes/devdoc/bitcoin-core/rest/requests/get_block-notxdetails.md index 4e6fdec9..2c2d1a20 100644 --- a/_includes/devdoc/bitcoin-core/rest/requests/get_block-notxdetails.md +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_block-notxdetails.md @@ -57,6 +57,11 @@ GET /block/notxdetails/. p: "Required
(exactly 1)" d: "The number of confirmations the transactions in this block have, starting at 1 when this block is at the tip of the best block chain. This score will be -1 if the the block is not part of the best block chain" +- n: "→
`strippedsize`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The size of this block in serialized block format excluding witness data, counted in bytes" + - n: "→
`size`" t: "number (int)" p: "Required
(exactly 1)" @@ -66,11 +71,21 @@ GET /block/notxdetails/. t: "number (int)" p: "Required
(exactly 1)" d: "The height of this block on its block chain" + +- n: "→
`weight`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The block weight as defined in BIP 141" - n: "→
`version`" t: "number (int)" p: "Required
(exactly 1)" d: "This block's version number. See [block version numbers][section block versions]" + +- n: "→
`versionHex`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

This block's version number formatted in hexadecimal" - n: "→
`merkleroot`" t: "string (hex)" @@ -92,6 +107,11 @@ GET /block/notxdetails/. p: "Required
(exactly 1)" d: "The value of the *time* field in the block header, indicating approximately when the block was created" +- n: "→
`mediantime`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113" + - n: "→
`nonce`" t: "number (int)" p: "Required
(exactly 1)" @@ -129,46 +149,52 @@ GET /block/notxdetails/. Request a block in hex-encoded serialized block format: {% highlight bash %} -curl http://localhost:18332/rest/block/notxdetails/000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39.hex +curl http://localhost:8332/rest/block/notxdetails/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048.hex {% endhighlight %} Result (wrapped): -{% highlight text %} -02000000df11c014a8d798395b5059c722ebdf3171a4217ead71bf6e0e99f4c7\ -000000004a6f6a2db225c81e77773f6f0457bcb05865a94900ed11356d0b7522\ -8efb38c7785d6053ffff001d005d437001010000000100000000000000000000\ -00000000000000000000000000000000000000000000ffffffff0d03b4770301\ -64062f503253482fffffffff0100f9029500000000232103adb7d8ef6b63de74\ -313e0cd4e07670d09a169b13e4eda2d650f529332c47646dac00000000 +{% highlight bash %} +010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900\ +00000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e8\ +57233e0e61bc6649ffff001d01e3629901010000000100000000000000000000\ +00000000000000000000000000000000000000000000ffffffff0704ffff001d\ +0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1\ +1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781\ +e62294721166bf621e73a82cbf2342c858eeac00000000 + {% endhighlight %} Get the same block in JSON: {% highlight bash %} -curl http://localhost:18332/rest/block/notxdetails/000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39.json +curl http://localhost:8332/rest/block/notxdetails/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048.json {% endhighlight %} Result (whitespaced added): {% highlight json %} { - "hash": "000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39", - "confirmations": 91807, - "size": 189, - "height": 227252, - "version": 2, - "merkleroot": "c738fb8e22750b6d3511ed0049a96558b0bc57046f3f77771ec825b22d6a6f4a", - "tx": [ - "c738fb8e22750b6d3511ed0049a96558b0bc57046f3f77771ec825b22d6a6f4a" - ], - "time": 1398824312, - "nonce": 1883462912, - "bits": "1d00ffff", - "difficulty": 1.0, - "chainwork": "000000000000000000000000000000000000000000000000083ada4a4009841a", - "previousblockhash": "00000000c7f4990e6ebf71ad7e21a47131dfeb22c759505b3998d7a814c011df", - "nextblockhash": "00000000afe1928529ac766f1237657819a11cfcc8ca6d67f119e868ed5b6188" + "hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048", + "confirmations": 443375, + "strippedsize": 215, + "size": 215, + "weight": 860, + "height": 1, + "version": 1, + "versionHex": "00000001", + "merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098", + "tx": [ + "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098" + ], + "time": 1231469665, + "mediantime": 1231469665, + "nonce": 2573394689, + "bits": "1d00ffff", + "difficulty": 1, + "chainwork": "0000000000000000000000000000000000000000000000000000000200020002", + "previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", + "nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd" } {% endhighlight %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_block.md b/_includes/devdoc/bitcoin-core/rest/requests/get_block.md index 1c24a8e5..0d05ad69 100644 --- a/_includes/devdoc/bitcoin-core/rest/requests/get_block.md +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_block.md @@ -60,10 +60,20 @@ GET /block/. p: "Required
(exactly 1)" d: "The number of confirmations the transactions in this block have, starting at 1 when this block is at the tip of the best block chain. This score will be -1 if the the block is not part of the best block chain" +- n: "→
`strippedsize`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The size of this block in serialized block format excluding witness data, counted in bytes" + - n: "→
`size`" t: "number (int)" p: "Required
(exactly 1)" - d: "The size of this block in serialized block format, counted in bytes" + d: "The size of this block in serialized block format, counted in bytes" + +- n: "→
`weight`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The block weight as defined in BIP 141" - n: "→
`height`" t: "number (int)" @@ -74,6 +84,11 @@ GET /block/. t: "number (int)" p: "Required
(exactly 1)" d: "This block's version number. See [block version numbers][section block versions]" + +- n: "→
`versionHex`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

This block's version number formatted in hexadecimal" - n: "→
`merkleroot`" t: "string (hex)" @@ -95,6 +110,11 @@ GET /block/. t: "number (int)" p: "Required
(exactly 1)" d: "The value of the *time* field in the block header, indicating approximately when the block was created" + +- n: "→
`mediantime`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113" - n: "→
`nonce`" t: "number (int)" @@ -128,84 +148,93 @@ GET /block/. {% enditemplate %} -*Examples from Bitcoin Core 0.10.0* +*Examples from Bitcoin Core 0.13.1* Request a block in hex-encoded serialized block format: {% highlight bash %} -curl http://localhost:18332/rest/block/000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39.hex +curl http://localhost:8332/rest/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048.hex {% endhighlight %} Result (wrapped): -{% highlight text %} -02000000df11c014a8d798395b5059c722ebdf3171a4217ead71bf6e0e99f4c7\ -000000004a6f6a2db225c81e77773f6f0457bcb05865a94900ed11356d0b7522\ -8efb38c7785d6053ffff001d005d437001010000000100000000000000000000\ -00000000000000000000000000000000000000000000ffffffff0d03b4770301\ -64062f503253482fffffffff0100f9029500000000232103adb7d8ef6b63de74\ -313e0cd4e07670d09a169b13e4eda2d650f529332c47646dac00000000 +{% highlight bash %} +010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900\ +00000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e8\ +57233e0e61bc6649ffff001d01e3629901010000000100000000000000000000\ +00000000000000000000000000000000000000000000ffffffff0704ffff001d\ +0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1\ +1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781\ +e62294721166bf621e73a82cbf2342c858eeac00000000 + {% endhighlight %} Get the same block in JSON: {% highlight bash %} -curl http://localhost:18332/rest/block/000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39.json +curl http://localhost:8332/rest/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048.json {% endhighlight %} Result (whitespaced added): {% highlight json %} { - "hash": "000000000fe549a89848c76070d4132872cfb6efe5315d01d7ef77e4900f2d39", - "confirmations": 91785, - "size": 189, - "height": 227252, - "version": 2, - "merkleroot": "c738fb8e22750b6d3511ed0049a96558b0bc57046f3f77771ec825b22d6a6f4a", - "tx": [ + "hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048", + "confirmations": 443372, + "strippedsize": 215, + "size": 215, + "weight": 860, + "height": 1, + "version": 1, + "versionHex": "00000001", + "merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098", + "tx": [ + { + "txid": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098", + "hash": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098", + "size": 134, + "vsize": 134, + "version": 1, + "locktime": 0, + "vin": [ { - "txid": "c738fb8e22750b6d3511ed0049a96558b0bc57046f3f77771ec825b22d6a6f4a", - "version": 1, - "locktime": 0, - "vin": [ - { - "coinbase": "03b477030164062f503253482f", - "sequence": 4294967295 - } - ], - "vout": [ - { - "value": 25.0, - "n": 0, - "scriptPubKey": { - "asm": "03adb7d8ef6b63de74313e0cd4e07670d09a169b13e4eda2d650f529332c47646d OP_CHECKSIG", - "hex": "2103adb7d8ef6b63de74313e0cd4e07670d09a169b13e4eda2d650f529332c47646dac", - "reqSigs": 1, - "type": "pubkey", - "addresses": [ - "muXeUp1QYscuPRFH3qHtSrHyG6DQpvg7xZ" - ] - } - } - ] + "coinbase": "04ffff001d0104", + "sequence": 4294967295 } - ], - "time": 1398824312, - "nonce": 1883462912, - "bits": "1d00ffff", - "difficulty": 1.0, - "chainwork": "000000000000000000000000000000000000000000000000083ada4a4009841a", - "previousblockhash": "00000000c7f4990e6ebf71ad7e21a47131dfeb22c759505b3998d7a814c011df", - "nextblockhash": "00000000afe1928529ac766f1237657819a11cfcc8ca6d67f119e868ed5b6188" + ], + "vout": [ + { + "value": 50, + "n": 0, + "scriptPubKey": { + "asm": "0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee OP_CHECKSIG", + "hex": "410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac", + "reqSigs": 1, + "type": "pubkey", + "addresses": [ + "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX" + ] + } + } + ] + } + ], + "time": 1231469665, + "mediantime": 1231469665, + "nonce": 2573394689, + "bits": "1d00ffff", + "difficulty": 1, + "chainwork": "0000000000000000000000000000000000000000000000000000000200020002", + "previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", + "nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd" } {% endhighlight %} *See also* * [GET Block/NoTxDetails][rest get block-notxdetails] {{summary_restGetBlock-noTxDetails}} +* [GetBestBlockHash][rpc getbestblockhash] RPC: {{summary_getBestBlockHash}} * [GetBlock][rpc getblock] RPC: {{summary_getBlock}} * [GetBlockHash][rpc getblockhash] RPC: {{summary_getBlockHash}} -* [GetBestBlockHash][rpc getbestblockhash] RPC: {{summary_getBestBlockHash}} {% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_chaininfo.md b/_includes/devdoc/bitcoin-core/rest/requests/get_chaininfo.md new file mode 100644 index 00000000..605a3ae7 --- /dev/null +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_chaininfo.md @@ -0,0 +1,250 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/bitcoin-core/rest/requests/get_chaininfo.md" %} + +##### GET ChainInfo +{% include helpers/subhead-links.md %} + +{% assign summary_restGetChainInfo="returns information about the current state of the block chain." %} + +{% autocrossref %} + +The `GET chaininfo` operation {{summary_restGetChainInfo}} Supports only `json` as output format. + +*Request* + +{% highlight text %} +GET /chaininfo.json +{% endhighlight %} + +*Parameters: none* + +*Response as JSON* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "object" + p: "Required
(exactly 1)" + d: "Information about the current state of the local block chain" + +- n: "→
`chain`" + t: "string" + p: "Required
(exactly 1)" + d: "The name of the block chain. One of `main` for mainnet, `test` for testnet, or `regtest` for regtest" + +- n: "→
`blocks`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The number of validated blocks in the local best block chain. For a new node with just the hardcoded genesis block, this will be 0" + +- n: "→
`headers`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The number of validated headers in the local best headers chain. For a new node with just the hardcoded genesis block, this will be zero. This number may be higher than the number of *blocks*" + +- n: "→
`bestblockhash`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The hash of the header of the highest validated block in the best block chain, encoded as hex in RPC byte order. This is identical to the string returned by the `getbestblockhash` RPC" + +- n: "→
`difficulty`" + t: "number (real)" + p: "Required
(exactly 1)" + d: "The difficulty of the highest-height block in the best block chain" + +- n: "→
`mediantime`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113" + +- n: "→
`verificationprogress`" + t: "number (real)" + p: "Required (exactly 1)" + d: "Estimate of what percentage of the block chain transactions have been verified so far, starting at 0.0 and increasing to 1.0 for fully verified. May slightly exceed 1.0 when fully synced to account for transactions in the memory pool which have been verified before being included in a block" + +- n: "→
`chainwork`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The estimated number of block header hashes checked from the genesis block to this block, encoded as big-endian hex" + +- n: "→
`pruned`" + t: "bool" + p: "Required
(exactly 1)" + d: "Indicates if the blocks are subject to pruning" + +- n: "→
`pruneheight`" + t: "number (int)" + p: "Optional
(0 or 1)" + d: "The lowest-height complete block stored if prunning is activated" + +- n: "→
`softforks`" + t: "array" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

An array of objects each describing a current or previous soft fork" + +- n: "→ →
Softfork" + t: "object" + p: "Required
(3 or more)" + d: "A specific softfork" + +- n: "→ → →
`id`" + t: "string" + p: "Required
(exactly 1)" + d: "The name of the softfork" + +- n: "→ → →
`version`" + t: "numeric
(int)" + p: "Required
(exactly 1)" + d: "The block version used for the softfork" + +- n: "→ → →
`enforce`" + t: "string : object" + p: "Optional
(0 or 1)" + d: "The progress toward enforcing the softfork rules for new-version blocks" + +- n: "→ → → →
`status`" + t: "bool" + p: "Required
(exactly 1)" + d: "Indicates if the threshold was reached" + +- n: "→ → → →
`found`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "Number of blocks that support the softfork" + +- n: "→ → → →
`required`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "Number of blocks that are required to reach the threshold" + +- n: "→ → → →
`window`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "The maximum size of examined window of recent blocks" + +- n: "→ → →
`reject`" + t: "object" + p: "Optional
(0 or 1)" + d: "The progress toward enforcing the softfork rules for new-version blocks" + +- n: "→ → → →
`status`" + t: "bool" + p: "Optional
(0 or 1)" + d: "Indicates if the threshold was reached" + +- n: "→ → → →
`found`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "Number of blocks that support the softfork" + +- n: "→ → → →
`required`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "Number of blocks that are required to reach the threshold" + +- n: "→ → → →
`window`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "The maximum size of examined window of recent blocks" + +- n: "→
`bip9_softforks`" + t: "object" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.1*

The status of BIP9 softforks in progress" + +- n: "→ →
Name" + t: "string : object" + p: "Required
(2 or more)" + d: "A specific BIP9 softfork" + +- n: "→ → →
`status`" + t: "string" + p: "Required
(exactly 1)" + d: "Set to one of the following reasons:
• `defined` if voting hasn't started yet
• `started` if the voting has started
• `locked_in` if the voting was successful but the softfort hasn't been activated yet
• `active` if the softfork was activated
• `failed` if the softfork has not receieved enough votes" + +- n: "→ → →
`bit`" + t: "numeric
(int)" + p: "Optional
(0 or 1)" + d: "The bit (0-28) in the block version field used to signal this softfork. Field is only shown when status is `started`" + +- n: "→ → →
`startTime`" + t: "numeric
(int)" + p: "Required
(exactly 1)" + d: "The Unix epoch time when the softfork voting begins" + +- n: "→ → →
`timeout`" + t: "numeric
(int)" + p: "Required
(exactly 1)" + d: "The Unix epoch time at which the deployment is considered failed if not yet locked in" + +{% enditemplate %} + +*Examples from Bitcoin Core 0.13.1* + +Get blockchain info in JSON: + +{% highlight bash %} +curl http://localhost:8332/rest/chaininfo.json +{% endhighlight %} + +Result (whitespaced added): + +{% highlight json %} +{ + "chain": "main", + "blocks": 443372, + "headers": 443372, + "bestblockhash": "0000000000000000029a7ee8eb90c47cfcb3e3d877428ed85a3251719bf65ad7", + "difficulty": 286765766820.5504, + "mediantime": 1481671547, + "verificationprogress": 0.9999951668985226, + "chainwork": "000000000000000000000000000000000000000000330d0672c7d7f4f705b65c", + "pruned": false, + "softforks": [ + { + "id": "bip34", + "version": 2, + "reject": { + "status": true + } + }, + { + "id": "bip66", + "version": 3, + "reject": { + "status": true + } + }, + { + "id": "bip65", + "version": 4, + "reject": { + "status": true + } + } + ], + "bip9_softforks": { + "csv": { + "status": "active", + "startTime": 1462060800, + "timeout": 1493596800, + "since": 419328 + }, + "segwit": { + "status": "started", + "bit": 1, + "startTime": 1479168000, + "timeout": 1510704000, + "since": 439488 + } + } +} +{% endhighlight %} + +*See also* + +* [GetBlockChainInfo][rpc getblockchaininfo] RPC: {{summary_getBlockChainInfo}} + +{% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_getutxos.md b/_includes/devdoc/bitcoin-core/rest/requests/get_getutxos.md new file mode 100644 index 00000000..29f688bf --- /dev/null +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_getutxos.md @@ -0,0 +1,189 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/bitcoin-core/rest/requests/get_getutxos.md" %} + +##### GET GetUtxos +{% include helpers/subhead-links.md %} + +{% assign summary_restGetGetUtxos="returns an UTXO set given a set of outpoints." %} + +{% autocrossref %} + +The `GET getutxos` operation {{summary_restGetGetUtxos}} + +*Request* + +{% highlight text %} +GET /getutxos//-/-/.../-. +{% endhighlight %} + +*Parameter #1---Include memory pool transactions* + +{% itemplate ntpd1 %} +- n: "Check mempool " + t: "string" + p: "Optional
(0 or 1)" + d: "Set to `checkmempool` to include transactions that are currently in the memory pool to the calculation" + +{% enditemplate %} + +*Parameter #2---List of Outpoints* + +{% itemplate ntpd1 %} +- n: "Outpoint" + t: "vector" + p: "Required
(1 or more)" + d: "The list of outpoints to be queried. Each outpoint is the TXID of the transaction, encoded as hex in RPC byte order with an addditional `-n`" + +{% enditemplate %} + +*Parameter #3---the output format* + +{% itemplate ntpd1 %} +- n: "Format" + t: "suffix" + p: "Required
(exactly 1)" + d: "Set to `.json` for decoded block contents in JSON, or `.bin` or `hex` for a serialized block in binary or hex" + +{% enditemplate %} + +*Response as JSON* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "object" + p: "Required
(exactly 1)" + d: "The requetsted UTXO set" + +- n: "→→
`chainHeight`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The height of the chain at the moment the result was calculated" + +- n: "→
`chaintipHash`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The block hash of the top of the chain at the moment the result was calculated" + +- n: "→
`bitmap`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "" + +- n: "→
`utxos`" + t: "array" + p: "Required
(exactly 1)" + d: "An array of objects each describing an outpoint that is unspent" + +- n: "→→`Unspent Outpoint`" + t: "object" + p: "Optional
(0 or more)" + d: "A UTXO match based on the query" + +- n: "→→→
`txvers`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The version number of the transaction the UTXO was found in" + +- n: "→
`height`" + t: "number (int)" + p: "Required (exactly 1)" + d: "The height of the block containing the defining transaction, or 0x7FFFFFFF if the tx is in the mempool" + +- n: "→ → →
`value`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The value of the transaction" + +- n: "→ → →
`scriptPubKey`" + t: "object" + p: "Required
(exactly 1)" + d: "An object describing the pubkey script" + +- n: "→ → → →
`asm`" + t: "string" + p: "Required
(exactly 1)" + d: "The pubkey script in decoded form with non-data-pushing opcodes listed" + +- n: "→ → → →
`hex`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The pubkey script encoded as hex" + +- n: "→ → → →
`reqSigs`" + t: "number (int)" + p: "Optional
(0 or 1)" + d: "The number of signatures required; this is always `1` for P2PK, P2PKH, and P2SH (including P2SH multisig because the redeem script is not available in the pubkey script). It may be greater than 1 for bare multisig. This value will not be returned for `nulldata` or `nonstandard` script types (see the `type` key below)" + +- n: "→ → → →
`type`" + t: "string" + p: "Optional
(0 or 1)" + d: "The type of script. This will be one of the following:
• `pubkey` for a P2PK script
• `pubkeyhash` for a P2PKH script
• `scripthash` for a P2SH script
• `multisig` for a bare multisig script
• `nulldata` for nulldata scripts
• `nonstandard` for unknown scripts" + +- n: "→ → → →
`addresses`" + t: "string : array" + p: "Optional
(0 or 1)" + d: "Array of P2PKH or P2SH addresses used in this transaction, or the computed P2PKH address of any pubkeys in this transaction. This array will not be returned for `nulldata` or `nonstandard` script types" + +- n: "→ → → → →
Address" + t: "string" + p: "Required
(1 or more)" + d: "A P2PKH or P2SH address" + +{% enditemplate %} + +*Examples from Bitcoin Core 0.13.1* + +Request the UTXO set: + +{% highlight bash %} +curl http://localhost:8332/rest/getutxos/checkmempool/42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120-0.hex +{% endhighlight %} + +Result (wrapped): + +{% highlight bash %} +d0c306004f438cea9c68557da34e8e7823a963eb9350daa107ffd80100000000\ +0000000001010101000000ffffff7fc8883303000000001976a9145f4865d186\ +5127807f714b0ad1ddfae9870866d888ac +{% endhighlight %} + +Same request in JSON: + +{% highlight bash %} +curl http://localhost:8332/rest/getutxos/checkmempool/42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120-0.json +{% endhighlight %} + +Result (whitespaced added): + +{% highlight json %} +{ + "chainHeight": 443344, + "chaintipHash": "000000000000000001d8ff07a1da5093eb63a923788e4ea37d55689cea8c434f", + "bitmap": "1", + "utxos": [ + { + "txvers": 1, + "height": 2147483647, + "value": 0.53709, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 5f4865d1865127807f714b0ad1ddfae9870866d8 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a9145f4865d1865127807f714b0ad1ddfae9870866d888ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": [ + "19govWMzsRXqLUsUrHQKQ3DzekRxhsqwWH" + ] + } + } + ] +} +{% endhighlight %} + +*See also* + +* [GetTxOutSetInfo][rpc gettxoutsetinfo] RPC: {{summary_getTxOutSetInfo}} + +{% endautocrossref %} \ No newline at end of file diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_headers.md b/_includes/devdoc/bitcoin-core/rest/requests/get_headers.md new file mode 100644 index 00000000..87fef48c --- /dev/null +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_headers.md @@ -0,0 +1,207 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/bitcoin-core/rest/requests/get_headers.md" %} + +##### GET Headers +{% include helpers/subhead-links.md %} + +{% assign summary_restGetHeaders="returns a specified amout of block headers in upward direction." %} + +{% autocrossref %} + +The `GET headers` operation {{summary_restGetHeaders}} + +*Request* + +{% highlight text %} +GET /headers//. +{% endhighlight %} + +*Parameter #1---the amount of block headers to retrieve* + +{% itemplate ntpd1 %} +- n: "Amount" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The amount of block headers in upward direction to return (including the start header hash)" + +{% enditemplate %} + +*Parameter #2---the header hash of the block to retrieve* + +{% itemplate ntpd1 %} +- n: "Header Hash" + t: "path (hex)" + p: "Required
(exactly 1)" + d: "The hash of the header of the block to get, encoded as hex in RPC byte order" + +{% enditemplate %} + +*Parameter #3---the output format* + +{% itemplate ntpd1 %} +- n: "Format" + t: "suffix" + p: "Required
(exactly 1)" + d: "Set to `.json` for decoded block contents in JSON, or `.bin` or `hex` for a serialized block in binary or hex" + +{% enditemplate %} + +*Response as JSON* + +{% itemplate ntpd1 %} +- n: "Result" + t: "array" + p: "Required
(exactly 1)" + d: "An array containing the requested block headers" + +- n: "→
Block Header" + t: "object" + p: "Required
(1 or more)" + d: "An object containing a block header. The amount of the objects is the same as the amount provided in parameter #1 " + +- n: "→→
`hash`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The hash of this block's block header encoded as hex in RPC byte order. This is the same as the hash provided in parameter #2" + +- n: "→→
`confirmations`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The number of confirmations the transactions in this block have, starting at 1 when this block is at the tip of the best block chain. This score will be -1 if the the block is not part of the best block chain" + +- n: "→→
`height`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The height of this block on its block chain" + +- n: "→→
`version`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "This block's version number. See [block version numbers][section block versions]" + +- n: "→→
`versionHex`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

This block's version number formatted in hexadecimal" + +- n: "→→
`merkleroot`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The merkle root for this block, encoded as hex in RPC byte order" + +- n: "→→
`time`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The value of the *time* field in the block header, indicating approximately when the block was created" + +- n: "→→
`mediantime`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113" + +- n: "→→
`nonce`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The nonce which was successful at turning this particular block into one that could be added to the best block chain" + +- n: "→→
`bits`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The value of the *nBits* field in the block header, indicating the target threshold this block's header had to pass" + +- n: "→→
`difficulty`" + t: "number (real)" + p: "Required
(exactly 1)" + d: "The estimated amount of work done to find this block relative to the estimated amount of work done to find block 0" + +- n: "→→
`chainwork`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The estimated number of block header hashes miners had to check from the genesis block to this block, encoded as big-endian hex" + +- n: "→→
`previousblockhash`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The hash of the header of the previous block, encoded as hex in RPC byte order" + +- n: "→→
`nextblockhash`" + t: "string (hex)" + p: "Optional
(0 or 1)" + d: "The hash of the next block on the best block chain, if known, encoded as hex in RPC byte order" + +{% enditemplate %} + +*Examples from Bitcoin Core 0.13.1* + +Request 5 block headers in hex-encoded serialized block format: + +{% highlight bash %} +curl http://localhost:8332/rest/headers/5/000000000000000002538dfef658564662025e0687b0c65c6d5c9d765984ec5a.hex +{% endhighlight %} + +Result (wrapped): + +{% highlight bash %} +040000004b9e8debb1bb9df8f85d0f64cf45d408f5f7fcf3293ec40400000000\ +000000008c37685c878a66aa2709c3dc27a35020269ce1ce7ecb41dabe8f4e0c\ +ca8fc508651b2b5776270618cb395012000000205aec8459769d5c6d5cc6b087\ +065e0262465658f6fe8d53020000000000000000cb9a492474a4791b7f4dee49\ +0b3d813b1eb192fb67109c0c99317101019f72a7cd1f2b57762706185c2921b4 +{% endhighlight %} + +Get the same block headers in JSON: + +{% highlight bash %} +curl http://localhost:8332/rest/headers/5/000000000000000002538dfef658564662025e0687b0c65c6d5c9d765984ec5a.json +{% endhighlight %} + +Result (whitespaced added): + +{% highlight json %} +[ + { + "hash": "000000000000000002538dfef658564662025e0687b0c65c6d5c9d765984ec5a", + "confirmations": 33009, + "height": 410334, + "version": 4, + "versionHex": "00000004", + "merkleroot": "08c58fca0c4e8fbeda41cb7ecee19c262050a327dcc30927aa668a875c68378c", + "time": 1462442853, + "mediantime": 1462441310, + "nonce": 307247563, + "bits": "18062776", + "difficulty": 178659257772.5273, + "chainwork": "00000000000000000000000000000000000000000018562bc90589834ae929d0", + "previousblockhash": "000000000000000004c43e29f3fcf7f508d445cf640f5df8f89dbbb1eb8d9e4b", + "nextblockhash": "000000000000000000f198b9f92bc29fa294be4bb777e61fdd56aac07f174553" + }, + { + "hash": "000000000000000000f198b9f92bc29fa294be4bb777e61fdd56aac07f174553", + "confirmations": 33008, + "height": 410335, + "version": 536870912, + "versionHex": "20000000", + "merkleroot": "a7729f01017131990c9c1067fb92b11e3b813d0b49ee4d7f1b79a47424499acb", + "time": 1462443981, + "mediantime": 1462441496, + "nonce": 3022072156, + "bits": "18062776", + "difficulty": 178659257772.5273, + "chainwork": "000000000000000000000000000000000000000000185655621b104558a77160", + "previousblockhash": "000000000000000002538dfef658564662025e0687b0c65c6d5c9d765984ec5a", + "nextblockhash": "0000000000000000005b3caade164fcc5f3f00fd99ddbdb47ee66ea4bbe9387a" + } +] +{% endhighlight %} + +*See also* + +* [GET Block/NoTxDetails][rest get block-notxdetails] {{summary_restGetBlock-noTxDetails}} +* [GetBlock][rpc getblock] RPC: {{summary_getBlock}} +* [GetBlockHash][rpc getblockhash] RPC: {{summary_getBlockHash}} +* [GetBlockHeader][rpc getblockheader] RPC: {{summary_getBlockHeader}} + +{% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-contents.md b/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-contents.md new file mode 100644 index 00000000..858dc1bd --- /dev/null +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-contents.md @@ -0,0 +1,169 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/bitcoin-core/rest/requests/get_mempool-contents.md" %} + +##### GET MemPool/Contents +{% include helpers/subhead-links.md %} + +{% assign summary_restGetMemPool-contents="returns all transaction in the memory pool with detailed information." %} + +{% autocrossref %} + +The `GET mempool/contents` operation {{summary_restGetMemPool-contents}} Supports only `json` as output format. + +*Request* + +{% highlight text %} +GET /mempool/contents.json +{% endhighlight %} + +*Parameters: none* + +*Result as JSON* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "object" + p: "Required
(exactly 1)" + d: "A object containing transactions currently in the memory pool. May be empty" + +- n: "→
TXID" + t: "string : object" + p: "Optional
(0 or more)" + d: "The TXID of a transaction in the memory pool, encoded as hex in RPC byte order" + +- n: "→ →
`size`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The size of the serialized transaction in bytes" + +- n: "→ →
`fee`" + t: "number (bitcoins)" + p: "Required
(exactly 1)" + d: "The transaction fee paid by the transaction in decimal bitcoins" + +- n: "→ →
`modifiedfee`" + t: "number (bitcoins)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The transaction fee with fee deltas used for mining priority in decimal bitcoins" + +- n: "→ →
`time`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The time the transaction entered the memory pool, Unix epoch time format" + +- n: "→ →
`height`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The block height when the transaction entered the memory pool" + +- n: "→ →
`startingpriority`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The priority of the transaction when it first entered the memory pool" + +- n: "→ →
`currentpriority`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The current priority of the transaction" + +- n: "→ →
`descendantcount`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The number of in-mempool descendant transactions (including this one)" + +- n: "→ →
`descendantsize`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The size of in-mempool descendants (including this one)" + +- n: "→ →
`descendantfees`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The modified fees (see `modifiedfee` above) of in-mempool descendants (including this one)" + +- n: "→ →
`ancestorcount`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The number of in-mempool ancestor transactions (including this one)" + +- n: "→ →
`ancestorsize`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The size of in-mempool ancestors (including this one)" + +- n: "→ →
`ancestorfees`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.13.0*

The modified fees (see `modifiedfee` above) of in-mempool ancestors (including this one)" + +- n: "→ →
`depends`" + t: "array" + p: "Required
(exactly 1)" + d: "An array holding TXIDs of unconfirmed transactions this transaction depends upon (parent transactions). Those transactions must be part of a block before this transaction can be added to a block, although all transactions may be included in the same block. The array may be empty" + +- n: "→ → →
Depends TXID" + t: "string" + p: "Optional (0 or more)" + d: "The TXIDs of any unconfirmed transactions this transaction depends upon, encoded as hex in RPC byte order" + +{% enditemplate %} + +*Examples from Bitcoin Core 0.13.1* + +Get all transactions in the memory pool in JSON: + +{% highlight bash %} +curl http://localhost:8332/rest/mempool/contents.json +{% endhighlight %} + +Result (whitespaced added): + +{% highlight json %} +{ + "b104586f229e330caf42c475fd52684e9eb5e2d02f0fcd216d9554c5347b0873": { + "size": 485, + "fee": 0.00009700, + "modifiedfee": 0.00009700, + "time": 1479423635, + "height": 439431, + "startingpriority": 15327081.81818182, + "currentpriority": 21536936.36363636, + "descendantcount": 1, + "descendantsize": 485, + "descendantfees": 9700, + "ancestorcount": 1, + "ancestorsize": 485, + "ancestorfees": 9700, + "depends": [ + ] + }, + "094f7dcbc7494510d4daeceb2941ed73b1bd011bf527f6c3b7c897fee85c11d4": { + "size": 554, + "fee": 0.00005540, + "modifiedfee": 0.00005540, + "time": 1479423327, + "height": 439430, + "startingpriority": 85074.91071428571, + "currentpriority": 3497174.4375, + "descendantcount": 1, + "descendantsize": 554, + "descendantfees": 5540, + "ancestorcount": 1, + "ancestorsize": 554, + "ancestorfees": 5540, + "depends": [ + ] + } +} +{% endhighlight %} + +*See also* + +* [GET MemPool/Info][rest get mempool-info]: {{summary_restGetMemPool-info}} +* [GetMemPoolInfo][rpc getmempoolinfo] RPC: {{summary_getMemPoolInfo}} +* [GetRawMemPool][rpc getrawmempool] RPC: {{summary_getRawMemPool}} + +{% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-info.md b/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-info.md new file mode 100644 index 00000000..bfe3843a --- /dev/null +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_mempool-info.md @@ -0,0 +1,85 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_includes/devdoc/bitcoin-core/rest/requests/get_mempool-info.md" %} + +##### GET MemPool/Info +{% include helpers/subhead-links.md %} + +{% assign summary_restGetMemPool-info="returns information about the node's current transaction memory pool." %} + +{% autocrossref %} + +The `GET mempool/info` operation {{summary_restGetMemPool-info}} Supports only `json` as output format. + +*Request* + +{% highlight text %} +GET /mempool/info.json +{% endhighlight %} + +*Parameters: none* + +*Result as JSON* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "object" + p: "Required
(exactly 1)" + d: "A object containing information about the memory pool" + +- n: "→
`size`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The number of transactions currently in the memory pool" + +- n: "→
`bytes`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The total number of bytes in the transactions in the memory pool" + +- n: "→
`usage`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.11.0*

Total memory usage for the mempool in bytes" + +- n: "→
`maxmempool`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

Maximum memory usage for the mempool in bytes" + +- n: "→
`mempoolminfee`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "*Added in Bitcoin Core 0.12.0*

The lowest fee per kilobyte paid by any transaction in the memory pool" + +{% enditemplate %} + +*Examples from Bitcoin Core 0.13.1* + +Get memory pool info in JSON: + +{% highlight bash %} +curl http://localhost:8332/rest/mempool/info.json +{% endhighlight %} + +Result (whitespaced added): + +{% highlight json %} +{ + "size": 989, + "bytes": 736919, + "usage": 1970496, + "maxmempool": 300000000, + "mempoolminfee": 0 +} + +{% endhighlight %} + +*See also* + +* [GET MemPool/Contents][rest get mempool-contents]: {{summary_restGetMemPool-contents}} +* [GetMemPoolInfo][rpc getmempoolinfo] RPC: {{summary_getMemPoolInfo}} + +{% endautocrossref %} diff --git a/_includes/devdoc/bitcoin-core/rest/requests/get_tx.md b/_includes/devdoc/bitcoin-core/rest/requests/get_tx.md index bd1baa6e..19c27ac3 100644 --- a/_includes/devdoc/bitcoin-core/rest/requests/get_tx.md +++ b/_includes/devdoc/bitcoin-core/rest/requests/get_tx.md @@ -75,97 +75,86 @@ GET /tx/. {% enditemplate %} -*Examples from Bitcoin Core 0.10.0* +*Examples from Bitcoin Core 0.13.1* Request a transaction in hex-encoded serialized transaction format: {% highlight bash %} -curl http://localhost:18332/rest/tx/ef7c0cbf6ba5af68d2ea239bba709b26ff7b0b669839a63bb01c2cb8e8de481e.hex +curl http://localhost:8332/rest/tx/42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120.hex {% endhighlight %} Result (wrapped): {% highlight text %} -0100000001268a9ad7bfb21d3c086f0ff28f73a064964aa069ebb69a9e437da8\ -5c7e55c7d7000000006b483045022100ee69171016b7dd218491faf6e13f53d4\ -0d64f4b40123a2de52560feb95de63b902206f23a0919471eaa1e45a0982ed28\ -8d374397d30dff541b2dd45a4c3d0041acc0012103a7c1fd1fdec50e1cf3f0cc\ -8cb4378cd8e9a2cee8ca9b3118f3db16cbbcf8f326ffffffff0350ac60020000\ -00001976a91456847befbd2360df0e35b4e3b77bae48585ae06888ac80969800\ -000000001976a9142b14950b8d31620c6cc923c5408a701b1ec0a02088ac002d\ -3101000000001976a9140dfc8bafc8419853b34d5e072ad37d1a5159f58488ac\ -00000000 +0100000001bf33f5e034d1774f4019c03e119f4fa9e421339271f7476e5e34ff\ +72839ebc16000000006b483045022100dab0ade70063cbc5ad44664b707391f8\ +ffe6e406b1bab43abfb547d701694d98022067580db89b81c69ba83487ea0a1b\ +cb6a325d2903b726980865210d2127de09710121023ee7a6437e9ad2957cd032\ +38b9668c15cb1dc6ac9c9d142f829168e1a3e4a9c4feffffff02c88833030000\ +00001976a9145f4865d1865127807f714b0ad1ddfae9870866d888ac102697eb\ +000000001976a91479e19d5c1cbc1c18f59c57d37ca403f3bcdaa73f88acd0c3\ +0600 {% endhighlight %} Get the same transaction in JSON: {% highlight bash %} -curl http://localhost:18332/rest/tx/ef7c0cbf6ba5af68d2ea239bba709b26ff7b0b669839a63bb01c2cb8e8de481e.json +curl http://localhost:8332/rest/tx/42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120.json {% endhighlight %} Result (whitespaced added): {% highlight json %} { - "txid": "ef7c0cbf6ba5af68d2ea239bba709b26ff7b0b669839a63bb01c2cb8e8de481e", - "version": 1, - "locktime": 0, - "vin": [ - { - "txid": "d7c7557e5ca87d439e9ab6eb69a04a9664a0738ff20f6f083c1db2bfd79a8a26", - "vout": 0, - "scriptSig": { - "asm": "3045022100ee69171016b7dd218491faf6e13f53d40d64f4b40123a2de52560feb95de63b902206f23a0919471eaa1e45a0982ed288d374397d30dff541b2dd45a4c3d0041acc001 03a7c1fd1fdec50e1cf3f0cc8cb4378cd8e9a2cee8ca9b3118f3db16cbbcf8f326", - "hex": "483045022100ee69171016b7dd218491faf6e13f53d40d64f4b40123a2de52560feb95de63b902206f23a0919471eaa1e45a0982ed288d374397d30dff541b2dd45a4c3d0041acc0012103a7c1fd1fdec50e1cf3f0cc8cb4378cd8e9a2cee8ca9b3118f3db16cbbcf8f326" - }, - "sequence": 4294967295 - } - ], - "vout": [ - { - "value": 0.39889999999999998, - "n": 0, - "scriptPubKey": { - "asm": "OP_DUP OP_HASH160 56847befbd2360df0e35b4e3b77bae48585ae068 OP_EQUALVERIFY OP_CHECKSIG", - "hex": "76a91456847befbd2360df0e35b4e3b77bae48585ae06888ac", - "reqSigs": 1, - "type": "pubkeyhash", - "addresses": [ - "moQR7i8XM4rSGoNwEsw3h4YEuduuP6mxw7" - ] - } - }, - { - "value": 0.10000000000000001, - "n": 1, - "scriptPubKey": { - "asm": "OP_DUP OP_HASH160 2b14950b8d31620c6cc923c5408a701b1ec0a020 OP_EQUALVERIFY OP_CHECKSIG", - "hex": "76a9142b14950b8d31620c6cc923c5408a701b1ec0a02088ac", - "reqSigs": 1, - "type": "pubkeyhash", - "addresses": [ - "mjSk1Ny9spzU2fouzYgLqGUD8U41iR35QN" - ] - } - }, - { - "value": 0.20000000000000001, - "n": 2, - "scriptPubKey": { - "asm": "OP_DUP OP_HASH160 0dfc8bafc8419853b34d5e072ad37d1a5159f584 OP_EQUALVERIFY OP_CHECKSIG", - "hex": "76a9140dfc8bafc8419853b34d5e072ad37d1a5159f58488ac", - "reqSigs": 1, - "type": "pubkeyhash", - "addresses": [ - "mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe" - ] - } - } - ], - "blockhash": "00000000103e0091b7d27e5dc744a305108f0c752be249893c749e19c1c82317", - "confirmations": 91916, - "time": 1398734825, - "blocktime": 1398734825 + "txid": "42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120", + "hash": "42f9df54a39026ccb54362141c41713968f19e1f14949ab6609b03ffa4b7f120", + "size": 226, + "vsize": 226, + "version": 1, + "locktime": 443344, + "vin": [ + { + "txid": "16bc9e8372ff345e6e47f771923321e4a94f9f113ec019404f77d134e0f533bf", + "vout": 0, + "scriptSig": { + "asm": "3045022100dab0ade70063cbc5ad44664b707391f8ffe6e406b1bab43abfb547d701694d98022067580db89b81c69ba83487ea0a1bcb6a325d2903b726980865210d2127de0971[ALL] 023ee7a6437e9ad2957cd03238b9668c15cb1dc6ac9c9d142f829168e1a3e4a9c4", + "hex": "483045022100dab0ade70063cbc5ad44664b707391f8ffe6e406b1bab43abfb547d701694d98022067580db89b81c69ba83487ea0a1bcb6a325d2903b726980865210d2127de09710121023ee7a6437e9ad2957cd03238b9668c15cb1dc6ac9c9d142f829168e1a3e4a9c4" + }, + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 0.53709, + "n": 0, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 5f4865d1865127807f714b0ad1ddfae9870866d8 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a9145f4865d1865127807f714b0ad1ddfae9870866d888ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": [ + "19govWMzsRXqLUsUrHQKQ3DzekRxhsqwWH" + ] + } + }, + { + "value": 39.5255144, + "n": 1, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 79e19d5c1cbc1c18f59c57d37ca403f3bcdaa73f OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a91479e19d5c1cbc1c18f59c57d37ca403f3bcdaa73f88ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": [ + "1C7T3CJ6MEYf1YCYYPfN6zuGirqZcD3wuE" + ] + } + } + ], + "blockhash": "0000000000000000023da07114323ad9676896f354951e6b563d143428b69c03", + "confirmations": 28, + "time": 1481662934, + "blocktime": 1481662934 } {% endhighlight %} diff --git a/_includes/helpers/summaries.md b/_includes/helpers/summaries.md index dd73398e..c536036c 100644 --- a/_includes/helpers/summaries.md +++ b/_includes/helpers/summaries.md @@ -1,14 +1,15 @@ {%comment%}AUTOMATICALLY-GENERATED FILE: DO NOT EDIT THIS FILE This file is licensed under the terms of its source texts{%endcomment%} -{% assign summary_abandonTransaction="marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respend." %} +{% assign summary_abandonTransaction="marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent." %} {% assign summary_addMultiSigAddress="adds a P2SH multisig address to the wallet." %} {% assign summary_addNode="attempts to add or remove a node from the addnode list, or to try a connection to a node once." %} {% assign summary_backupWallet="safely copies `wallet.dat` to the specified file, which can be a directory or a path with filename." %} -{% assign summary_clearBanned="Clears list of banned nodes." %} +{% assign summary_clearBanned="clears list of banned nodes." %} {% assign summary_createMultiSig="creates a P2SH multi-signature address." %} {% assign summary_createRawTransaction="creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network." %} {% assign summary_decodeRawTransaction="decodes a serialized transaction hex string into a JSON object describing the transaction." %} {% assign summary_decodeScript="decodes a hex-encoded P2SH redeem script." %} +{% assign summary_disconnectnode="immediately disconnects from a specified node." %} {% assign summary_dumpPrivKey="returns the wallet-import-format (WIP) private key corresponding to an address. (But does not remove it from the wallet.)" %} {% assign summary_dumpWallet="creates or overwrites a file with all wallet keys in a human-readable format." %} {% assign summary_encryptWallet="encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys." %} @@ -72,6 +73,11 @@ This file is licensed under the terms of its source texts{%endcomment%} {% assign summary_prioritiseTransaction="adds virtual priority or fee to a transaction, allowing it to be accepted into blocks mined by this node (or miners which use this node) with a lower priority or fee. (It can also remove virtual priority or fee, requiring the transaction have a higher priority or fee to be accepted into a locally-mined block.)" %} {% assign summary_restGetBlock-noTxDetails="gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block. The JSON object includes TXIDs for transactions within the block rather than the complete transactions [GET block][rest get block] returns." %} {% assign summary_restGetBlock="gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." %} +{% assign summary_restGetChainInfo="provides information about the current state of the block chain." %} +{% assign summary_restGetGetUtxos="returns an UTXO set given a set of outpoints." %} +{% assign summary_restGetHeaders="returns a specified amout of block headers in upward direction." %} +{% assign summary_restGetMemPool-contents="returns all transaction in the memory pool with detailed information." %} +{% assign summary_restGetMemPool-info="returns information about the node's current transaction memory pool." %} {% assign summary_restGetTx="gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Bitcoin Core only stores complete transaction data for UTXOs and your own transactions, so this method may fail on historic transactions unless you use the non-default `txindex=1` in your Bitcoin Core startup settings." %} {% assign summary_sendFrom="spends an amount from a local account to a bitcoin address." %} {% assign summary_sendMany="creates and broadcasts a transaction which sends outputs to multiple addresses." %} diff --git a/_includes/references.md b/_includes/references.md index 3fa4952e..f343ada0 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -160,6 +160,11 @@ http://opensource.org/licenses/MIT. {% comment %}{% endcomment %} [rest get block]: /en/developer-reference#get-block [rest get block-notxdetails]: /en/developer-reference#get-blocknotxdetails +[rest get chaininfo]: /en/developer-reference#get-chaininfo +[rest get getutxos]: /en/developer-reference#get-getutxos +[rest get headers]: /en/developer-reference#get-headers +[rest get mempool-contents]: /en/developer-reference#get-mempoolcontents +[rest get mempool-info]: /en/developer-reference#get-mempoolinfo [rest get tx]: /en/developer-reference#get-tx {% comment %}{% endcomment %} diff --git a/en/developer-reference.md b/en/developer-reference.md index f2212a9f..57b5bb90 100644 --- a/en/developer-reference.md +++ b/en/developer-reference.md @@ -268,6 +268,16 @@ untrusted source. {% include devdoc/bitcoin-core/rest/requests/get_block-notxdetails.md %} +{% include devdoc/bitcoin-core/rest/requests/get_chaininfo.md %} + +{% include devdoc/bitcoin-core/rest/requests/get_getutxos.md %} + +{% include devdoc/bitcoin-core/rest/requests/get_headers.md %} + +{% include devdoc/bitcoin-core/rest/requests/get_mempool-contents.md %} + +{% include devdoc/bitcoin-core/rest/requests/get_mempool-info.md %} + {% include devdoc/bitcoin-core/rest/requests/get_tx.md %} {% include references.md %}