diff --git a/.gitignore b/.gitignore index e35d885..3f52b55 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -_build +_build/ +.vscode diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1238f71 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, nationality, personal appearance, race, religion, or sexual identity +and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers and contributors are responsible for clarifying the +standards of acceptable behavior and are expected to take appropriate and fair +corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting Will Binns at . All complaints will be +reviewed and investigated and will result in a response that is deemed necessary +and appropriate to the circumstances. The project team is obligated to maintain +confidentiality with regard to the reporter of an incident. + +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.4, available at [http://contributor-covenant.org/version/1/4][version]. + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f1c2c6a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Welcome to developer.bitcoin.org's codebase + +Live site: [developer.bitcoin.org](https://developer.bitcoin.org) + +Report problems or help improve the site by opening a [new +issue](https://github.com/bitcoin-dot-org/developer.bitcoin.org/issues) or [pull +request](https://github.com/bitcoin-dot-org/developer.bitcoin.org/compare). + +## How to contribute + +This repo hosts the sources for the Bitcoin developer documentation. One of the +easiest ways to get started contributing is by rereading the site and looking for +inconsistencies in terminology, style, etc., and also in any illustrations. + +Prior to contributing, please review the [style +guide](https://github.com/bitcoin-dot-org/developer.bitcoin.org/tree/master/docs/style-guide.md). + +Much of the content displayed on the is converted from Markdown to +[reStructuredText (RST)](http://docutils.sourceforge.net/rst.html) and rendered +with [Sphinx](http://www.sphinx-doc.org). + +### Render the documentation locally + +To render the documentation locally you first need to install Sphinx and the +required theme modules, e.g. by running + + pip install -r requirements.txt + +This should be done from the root of this repo. Then you can execute Sphinx by calling + + make html + +This will generate HTML from the RST sources in the directory `_build/html`. +It's all static HTML so you can just open the index.html file in your browser +locally to view the rendered documentation. + +### Generation of RPC docs + +The documentation of the RPC commands is automatically generated from the help +of a bitcoin client with a [helper +tool](https://github.com/bitcoin-dot-org/developer.bitcoin.org/tree/master/helpers/rpc). +This is the content in the [reference/rpc](reference/rpc) directory. Changes in +these files need to be done through the helper tool or at least backported to +the helper tool after doing them in this repo. + +## Code of Conduct + +Participation in this project is subject to a [Code of +Conduct](https://github.com/bitcoin-dot-org/developer.bitcoin.org/blob/master/CODE_OF_CONDUCT.md). + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..0622f9f --- /dev/null +++ b/COPYING @@ -0,0 +1,5 @@ +The intellectual property rights in the files are owned by the respective +authors. Some of the files can be licensed under MIT License (MIT) available on +http://opensource.org/licenses/MIT or other licenses. Appropriate licensing +information can be found in the header of the file or in the folder containing +the file. diff --git a/LICENSE b/LICENSE index 3509b0d..59c4050 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,4 @@ -Copyright (c) 2009-2019 Bitcoin.org -Copyright (c) 2019 Bitcoin Developer Documentation +Copyright (c) 2019-2020 developer.bitcoin.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4d2e904..3e148d3 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,49 @@ -# Bitcoin Developer Documentation +# Welcome to developer.bitcoin.org's codebase -This repo hosts the sources for the Bitcoin developer documentation. +Live site: [developer.bitcoin.org](https://developer.bitcoin.org) -It is an experimental port of the documentation hosted at [bitcoin.org](https://bitcoin.org/en/developer-documentation) ([sources](https://github.com/bitcoin-dot-org/bitcoin.org)), converted from Markdown to [reStructuredText (RST)](http://docutils.sourceforge.net/rst.html) and rendered with [Sphinx](http://www.sphinx-doc.org). +Report problems or help improve the site by opening a [new +issue](https://github.com/bitcoin-dot-org/developer.bitcoin.org/issues) or [pull +request](https://github.com/bitcoin-dot-org/developer.bitcoin.org/compare). -## Render the documentation locally +## How to contribute -To render the documentation locally you first need to install Sphinx and the required theme modules, e.g. by running +This repo hosts the sources for the Bitcoin developer documentation. One of the +easiest ways to get started contributing is by rereading the site and looking for +inconsistencies in terminology, style, etc., and also in any illustrations. - pip install -r requirements.txt - -from the root of this repo. Then you can execute Sphinx by calling +Prior to contributing, please review the [style +guide](https://github.com/bitcoin-dot-org/developer.bitcoin.org/tree/master/docs/style-guide.md). - make html +Much of the content displayed on the is converted from Markdown to +[reStructuredText (RST)](http://docutils.sourceforge.net/rst.html) and rendered +with [Sphinx](http://www.sphinx-doc.org). -This will generate HTML from the RST sources in the directory `_build/html`. It's all static HTML so you can just open the index.html file in your browser locally to view the rendered documentation. +### Render the documentation locally -## Import from bitcoin.org +To render the documentation locally you first need to install Sphinx and the +required theme modules, e.g. by running -The RST is generated from the original Markdown sources from bitcoin.org using a helper script, which resides in the [helpers](helpers) directory. Run the script by calling + pip install -r requirements.txt - helpers/import-docs +This should be done from the root of this repo. Then you can execute Sphinx by calling -with the path to a local checkout of [bitcoin-dot-org/bitcoin.org](https://github.com/bitcoin-dot-org/bitcoin.org) as argument. This will regenerate the RST files based on the content from the bitcoin.org repository. + make html -This is a temporary mechanism to port the documentation to RST. Once the import is in a good shape and the original information is captured correctly in the converted files, the RST files will become the original source, and the import is not needed anymore. There is a [milestone](https://github.com/bitcoin-documentation/website/milestone/1) to track the necessary work to be done before detaching from the Markdown sources. +This will generate HTML from the RST sources in the directory `_build/html`. +It's all static HTML so you can just open the index.html file in your browser +locally to view the rendered documentation. -## Generation of RPC docs +### Generation of RPC docs -The documentation of the RPC commands is automatically generated from the help of a bitcoin client with another [helper tool](https://github.com/cornelius/rpc-docs-helper). This is the content in the [reference/rpc](reference/rpc) directory. Changes in these files need to be done through the helper tool or at least backported to the helper tool after doing them in this repo. +The documentation of the RPC commands is automatically generated from the help +of a bitcoin client with a [helper +tool](https://github.com/bitcoin-dot-org/developer.bitcoin.org/tree/master/helpers/rpc). +This is the content in the [reference/rpc](reference/rpc) directory. Changes in +these files need to be done through the helper tool or at least backported to +the helper tool after doing them in this repo. -## License +## Code of Conduct -The content of this repo is licensed under the [MIT license](LICENSE). +Participation in this project is subject to a [Code of +Conduct](https://github.com/bitcoin-dot-org/developer.bitcoin.org/blob/master/CODE_OF_CONDUCT.md). diff --git a/_theme/breadcrumb.html b/_theme/breadcrumb.html index fdeae50..66742b1 100644 --- a/_theme/breadcrumb.html +++ b/_theme/breadcrumb.html @@ -1,6 +1,6 @@ @@ -127,15 +121,15 @@
-
+
- 3FkenCiXpSLqD8L79intRNXUgjRoH9sjXa + 3E8ociqZa9mZUSwGdSmAEMAoAxBK3FNDcd
@@ -173,4 +167,4 @@
- \ No newline at end of file + diff --git a/_theme/hero.html b/_theme/hero.html index 6dec665..7812c47 100644 --- a/_theme/hero.html +++ b/_theme/hero.html @@ -1,7 +1,7 @@

Welcome

-

Understand Bitcoin and start building Bitcoin-based applications.

+

Learn Bitcoin and start building Bitcoin-based applications.

{{ toctree(maxdepth=1, collapse=False, includehidden=False) }}
diff --git a/_theme/layout.html b/_theme/layout.html index 6bda1d1..f4d6c04 100644 --- a/_theme/layout.html +++ b/_theme/layout.html @@ -11,19 +11,9 @@ - + - - - {{ super() }} {% endblock %} @@ -63,9 +53,6 @@ {%- if customsidebar %} {%- include customsidebar %} {%- endif %} - {%- block sidebarsearch %} - {%- include "searchbox.html" %} - {%- endblock %} {%- block sidebarsourcelink %} {%- include "sourcelink.html" %} {%- endblock %} @@ -130,4 +117,4 @@
-{%- endblock %} \ No newline at end of file +{%- endblock %} diff --git a/_theme/searchbox.html b/_theme/searchbox.html deleted file mode 100644 index d66c2a5..0000000 --- a/_theme/searchbox.html +++ /dev/null @@ -1,12 +0,0 @@ -{%- if pagename != "search" %} -

Search

- - - -{%- endif %} diff --git a/_theme/static/css/main.css b/_theme/static/css/main.css index 747e152..9f03c60 100644 --- a/_theme/static/css/main.css +++ b/_theme/static/css/main.css @@ -102,7 +102,7 @@ body { /* Breadcrumbs */ .breadcrumbs-section { padding: 18px 0; - background: #000; + background: #090c14; } .breadcrumb { align-items: center; @@ -118,6 +118,9 @@ body { color: #3490E6; text-decoration: underline; } +.breadcrumb-item a:hover { + text-decoration: none; +} .breadcrumb-item.active { color: #fff; } @@ -130,8 +133,11 @@ body { border-color: #F7931A; } .btn-group .btn:hover { - background: #F7931A; - border-color: #F7931A; + background: #F9A136; + border-color: #F9A136; +} +h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink, caption:hover > a.headerlink, p.caption:hover > a.headerlink, div.code-block-caption:hover > a.headerlink { + margin-left: 10px; } @media handheld, only screen and ( max-width: 990px ), only screen and ( max-device-width: 990px ) { @@ -145,6 +151,9 @@ body { .hero-nav .toctree-l1:nth-child(odd) { margin-left: 0; } + div.document h1 { + margin-top: 0; + } } @media handheld, only screen and ( max-width: 500px ), only screen and ( max-device-width: 500px ) { .content-container { diff --git a/_theme/static/sphinxbootstrap4.css_t b/_theme/static/sphinxbootstrap4.css_t index 559abd9..ab52f1d 100644 --- a/_theme/static/sphinxbootstrap4.css_t +++ b/_theme/static/sphinxbootstrap4.css_t @@ -218,9 +218,6 @@ Navbar Dropdown styles Sidebar styles */ -#searchbox { - margin: 20px 20px 10px 20px; -} .main a { text-decoration: underline; color: #3490E6; @@ -946,7 +943,9 @@ blockquote { font-size: 12px; } .logo-light { - width: 270px + width: 270px; + max-width: 220px; + height: 27px; } .footer-logo { margin-bottom: 30px; diff --git a/_theme/theme.conf b/_theme/theme.conf index 862f342..74d6ee3 100644 --- a/_theme/theme.conf +++ b/_theme/theme.conf @@ -1,7 +1,7 @@ [theme] inherit = basic pygments_style = friendly -sidebars = globaltoc.html, relations.html, sourcelink.html, searchbox.html +sidebars = globaltoc.html, relations.html, sourcelink.html [options] navbar_style = fixed-top diff --git a/conf.py b/conf.py index 4578ca6..ae8f159 100644 --- a/conf.py +++ b/conf.py @@ -19,7 +19,7 @@ # -- Project information ----------------------------------------------------- project = u'Bitcoin' -copyright = u'Bitcoin Project 2009-2019' +copyright = u'Bitcoin Project 2009-2020' author = u'Bitcoin Developer Documentation' # The short X.Y version diff --git a/devguide/block_chain.rst b/devguide/block_chain.rst index 2f61466..4bbfbb3 100644 --- a/devguide/block_chain.rst +++ b/devguide/block_chain.rst @@ -6,14 +6,14 @@ The block chain provides Bitcoin's public ledger, an ordered and timestamped rec Introduction ------------ -Each full node in the Bitcoin `network <../devguide/p2p_network.html>`__ independently stores a block chain containing only blocks validated by that node. When several nodes all have the same blocks in their block chain, they are considered to be in :term:`consensus`. The validation rules these nodes follow to maintain consensus are called :term:`consensus rules`. This section describes many of the consensus rules used by Bitcoin Core. +Each full node in the Bitcoin `network <../devguide/p2p_network.html>`__ independently stores a block chain containing only blocks validated by that node. When several nodes all have the same blocks in their block chain, they are considered to be in :term:`consensus `. The validation rules these nodes follow to maintain consensus are called :term:`consensus rules `. This section describes many of the consensus rules used by Bitcoin Core. .. figure:: /img/dev/en-blockchain-overview.svg :alt: Block Chain Overview Block Chain Overview -The illustration above shows a simplified version of a block chain. A :term:`block` of one or more new transactions is collected into the transaction data part of a block. Copies of each transaction are hashed, and the hashes are then paired, hashed, paired again, and hashed again until a single hash remains, the :term:`merkle root` of a merkle tree. +The illustration above shows a simplified version of a block chain. A :term:`block ` of one or more new transactions is collected into the transaction data part of a block. Copies of each transaction are hashed, and the hashes are then paired, hashed, paired again, and hashed again until a single hash remains, the :term:`merkle root ` of a merkle tree. The merkle root is stored in the block header. Each block also stores the hash of the previous block’s header, chaining the blocks together. This ensures a transaction cannot be modified without modifying the block that records it and all following blocks. @@ -26,11 +26,11 @@ Transactions are also chained together. Bitcoin wallet software gives the impres A single transaction can create multiple outputs, as would be the case when sending to multiple addresses, but each output of a particular transaction can only be used as an input once in the block chain. Any subsequent reference is a forbidden double spend—an attempt to spend the same satoshis twice. -Outputs are tied to :term:`transaction identifiers (TXIDs) `, which are the hashes of signed transactions. +Outputs are tied to :term:`transaction identifiers (TXIDs) `, which are the hashes of signed transactions. -Because each output of a particular transaction can only be spent once, the outputs of all transactions included in the block chain can be categorized as either :term:`Unspent Transaction Outputs (UTXOs) ` or spent transaction outputs. For a payment to be valid, it must only use UTXOs as inputs. +Because each output of a particular transaction can only be spent once, the outputs of all transactions included in the block chain can be categorized as either :term:`Unspent Transaction Outputs (UTXOs) ` or spent transaction outputs. For a payment to be valid, it must only use UTXOs as inputs. -Ignoring coinbase transactions (described later), if the value of a transaction’s outputs exceed its inputs, the transaction will be rejected—but if the inputs exceed the value of the outputs, any difference in value may be claimed as a :term:`transaction fee` by the Bitcoin :term:`miner ` who creates the block containing that transaction. For example, in the illustration above, each transaction spends 10,000 satoshis fewer than it receives from its combined inputs, effectively paying a 10,000 satoshi transaction fee. +Ignoring coinbase transactions (described later), if the value of a transaction’s outputs exceed its inputs, the transaction will be rejected—but if the inputs exceed the value of the outputs, any difference in value may be claimed as a :term:`transaction fee ` by the Bitcoin :term:`miner ` who creates the block containing that transaction. For example, in the illustration above, each transaction spends 10,000 satoshis fewer than it receives from its combined inputs, effectively paying a 10,000 satoshi transaction fee. Proof Of Work ------------- @@ -39,13 +39,13 @@ The block chain is collaboratively maintained by anonymous peers on the `network Chaining blocks together makes it impossible to modify transactions included in any block without modifying all subsequent blocks. As a result, the cost to modify a particular block increases with every new block added to the block chain, magnifying the effect of the proof of work. -The :term:`proof of work` used in Bitcoin takes advantage of the apparently random nature of cryptographic hashes. A good cryptographic hash algorithm converts arbitrary data into a seemingly random number. If the data is modified in any way and the hash re-run, a new seemingly random number is produced, so there is no way to modify the data to make the hash number predictable. +The :term:`proof of work ` used in Bitcoin takes advantage of the apparently random nature of cryptographic hashes. A good cryptographic hash algorithm converts arbitrary data into a seemingly random number. If the data is modified in any way and the hash re-run, a new seemingly random number is produced, so there is no way to modify the data to make the hash number predictable. To prove you did some extra work to create a block, you must create a hash of the block header which does not exceed a certain value. For example, if the maximum possible hash value is 2256 − 1, you can prove that you tried up to two combinations by producing a hash value less than 2255. -In the example given above, you will produce a successful hash on average every other try. You can even estimate the probability that a given hash attempt will generate a number below the :term:`target ` threshold. Bitcoin assumes a linear probability that the lower it makes the target threshold, the more hash attempts (on average) will need to be tried. +In the example given above, you will produce a successful hash on average every other try. You can even estimate the probability that a given hash attempt will generate a number below the :term:`target ` threshold. Bitcoin assumes a linear probability that the lower it makes the target threshold, the more hash attempts (on average) will need to be tried. -New blocks will only be added to the block chain if their hash is at least as challenging as a :term:`difficulty` value expected by the consensus protocol. Every 2,016 blocks, the `network <../devguide/p2p_network.html>`__ uses timestamps stored in each block header to calculate the number of seconds elapsed between generation of the first and last of those last 2,016 blocks. The ideal value is 1,209,600 seconds (two weeks). +New blocks will only be added to the block chain if their hash is at least as challenging as a :term:`difficulty ` value expected by the consensus protocol. Every 2,016 blocks, the `network <../devguide/p2p_network.html>`__ uses timestamps stored in each block header to calculate the number of seconds elapsed between generation of the first and last of those last 2,016 blocks. The ideal value is 1,209,600 seconds (two weeks). - If it took fewer than two weeks to generate the 2,016 blocks, the expected difficulty value is increased proportionally (by as much as 300%) so that the next 2,016 blocks should take exactly two weeks to generate if hashes are checked at the same rate. @@ -60,18 +60,18 @@ The block header provides several easy-to-modify fields, such as a dedicated non Block Height And Forking ------------------------ -Any Bitcoin miner who successfully hashes a block header to a value below the target threshold can add the entire block to the block chain (assuming the block is otherwise valid). These blocks are commonly addressed by their :term:`block height`—the number of blocks between them and the first Bitcoin block (block 0, most commonly known as the :term:`genesis block`). For example, block 2016 is where difficulty could have first been adjusted. +Any Bitcoin miner who successfully hashes a block header to a value below the target threshold can add the entire block to the block chain (assuming the block is otherwise valid). These blocks are commonly addressed by their :term:`block height `—the number of blocks between them and the first Bitcoin block (block 0, most commonly known as the :term:`genesis block `). For example, block 2016 is where difficulty could have first been adjusted. .. figure:: /img/dev/en-blockchain-fork.svg :alt: Common And Uncommon Block Chain Forks Common And Uncommon Block Chain Forks -Multiple blocks can all have the same block height, as is common when two or more miners each produce a block at roughly the same time. This creates an apparent :term:`fork` in the block chain, as shown in the illustration above. +Multiple blocks can all have the same block height, as is common when two or more miners each produce a block at roughly the same time. This creates an apparent :term:`fork ` in the block chain, as shown in the illustration above. When miners produce simultaneous blocks at the end of the block chain, each node individually chooses which block to accept. In the absence of other considerations, discussed below, nodes usually use the first block they see. -Eventually a miner produces another block which attaches to only one of the competing simultaneously-mined blocks. This makes that side of the fork stronger than the other side. Assuming a fork only contains valid blocks, normal peers always follow the most difficult chain to recreate and throw away :term:`stale blocks ` belonging to shorter forks. (Stale blocks are also sometimes called orphans or orphan blocks, but those terms are also used for true orphan blocks without a known parent block.) +Eventually a miner produces another block which attaches to only one of the competing simultaneously-mined blocks. This makes that side of the fork stronger than the other side. Assuming a fork only contains valid blocks, normal peers always follow the most difficult chain to recreate and throw away :term:`stale blocks ` belonging to shorter forks. (Stale blocks are also sometimes called orphans or orphan blocks, but those terms are also used for true orphan blocks without a known parent block.) Long-term forks are possible if different miners work at cross-purposes, such as some miners diligently working to extend the block chain at the same time other miners are attempting a 51 percent attack to revise transaction history. @@ -88,7 +88,7 @@ Blocks are not required to include any non-coinbase transactions, but miners alm All transactions, including the coinbase transaction, are encoded into blocks in binary raw transaction format. -The raw transaction format is hashed to create the transaction identifier (txid). From these txids, the :term:`merkle tree` is constructed by pairing each txid with one other txid and then hashing them together. If there are an odd number of txids, the txid without a partner is hashed with a copy of itself. +The raw transaction format is hashed to create the transaction identifier (txid). From these txids, the :term:`merkle tree ` is constructed by pairing each txid with one other txid and then hashing them together. If there are an odd number of txids, the txid without a partner is hashed with a copy of itself. The resulting hashes themselves are each paired with one other hash and hashed together. Any hash without a partner is hashed with itself. The process repeats until only one hash remains, the merkle root. @@ -119,14 +119,14 @@ To maintain consensus, all full nodes validate blocks using the same consensus r 2. A block violating the new consensus rules is rejected by upgraded nodes but accepted by non-upgraded nodes. For example, an abusive transaction feature is used within a block: upgraded nodes reject it because it violates the new rules, but non-upgraded nodes accept it because it follows the old rules. -In the first case, rejection by non-upgraded nodes, mining software which gets block chain data from those non-upgraded nodes refuses to build on the same chain as mining software getting data from upgraded nodes. This creates permanently divergent chains—one for non-upgraded nodes and one for upgraded nodes—called a :term:`hard fork`. +In the first case, rejection by non-upgraded nodes, mining software which gets block chain data from those non-upgraded nodes refuses to build on the same chain as mining software getting data from upgraded nodes. This creates permanently divergent chains—one for non-upgraded nodes and one for upgraded nodes—called a :term:`hard fork `. .. figure:: /img/dev/en-hard-fork.svg :alt: Hard Fork Hard Fork -In the second case, rejection by upgraded nodes, it’s possible to keep the block chain from permanently diverging if upgraded nodes control a majority of the hash rate. That’s because, in this case, non-upgraded nodes will accept as valid all the same blocks as upgraded nodes, so the upgraded nodes can build a stronger chain that the non-upgraded nodes will accept as the best valid block chain. This is called a :term:`soft fork`. +In the second case, rejection by upgraded nodes, it’s possible to keep the block chain from permanently diverging if upgraded nodes control a majority of the hash rate. That’s because, in this case, non-upgraded nodes will accept as valid all the same blocks as upgraded nodes, so the upgraded nodes can build a stronger chain that the non-upgraded nodes will accept as the best valid block chain. This is called a :term:`soft fork `. .. figure:: /img/dev/en-soft-fork.svg :alt: Soft Fork @@ -135,9 +135,9 @@ In the second case, rejection by upgraded nodes, it’s possible to keep the blo Although a fork is an actual divergence in block chains, changes to the consensus rules are often described by their potential to create either a hard or soft fork. For example, “increasing the block size above 1 MB requires a hard fork.” In this example, an actual block chain fork is not required—but it is a possible outcome. -Consensus rule changes may be activated in various ways. During Bitcoin’s first two years, Satoshi Nakamoto performed several soft forks by just releasing the backwards-compatible change in a client that began immediately enforcing the new rule. Multiple soft forks such as `BIP30 `__ have been activated via a flag day where the new rule began to be enforced at a preset time or block height. Such forks activated via a flag day are known as :term:`User Activated Soft Forks ` (UASF) as they are dependent on having sufficient users (nodes) to enforce the new rules after the flag day. +Consensus rule changes may be activated in various ways. During Bitcoin’s first two years, Satoshi Nakamoto performed several soft forks by just releasing the backwards-compatible change in a client that began immediately enforcing the new rule. Multiple soft forks such as `BIP30 `__ have been activated via a flag day where the new rule began to be enforced at a preset time or block height. Such forks activated via a flag day are known as :term:`User Activated Soft Forks ` (UASF) as they are dependent on having sufficient users (nodes) to enforce the new rules after the flag day. -Later soft forks waited for a majority of hash rate (typically 75% or 95%) to signal their readiness for enforcing the new consensus rules. Once the signalling threshold has been passed, all nodes will begin enforcing the new rules. Such forks are known as :term:`Miner Activated Soft Forks ` (MASF) as they are dependent on miners for activation. +Later soft forks waited for a majority of hash rate (typically 75% or 95%) to signal their readiness for enforcing the new consensus rules. Once the signalling threshold has been passed, all nodes will begin enforcing the new rules. Such forks are known as :term:`Miner Activated Soft Forks ` (MASF) as they are dependent on miners for activation. **Resources:** `BIP16 `__, `BIP30 `__, and `BIP34 `__ were implemented as changes which might have lead to soft forks. `BIP50 `__ describes both an accidental hard fork, resolved by temporary downgrading the capabilities of upgraded nodes, and an intentional hard fork when the temporary downgrade was removed. A document from Gavin Andresen outlines `how future rule changes may be implemented `__. diff --git a/devguide/contracts.rst b/devguide/contracts.rst index d44a446..77832b4 100644 --- a/devguide/contracts.rst +++ b/devguide/contracts.rst @@ -17,9 +17,9 @@ Charlie-the-customer wants to buy a product from Bob-the-businessman, but neithe A simple contract could say that Charlie will spend satoshis to an output which can only be spent if Charlie and Bob both sign the input spending it. That means Bob won’t get paid unless Charlie gets his merchandise, but Charlie can’t get the merchandise and keep his payment. -This simple contract isn’t much help if there’s a dispute, so Bob and Charlie enlist the help of Alice-the-arbitrator to create an :term:`escrow contract`. Charlie spends his satoshis to an output which can only be spent if two of the three people sign the input. Now Charlie can pay Bob if everything is ok, Bob can `refund <../devguide/payment_processing.html#issuing-refunds>`__ Charlie’s money if there’s a problem, or Alice can arbitrate and decide who should get the satoshis if there’s a dispute. +This simple contract isn’t much help if there’s a dispute, so Bob and Charlie enlist the help of Alice-the-arbitrator to create an :term:`escrow contract `. Charlie spends his satoshis to an output which can only be spent if two of the three people sign the input. Now Charlie can pay Bob if everything is ok, Bob can `refund <../devguide/payment_processing.html#issuing-refunds>`__ Charlie’s money if there’s a problem, or Alice can arbitrate and decide who should get the satoshis if there’s a dispute. -To create a multiple-signature (:term:`multisig`) output, they each give the others a public key. Then Bob creates the following :term:`P2SH multisig ` redeem script: +To create a multiple-signature (:term:`multisig `) output, they each give the others a public key. Then Bob creates the following :term:`P2SH multisig ` redeem script: :: diff --git a/devguide/mining.rst b/devguide/mining.rst index 964de8e..b28fa47 100644 --- a/devguide/mining.rst +++ b/devguide/mining.rst @@ -90,4 +90,4 @@ Using the coinbase transaction received, the mining software adds a nonce to the Unlike `“getblocktemplate” <../reference/rpc/getblocktemplate.html>`__, miners using Stratum cannot inspect or add transactions to the block they’re currently mining. Also unlike `“getblocktemplate” <../reference/rpc/getblocktemplate.html>`__, the Stratum protocol uses a two-way TCP socket directly, so miners don’t need to use HTTP longpoll to ensure they receive immediate updates from mining pools when a new block is broadcast to the `peer-to-peer network <../devguide/p2p_network.html>`__. -**Resources:** The GPLv3 `BFGMiner `__ mining software and AGPLv3 `Eloipool `__ mining pool software are widely-used among miners and pools. The `libblkmaker `__ C library and `python-blkmaker `__ library, both MIT licensed, can interpret GetBlockTemplate for your programs. +**Resources:** The GPLv3 `BFGMiner `__ mining software and AGPLv3 `Eloipool `__ mining pool software are widely-used among miners and pools. The `libblkmaker `__ C library and `python-blkmaker `__ library, both MIT licensed, can interpret GetBlockTemplate for your programs. diff --git a/devguide/p2p_network.rst b/devguide/p2p_network.rst index 77a03a5..66896cd 100644 --- a/devguide/p2p_network.rst +++ b/devguide/p2p_network.rst @@ -15,7 +15,7 @@ To provide practical examples of the Bitcoin `peer-to-peer network <../devguide/ Peer Discovery -------------- -When started for the first time, programs don’t know the IP addresses of any active full nodes. In order to discover some IP addresses, they query one or more DNS names (called :term:`DNS seeds `) hardcoded into Bitcoin Core and `BitcoinJ `__. The response to the lookup should include one or more `DNS A records `__ with the IP addresses of full nodes that may accept new incoming connections. For example, using the `Unix ``dig`` command `__: +When started for the first time, programs don’t know the IP addresses of any active full nodes. In order to discover some IP addresses, they query one or more DNS names (called :term:`DNS seeds `) hardcoded into Bitcoin Core and `BitcoinJ `__. The response to the lookup should include one or more `DNS A records `__ with the IP addresses of full nodes that may accept new incoming connections. For example, using the `Unix ``dig`` command `__: :: @@ -155,7 +155,7 @@ All of these problems are addressed in part or in full by the headers-first IBD Headers-First ~~~~~~~~~~~~~ -`Bitcoin Core 0.10.0 `__ uses an initial block download (IBD) method called *headers-first*. The goal is to download the headers for the best :term:`header chain`, partially validate them as best as possible, and then download the corresponding blocks in parallel. This solves several problems with the older blocks-first IBD method. +`Bitcoin Core 0.10.0 `__ uses an initial block download (IBD) method called *headers-first*. The goal is to download the headers for the best :term:`header chain
`, partially validate them as best as possible, and then download the corresponding blocks in parallel. This solves several problems with the older blocks-first IBD method. .. figure:: /img/dev/en-headers-first-flowchart.svg :alt: Overview Of Headers-First Method @@ -230,7 +230,7 @@ When a miner discovers a new block, it broadcasts the new block to its peers usi The miner replies to each request accordingly by sending the block in a `“block” message <../reference/p2p_networking.html#block>`__, one or more headers in a `“headers” message <../reference/p2p_networking.html#headers>`__, or the merkle block and transactions relative to the SPV client’s bloom filter in a `“merkleblock” message <../reference/p2p_networking.html#merkleblock>`__ followed by zero or more `“tx” messages <../reference/p2p_networking.html#tx>`__. -- :term:`Direct Headers Announcement `\ **:** a relay node may skip the round trip overhead of an `“inv” message <../reference/p2p_networking.html#inv>`__ followed by ``getheaders`` by instead immediately sending a `“headers” message <../reference/p2p_networking.html#headers>`__ containing the full header of the new block. A HF peer receiving this message will partially validate the block header as it would during headers-first IBD, then request the full block contents with a `“getdata” message <../reference/p2p_networking.html#getdata>`__ if the header is valid. The relay node then responds to the ``getdata`` request with the full or filtered block data in a ``block`` or `“merkleblock” message <../reference/p2p_networking.html#merkleblock>`__, respectively. A HF node may signal that it prefers to receive ``headers`` instead of ``inv`` announcements by sending a special `“sendheaders” message <../reference/p2p_networking.html#sendheaders>`__ during the connection handshake. +- :term:`Direct Headers Announcement `\ **:** a relay node may skip the round trip overhead of an `“inv” message <../reference/p2p_networking.html#inv>`__ followed by ``getheaders`` by instead immediately sending a `“headers” message <../reference/p2p_networking.html#headers>`__ containing the full header of the new block. A HF peer receiving this message will partially validate the block header as it would during headers-first IBD, then request the full block contents with a `“getdata” message <../reference/p2p_networking.html#getdata>`__ if the header is valid. The relay node then responds to the ``getdata`` request with the full or filtered block data in a ``block`` or `“merkleblock” message <../reference/p2p_networking.html#merkleblock>`__, respectively. A HF node may signal that it prefers to receive ``headers`` instead of ``inv`` announcements by sending a special `“sendheaders” message <../reference/p2p_networking.html#sendheaders>`__ during the connection handshake. This protocol for block broadcasting was proposed in BIP 130 and has been implemented in Bitcoin Core since version 0.12. diff --git a/devguide/payment_processing.rst b/devguide/payment_processing.rst index 2d6a964..8b75923 100644 --- a/devguide/payment_processing.rst +++ b/devguide/payment_processing.rst @@ -126,7 +126,7 @@ Payment Protocol |Warning icon| **Warning:** The payment protocol is considered to be deprecated and will be removed in a later version of Bitcoin Core. The protocol has multiple security design flaws and implementation flaws in some wallets. Users will begin receiving deprecation warnings in Bitcoin Core version 0.18 when using `BIP70 `__ URI’s. Merchants should transition away from `BIP70 `__ to more secure options such as `BIP21 `__. Merchants should never require `BIP70 `__ payments and should provide `BIP21 `__ fallbacks. -Bitcoin Core 0.9 supports the new :term:`payment protocol`. The payment protocol adds many important features to payment requests: +Bitcoin Core 0.9 supports the new :term:`payment protocol `. The payment protocol adds many important features to payment requests: - Supports `X.509 `__ certificates and SSL encryption to verify receivers’ identity and help prevent `man-in-the-middle `__ attacks. @@ -215,11 +215,11 @@ If a `refund <../devguide/payment_processing.html#issuing-refunds>`__ needs to b Verifying Payment ----------------- -As explained in the `Transactions <../devguide/transactions.html>`__ and `Block Chain <../devguide/blockchain.html>`__ sections, broadcasting a transaction to the `network <../devguide/p2p_network.html>`__ doesn’t ensure that the receiver gets paid. A malicious spender can create one transaction that pays the receiver and a second one that pays the same input back to himself. Only one of these transactions will be added to the block chain, and nobody can say for sure which one it will be. +As explained in the `Transactions <../devguide/transactions.html>`__ and `Block Chain <../devguide/block_chain.html>`__ sections, broadcasting a transaction to the `network <../devguide/p2p_network.html>`__ doesn’t ensure that the receiver gets paid. A malicious spender can create one transaction that pays the receiver and a second one that pays the same input back to himself. Only one of these transactions will be added to the block chain, and nobody can say for sure which one it will be. -Two or more transactions spending the same input are commonly referred to as a :term:`double spend`. +Two or more transactions spending the same input are commonly referred to as a :term:`double spend `. -Once the transaction is included in a block, double spends are impossible without modifying block chain history to replace the transaction, which is quite difficult. Using this system, the Bitcoin protocol can give each of your transactions an updating confidence score based on the number of blocks which would need to be modified to replace a transaction. For each block, the transaction gains one :term:`confirmation `. Since modifying blocks is quite difficult, higher confirmation scores indicate greater protection. +Once the transaction is included in a block, double spends are impossible without modifying block chain history to replace the transaction, which is quite difficult. Using this system, the Bitcoin protocol can give each of your transactions an updating confidence score based on the number of blocks which would need to be modified to replace a transaction. For each block, the transaction gains one :term:`confirmation `. Since modifying blocks is quite difficult, higher confirmation scores indicate greater protection. **0 confirmations**: The transaction has been broadcast but is still not included in any block. Zero confirmation transactions (unconfirmed transactions) should generally not be trusted without risk analysis. Although miners usually confirm the first transaction they receive, fraudsters may be able to manipulate the `network <../devguide/p2p_network.html>`__ into including their version of a transaction. @@ -243,7 +243,7 @@ An interesting source of double-spend risk analysis can be acquired by connectin For example, unconfirmed transactions can be compared among all connected peers to see if any UTXO is used in multiple unconfirmed transactions, indicating a double-spend attempt, in which case the payment can be refused until it is confirmed. Transactions can also be ranked by their transaction fee to estimate the amount of time until they’re added to a block. -Another example could be to detect a fork when multiple peers report differing block header hashes at the same block height. Your program can go into a safe mode if the fork extends for more than two blocks, indicating a possible problem with the block chain. For more details, see the `Detecting Forks subsection <../devguide/blockchain.html#detecting-forks>`__. +Another example could be to detect a fork when multiple peers report differing block header hashes at the same block height. Your program can go into a safe mode if the fork extends for more than two blocks, indicating a possible problem with the block chain. For more details, see the `Detecting Forks subsection <../devguide/block_chain.html#detecting-forks>`__. Another good source of double-spend protection can be human intelligence. For example, fraudsters may act differently from legitimate customers, letting savvy merchants manually flag them as high risk. Your program can provide a safe mode which stops automatic payment acceptance on a global or per-customer basis. diff --git a/devguide/transactions.rst b/devguide/transactions.rst index 24c7e7f..b743325 100644 --- a/devguide/transactions.rst +++ b/devguide/transactions.rst @@ -15,7 +15,7 @@ To keep things simple, this section pretends coinbase transactions do not exist. The Parts Of A Transaction -The figure above shows the main parts of a Bitcoin transaction. Each transaction has at least one input and one output. Each :term:`input` spends the satoshis paid to a previous output. Each :term:`output` then waits as an Unspent Transaction Output (UTXO) until a later input spends it. When your Bitcoin wallet tells you that you have a 10,000 satoshi balance, it really means that you have 10,000 satoshis waiting in one or more UTXOs. +The figure above shows the main parts of a Bitcoin transaction. Each transaction has at least one input and one output. Each :term:`input ` spends the satoshis paid to a previous output. Each :term:`output ` then waits as an Unspent Transaction Output (UTXO) until a later input spends it. When your Bitcoin wallet tells you that you have a 10,000 satoshi balance, it really means that you have 10,000 satoshis waiting in one or more UTXOs. Each transaction is prefixed by a four-byte :ref:`transaction version number ` which tells Bitcoin peers and miners which set of rules to use to validate it. This lets developers create new rules for future transactions without invalidating previous transactions. @@ -28,24 +28,24 @@ An output has an implied index number based on its location in the transaction An input uses a transaction identifier (txid) and an :ref:`output index ` number (often called “vout” for output vector) to identify a particular output to be spent. It also has a signature script which allows it to provide data parameters that satisfy the conditionals in the pubkey script. (The sequence number and locktime are related and will be covered together in a later subsection.) -The figures below help illustrate how these features are used by showing the workflow Alice uses to send Bob a transaction and which Bob later uses to spend that transaction. Both Alice and Bob will use the most common form of the standard Pay-To-Public-Key-Hash (P2PKH) transaction type. :term:`P2PKH ` lets Alice spend satoshis to a typical Bitcoin address, and then lets Bob further spend those satoshis using a simple cryptographic :ref:`key pair `. +The figures below help illustrate how these features are used by showing the workflow Alice uses to send Bob a transaction and which Bob later uses to spend that transaction. Both Alice and Bob will use the most common form of the standard Pay-To-Public-Key-Hash (P2PKH) transaction type. :term:`P2PKH ` lets Alice spend satoshis to a typical Bitcoin address, and then lets Bob further spend those satoshis using a simple cryptographic :ref:`key pair `. .. figure:: /img/dev/en-creating-p2pkh-output.svg :alt: Creating A P2PKH Public Key Hash To Receive Payment Creating A P2PKH Public Key Hash To Receive Payment -Bob must first generate a private/public :ref:`key pair ` before Alice can create the first transaction. Bitcoin uses the Elliptic Curve Digital Signature Algorithm (`ECDSA `__) with the `secp256k1 `__ curve; `secp256k1 `__ :term:`private keys ` are 256 bits of random data. A copy of that data is deterministically transformed into an `secp256k1 `__ :term:`public key`. Because the transformation can be reliably repeated later, the public key does not need to be stored. +Bob must first generate a private/public :ref:`key pair ` before Alice can create the first transaction. Bitcoin uses the Elliptic Curve Digital Signature Algorithm (`ECDSA `__) with the `secp256k1 `__ curve; `secp256k1 `__ :term:`private keys ` are 256 bits of random data. A copy of that data is deterministically transformed into an `secp256k1 `__ :term:`public key `. Because the transformation can be reliably repeated later, the public key does not need to be stored. The public key (pubkey) is then cryptographically hashed. This pubkey hash can also be reliably repeated later, so it also does not need to be stored. The hash shortens and obfuscates the public key, making manual transcription easier and providing security against unanticipated problems which might allow reconstruction of private keys from public key data at some later point. -Bob provides the pubkey hash to Alice. Pubkey hashes are almost always sent encoded as Bitcoin :term:`addresses
`, which are base58-encoded strings containing an address version number, the hash, and an error-detection checksum to catch typos. The address can be transmitted through any medium, including one-way mediums which prevent the spender from communicating with the receiver, and it can be further encoded into another format, such as a QR code containing a :ref:`“bitcoin:” URI `. +Bob provides the pubkey hash to Alice. Pubkey hashes are almost always sent encoded as Bitcoin :term:`addresses
`, which are base58-encoded strings containing an address version number, the hash, and an error-detection checksum to catch typos. The address can be transmitted through any medium, including one-way mediums which prevent the spender from communicating with the receiver, and it can be further encoded into another format, such as a QR code containing a :ref:`“bitcoin:” URI `. -Once Alice has the address and decodes it back into a standard hash, she can create the first transaction. She creates a standard P2PKH transaction output containing instructions which allow anyone to spend that output if they can prove they control the private key corresponding to Bob’s hashed public key. These instructions are called the :term:`pubkey script` or scriptPubKey. +Once Alice has the address and decodes it back into a standard hash, she can create the first transaction. She creates a standard P2PKH transaction output containing instructions which allow anyone to spend that output if they can prove they control the private key corresponding to Bob’s hashed public key. These instructions are called the :term:`pubkey script ` or scriptPubKey. Alice broadcasts the transaction and it is added to the block chain. The `network <../devguide/p2p_network.html>`__ categorizes it as an Unspent Transaction Output (UTXO), and Bob’s wallet software displays it as a spendable balance. -When, some time later, Bob decides to spend the UTXO, he must create an input which references the transaction Alice created by its hash, called a Transaction Identifier (txid), and the specific output she used by its index number (:ref:`output index `). He must then create a :term:`signature script`—a collection of data parameters which satisfy the conditions Alice placed in the previous output’s pubkey script. Signature scripts are also called scriptSigs. +When, some time later, Bob decides to spend the UTXO, he must create an input which references the transaction Alice created by its hash, called a Transaction Identifier (txid), and the specific output she used by its index number (:ref:`output index `). He must then create a :term:`signature script `—a collection of data parameters which satisfy the conditions Alice placed in the previous output’s pubkey script. Signature scripts are also called scriptSigs. Pubkey scripts and signature scripts combine `secp256k1 `__ pubkeys and signatures with conditional logic, creating a programmable authorization mechanism. @@ -58,7 +58,7 @@ For a P2PKH-style output, Bob’s signature script will contain the following tw 1. His full (unhashed) public key, so the pubkey script can check that it hashes to the same value as the pubkey hash provided by Alice. -2. An `secp256k1 `__ :term:`signature` made by using the `ECDSA `__ cryptographic formula to combine certain transaction data (described below) with Bob’s private key. This lets the pubkey script verify that Bob owns the private key which created the public key. +2. An `secp256k1 `__ :term:`signature ` made by using the `ECDSA `__ cryptographic formula to combine certain transaction data (described below) with Bob’s private key. This lets the pubkey script verify that Bob owns the private key which created the public key. Bob’s `secp256k1 `__ signature doesn’t just prove Bob controls his private key; it also makes the non-signature-script parts of his transaction tamper-proof so Bob can safely broadcast them over the `peer-to-peer network <../devguide/p2p_network.html>`__. @@ -118,7 +118,7 @@ P2SH Scripts Pubkey scripts are created by spenders who have little interest what that script does. Receivers do care about the script conditions and, if they want, they can ask spenders to use a particular pubkey script. Unfortunately, custom pubkey scripts are less convenient than short Bitcoin addresses and there was no standard way to communicate them between programs prior to widespread implementation of the now deprecated `BIP70 `__ Payment Protocol discussed later. -To solve these problems, pay-to-script-hash (:term:`P2SH `) transactions were created in 2012 to let a spender create a pubkey script containing a hash of a second script, the :term:`redeem script`. +To solve these problems, pay-to-script-hash (:term:`P2SH `) transactions were created in 2012 to let a spender create a pubkey script containing a hash of a second script, the :term:`redeem script `. The basic P2SH workflow, illustrated below, looks almost identical to the P2PKH workflow. Bob creates a redeem script with whatever script he wants, hashes the redeem script, and provides the redeem script hash to Alice. Alice creates a P2SH-style output containing Bob’s redeem script hash. @@ -218,7 +218,7 @@ Pubkey outputs are a simplified form of the P2PKH pubkey script, but they aren Null Data ~~~~~~~~~ -:term:`Null data ` transaction type relayed and mined by default in `Bitcoin Core 0.9.0 `__ and later that adds arbitrary data to a provably unspendable pubkey script that full nodes don’t have to store in their UTXO database. It is preferable to use null data transactions over transactions that bloat the UTXO database because they cannot be automatically pruned; however, it is usually even more preferable to store data outside transactions if possible. +:term:`Null data ` transaction type relayed and mined by default in `Bitcoin Core 0.9.0 `__ and later that adds arbitrary data to a provably unspendable pubkey script that full nodes don’t have to store in their UTXO database. It is preferable to use null data transactions over transactions that bloat the UTXO database because they cannot be automatically pruned; however, it is usually even more preferable to store data outside transactions if possible. Consensus rules allow null data outputs up to the maximum allowed pubkey script size of 10,000 bytes provided they follow all other consensus rules, such as not having any data pushes larger than 520 bytes. @@ -263,15 +263,15 @@ Signature Hash Types :ref:`“OP_CHECKSIG” ` extracts a non-stack argument from each signature it evaluates, allowing the signer to decide which parts of the transaction to sign. Since the signature protects those parts of the transaction from modification, this lets signers selectively choose to let other people modify their transactions. -The various options for what to sign are called :term:`signature hash` types. There are three base SIGHASH types currently available: +The various options for what to sign are called :term:`signature hash ` types. There are three base SIGHASH types currently available: -- :term:`“SIGHASH_ALL” `, the default, signs all the inputs and outputs, protecting everything except the signature scripts against modification. +- :term:`“SIGHASH_ALL” `, the default, signs all the inputs and outputs, protecting everything except the signature scripts against modification. -- :term:`“SIGHASH_NONE” ` signs all of the inputs but none of the outputs, allowing anyone to change where the satoshis are going unless other signatures using other signature hash flags protect the outputs. +- :term:`“SIGHASH_NONE” ` signs all of the inputs but none of the outputs, allowing anyone to change where the satoshis are going unless other signatures using other signature hash flags protect the outputs. -- :term:`“SIGHASH_SINGLE” ` the only output signed is the one corresponding to this input (the output with the same :ref:`output index ` number as this input), ensuring nobody can change your part of the transaction but allowing other signers to change their part of the transaction. The corresponding output must exist or the value “1” will be signed, breaking the security scheme. This input, as well as other inputs, are included in the signature. The sequence numbers of other inputs are not included in the signature, and can be updated. +- :term:`“SIGHASH_SINGLE” ` the only output signed is the one corresponding to this input (the output with the same :ref:`output index ` number as this input), ensuring nobody can change your part of the transaction but allowing other signers to change their part of the transaction. The corresponding output must exist or the value “1” will be signed, breaking the security scheme. This input, as well as other inputs, are included in the signature. The sequence numbers of other inputs are not included in the signature, and can be updated. -The base types can be modified with the :term:`“SIGHASH_ANYONECANPAY” ` (anyone can pay) flag, creating three new combined types: +The base types can be modified with the :term:`“SIGHASH_ANYONECANPAY” ` (anyone can pay) flag, creating three new combined types: - ``SIGHASH_ALL|SIGHASH_ANYONECANPAY`` signs all of the outputs but only this one input, and it also allows anyone to add or remove other inputs, so anyone can contribute additional satoshis but they cannot change how many satoshis are sent nor where they go. @@ -284,7 +284,7 @@ Because each input is signed, a transaction with multiple inputs can have multip Locktime And Sequence Number ---------------------------- -One thing all signature hash types sign is the transaction’s :term:`locktime`. (Called nLockTime in the Bitcoin Core source code.) The locktime indicates the earliest time a transaction can be added to the block chain. +One thing all signature hash types sign is the transaction’s :term:`locktime `. (Called nLockTime in the Bitcoin Core source code.) The locktime indicates the earliest time a transaction can be added to the block chain. Locktime allows signers to create time-locked transactions which will only become valid in the future, giving the signers a chance to change their minds. @@ -292,7 +292,7 @@ If any of the signers change their mind, they can create a new non-locktime tran Care must be taken near the expiry time of a time lock. The `peer-to-peer network <../devguide/p2p_network.html>`__ allows block time to be up to two hours ahead of real time, so a locktime transaction can be added to the block chain up to two hours before its time lock officially expires. Also, blocks are not created at guaranteed intervals, so any attempt to cancel a valuable transaction should be made a few hours before the time lock expires. -Previous versions of Bitcoin Core provided a feature which prevented transaction signers from using the method described above to cancel a time-locked transaction, but a necessary part of this feature was disabled to prevent denial of service attacks. A legacy of this system are four-byte :term:`sequence numbers ` in every input. Sequence numbers were meant to allow multiple signers to agree to update a transaction; when they finished updating the transaction, they could agree to set every input’s sequence number to the four-byte unsigned maximum (0xffffffff), allowing the transaction to be added to a block even if its time lock had not expired. +Previous versions of Bitcoin Core provided a feature which prevented transaction signers from using the method described above to cancel a time-locked transaction, but a necessary part of this feature was disabled to prevent denial of service attacks. A legacy of this system are four-byte :term:`sequence numbers ` in every input. Sequence numbers were meant to allow multiple signers to agree to update a transaction; when they finished updating the transaction, they could agree to set every input’s sequence number to the four-byte unsigned maximum (0xffffffff), allowing the transaction to be added to a block even if its time lock had not expired. Even today, setting all sequence numbers to 0xffffffff (the default in Bitcoin Core) can still disable the time lock, so if you want to use locktime, at least one input must have a sequence number below the maximum. Since sequence numbers are not used by the `network <../devguide/p2p_network.html>`__ for any other purpose, setting any sequence number to zero is sufficient to enable locktime. @@ -305,17 +305,17 @@ Locktime itself is an unsigned 4-byte integer which can be parsed two ways: Transaction Fees And Change --------------------------- -Transactions pay fees based on the total byte size of the signed transaction. Fees per byte are calculated based on current demand for space in mined blocks with fees rising as demand increases. The transaction fee is given to the Bitcoin miner, as explained in the `block chain section <../devguide/blockchain.html>`__, and so it is ultimately up to each miner to choose the minimum transaction fee they will accept. +Transactions pay fees based on the total byte size of the signed transaction. Fees per byte are calculated based on current demand for space in mined blocks with fees rising as demand increases. The transaction fee is given to the Bitcoin miner, as explained in the `block chain section <../devguide/block_chain.html>`__, and so it is ultimately up to each miner to choose the minimum transaction fee they will accept. -There is also a concept of so-called “:term:`high-priority transactions `” which spend satoshis that have not moved for a long time. +There is also a concept of so-called “:term:`high-priority transactions `” which spend satoshis that have not moved for a long time. In the past, these “priority” transaction were often exempt from the normal fee requirements. Before Bitcoin Core 0.12, 50 KB of each block would be reserved for these high-priority transactions, however this is now set to 0 KB by default. After the priority area, all transactions are prioritized based on their fee per byte, with higher-paying transactions being added in sequence until all of the available space is filled. -As of Bitcoin Core 0.9, a :term:`minimum fee ` (currently 1,000 satoshis) has been required to broadcast a transaction across the `network <../devguide/p2p_network.html>`__. Any transaction paying only the minimum fee should be prepared to wait a long time before there’s enough spare space in a block to include it. Please see the `verifying payment section <../devguide/payment_processing.html#verifying-payment>`__ for why this could be important. +As of Bitcoin Core 0.9, a :term:`minimum fee ` (currently 1,000 satoshis) has been required to broadcast a transaction across the `network <../devguide/p2p_network.html>`__. Any transaction paying only the minimum fee should be prepared to wait a long time before there’s enough spare space in a block to include it. Please see the `verifying payment section <../devguide/payment_processing.html#verifying-payment>`__ for why this could be important. Since each transaction spends Unspent Transaction Outputs (UTXOs) and because a UTXO can only be spent once, the full value of the included UTXOs must be spent or given to a miner as a transaction fee. Few people will have UTXOs that exactly match the amount they want to pay, so most transactions include a change output. -:term:`Change outputs ` are regular outputs which spend the surplus satoshis from the UTXOs back to the spender. They can reuse the same P2PKH pubkey hash or P2SH script hash as was used in the UTXO, but for the reasons described in the `next subsection <../transactions.html#avoiding-key-reuse>`__, it is highly recommended that change outputs be sent to a new P2PKH or P2SH address. +:term:`Change outputs ` are regular outputs which spend the surplus satoshis from the UTXOs back to the spender. They can reuse the same P2PKH pubkey hash or P2SH script hash as was used in the UTXO, but for the reasons described in the `next subsection <../devguide/transactions.html#avoiding-key-reuse>`__, it is highly recommended that change outputs be sent to a new P2PKH or P2SH address. Avoiding Key Reuse ------------------ @@ -339,7 +339,7 @@ So, for both privacy and security, we encourage you to build your applications t Transaction Malleability ------------------------ -None of Bitcoin’s signature hash types protect the signature script, leaving the door open for a limited denial of service attack called :term:`transaction malleability`\ {:.term}{:#term-transaction-malleability}. The signature script contains the `secp256k1 `__ signature, which can’t sign itself, allowing attackers to make non-functional modifications to a transaction without rendering it invalid. For example, an attacker can add some data to the signature script which will be dropped before the previous pubkey script is processed. +None of Bitcoin’s signature hash types protect the signature script, leaving the door open for a limited denial of service attack called :term:`transaction malleability `. The signature script contains the `secp256k1 `__ signature, which can’t sign itself, allowing attackers to make non-functional modifications to a transaction without rendering it invalid. For example, an attacker can add some data to the signature script which will be dropped before the previous pubkey script is processed. Although the modifications are non-functional—so they do not change what inputs the transaction uses nor what outputs it pays—they do change the computed hash of the transaction. Since each transaction links to previous transactions using hashes as a transaction identifier (txid), a modified transaction will not have the txid its creator expected. diff --git a/devguide/wallets.rst b/devguide/wallets.rst index c8d8e58..273deeb 100644 --- a/devguide/wallets.rst +++ b/devguide/wallets.rst @@ -132,7 +132,7 @@ Private keys are what are used to unlock satoshis from a particular address. In Wallet Import Format (WIF) ^^^^^^^^^^^^^^^^^^^^^^^^^^ -In order to make copying of private keys less prone to error, :term:`Wallet Import Format ` may be utilized. WIF uses base58Check encoding on a private key, greatly decreasing the chance of copying error, much like standard Bitcoin addresses. +In order to make copying of private keys less prone to error, :term:`Wallet Import Format ` may be utilized. WIF uses base58Check encoding on a private key, greatly decreasing the chance of copying error, much like standard Bitcoin addresses. 1. Take a private key. @@ -205,7 +205,7 @@ Hierarchical Deterministic Key Creation [normal|hardened|] [master|parent|child|grandchild] [extended|non-extended|] [private|public|chain] [key|code] --> -The hierarchical deterministic key creation and transfer protocol (:term:`HD protocol `) greatly simplifies wallet backups, eliminates the need for repeated communication between multiple programs using the same wallet, permits creation of child accounts which can operate independently, gives each parent account the ability to monitor or control its children even if the child account is compromised, and divides each account into full-access and restricted-access parts so untrusted users or programs can be allowed to receive or monitor payments without being able to spend them. +The hierarchical deterministic key creation and transfer protocol (:term:`HD protocol `) greatly simplifies wallet backups, eliminates the need for repeated communication between multiple programs using the same wallet, permits creation of child accounts which can operate independently, gives each parent account the ability to monitor or control its children even if the child account is compromised, and divides each account into full-access and restricted-access parts so untrusted users or programs can be allowed to receive or monitor payments without being able to spend them. The HD protocol takes advantage of the `ECDSA `__ public key creation function, :ref:`“point()” `, which takes a large integer (the private key) and turns it into a graph point (the public key): @@ -213,13 +213,13 @@ The HD protocol takes advantage of the `ECDSA ` works, it’s possible to create a :term:`child public key ` by combining an existing :term:`(parent) public key ` with another public key created from any integer (*i*) value. This child public key is the same public key which would be created by the :ref:`“point()” ` function if you added the *i* value to the original (parent) private key and then found the remainder of that sum divided by a global constant used by all Bitcoin software (*p*): +Because of the way :ref:`“point()” ` works, it’s possible to create a :term:`child public key ` by combining an existing :term:`(parent) public key ` with another public key created from any integer (*i*) value. This child public key is the same public key which would be created by the :ref:`“point()” ` function if you added the *i* value to the original (parent) private key and then found the remainder of that sum divided by a global constant used by all Bitcoin software (*p*): :: point( (parent_private_key + i) % p ) == parent_public_key + point(i) -This means that two or more independent programs which agree on a sequence of integers can create a series of unique :term:`child key` pairs from a single :term:`parent key` pair without any further communication. Moreover, the program which distributes new public keys for receiving payment can do so without any access to the private keys, allowing the public key distribution program to run on a possibly-insecure platform such as a public web server. +This means that two or more independent programs which agree on a sequence of integers can create a series of unique :term:`child key ` pairs from a single :term:`parent key ` pair without any further communication. Moreover, the program which distributes new public keys for receiving payment can do so without any access to the private keys, allowing the public key distribution program to run on a possibly-insecure platform such as a public web server. Child public keys can also create their own child public keys (grandchild public keys) by repeating the child key derivation operations: @@ -229,7 +229,7 @@ Child public keys can also create their own child public keys (grandchild public Whether creating child public keys or further-descended public keys, a predictable sequence of integer values would be no better than using a single public key for all transactions, as anyone who knew one child public key could find all of the other child public keys created from the same parent public key. Instead, a random seed can be used to deterministically generate the sequence of integer values so that the relationship between the child public keys is invisible to anyone without that seed. -The HD protocol uses a single root seed to create a hierarchy of child, grandchild, and other descended keys with unlinkable deterministically-generated integer values. Each child key also gets a deterministically-generated seed from its parent, called a :term:`chain code`, so the compromising of one chain code doesn’t necessarily compromise the integer sequence for the whole hierarchy, allowing the :term:`master chain code` to continue being useful even if, for example, a web-based public key distribution program gets hacked. +The HD protocol uses a single root seed to create a hierarchy of child, grandchild, and other descended keys with unlinkable deterministically-generated integer values. Each child key also gets a deterministically-generated seed from its parent, called a :term:`chain code `, so the compromising of one chain code doesn’t necessarily compromise the integer sequence for the whole hierarchy, allowing the :term:`master chain code ` to continue being useful even if, for example, a web-based public key distribution program gets hacked. .. figure:: /img/dev/en-hd-overview.svg :alt: Overview Of Hierarchical Deterministic Key Derivation @@ -238,9 +238,9 @@ The HD protocol uses a single root seed to create a hierarchy of child, grandchi As illustrated above, HD key derivation takes four inputs: -- The :term:`parent private key ` and *parent public key* are regular uncompressed 256-bit `ECDSA `__ keys. +- The :term:`parent private key ` and *parent public key* are regular uncompressed 256-bit `ECDSA `__ keys. -- The :term:`parent chain code ` is 256 bits of seemingly-random data. +- The :term:`parent chain code ` is 256 bits of seemingly-random data. - The :ref:`index ` number is a 32-bit integer specified by the program. @@ -254,14 +254,14 @@ In the normal form shown in the above illustration, the parent chain code, the p Specifying different index numbers will create different unlinkable child keys from the same parent keys. Repeating the procedure for the child keys using the child chain code will create unlinkable grandchild keys. -Because creating child keys requires both a key and a chain code, the key and chain code together are called the :term:`extended key`. An :term:`extended private key ` and its corresponding :term:`extended public key ` have the same chain code. The (top-level parent) :term:`master private key ` and master chain code are derived from random data, as illustrated below. +Because creating child keys requires both a key and a chain code, the key and chain code together are called the :term:`extended key `. An :term:`extended private key ` and its corresponding :term:`extended public key ` have the same chain code. The (top-level parent) :term:`master private key ` and master chain code are derived from random data, as illustrated below. .. figure:: /img/dev/en-hd-root-keys.svg :alt: Creating A Root Extended Key Pair Creating A Root Extended Key Pair -A :term:`root seed ` is created from either 128 bits, 256 bits, or 512 bits of random data. This root seed of as little as 128 bits is the only data the user needs to backup in order to derive every key created by a particular wallet program using particular settings. +A :term:`root seed ` is created from either 128 bits, 256 bits, or 512 bits of random data. This root seed of as little as 128 bits is the only data the user needs to backup in order to derive every key created by a particular wallet program using particular settings. |Warning icon| **Warning:** As of this writing, HD wallet programs are not expected to be fully compatible, so users must only use the same HD wallet program with the same HD-related settings for a particular root seed. @@ -292,7 +292,7 @@ The normal key derivation formula, described in the section above, combines toge The hardened formula, illustrated above, combines together the index number, the parent chain code, and the parent private key to create the data used to generate the child chain code and child private key. This formula makes it impossible to create child public keys without knowing the parent private key. In other words, parent extended public keys can’t create hardened child public keys. -Because of that, a :term:`hardened extended private key ` is much less useful than a normal extended private key—however, hardened extended private keys create a firewall through which multi-level key derivation compromises cannot happen. Because hardened child extended public keys cannot generate grandchild chain codes on their own, the compromise of a parent extended public key cannot be combined with the compromise of a grandchild private key to create great-grandchild extended private keys. +Because of that, a :term:`hardened extended private key ` is much less useful than a normal extended private key—however, hardened extended private keys create a firewall through which multi-level key derivation compromises cannot happen. Because hardened child extended public keys cannot generate grandchild chain codes on their own, the compromise of a parent extended public key cannot be combined with the compromise of a grandchild private key to create great-grandchild extended private keys. The HD protocol uses different index numbers to indicate whether a normal or hardened key should be generated. Index numbers from 0x00 to 0x7fffffff (0 to 231-1) will generate a normal key; index numbers from 0x80000000 to 0xffffffff will generate a hardened key. To make descriptions easy, many developers use the `prime symbol `__ to indicate hardened keys, so the first normal key (0x00) is 0 and the first hardened key (0x80000000) is 0´. diff --git a/docs/style-guide.md b/docs/style-guide.md new file mode 100644 index 0000000..63b27e8 --- /dev/null +++ b/docs/style-guide.md @@ -0,0 +1,349 @@ +# Style Guide + +For better consistency, this style guide can be used as a reference for +terminology, style and formatting. Suggested changes can also be submitted to +this guide to keep it up to date. + +Below are a series of guidelines, with some parts being mandatory and other +parts being only advisory. You do not need to read it before contributing---the +people reviewing your pull request will let you know if you break any important +rules. + +For all style matters not explicitly covered in this guide, the authority is the +[Wikipedia Manual Of +Style](http://en.wikipedia.org/wiki/Wikipedia%3aManual_of_Style). + +## Audience Description + +Readers will primarily use this guide to build applications that are +interoperable with Bitcoin. Therefore, the reader knows at least one +full-featured programming language fairly well, including standard programming +jargon, and will have received and sent at least one Bitcoin transaction using a +common wallet application. + +Readers will have read programming books before, so they will be prepared to +skim over sections of examples and technical data during their first read, and +will return to those sections of the guide when they need those details for +implementation. + +Readers are not expected to be an expert in any system used by Bitcoin, such as +cryptographic hashing, cryptographic signing, peer-to-peer networking, stack +programming, remote procedure calls, etc. However, readers who do know about +these things will get bored if they must read a lengthy description of them, so +brief descriptions or easy skimming should be emphasized. + +Finally, readers are expected to be motivated to learn, so they do not need to +be entertained or otherwise motivated to keep reading; it is enough to give them +the facts as quickly as possible. + +## Code formatting + +To make this document easier to read, text inside code blocks should be modified +as follows: + +**Shortening strings**: Inside a string, bracket-ellipsis-bracket indicates a +range of consecutive non-whitespace characters were omitted. For example, the +hash of an empty string is e3b0[...]b855. + +**Shortening lists**: On a line by itself, bracket-ellipsis-bracket indicates a +range of consecutive lines were omitted. For example: + +~~~ +$ seq 1 5 +1 +2 +[...] +5 +~~~ + +**Splitting large strings**: When long strings are shown in their entirety, +backslash-newline indicates a single string has been printed across multiple +lines. For example, this is the full version of the first standard transaction +ever made: + +~~~ +0100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25\ +857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f\ +4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd1290\ +9d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b0000000043\ +4104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa2\ +8414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6c\ +d84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a\ +382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b\ +64f9d4c03f999b8643f656b412a3ac00000000 +~~~ + +Try to wrap lines after the 64th character, as shown in the example above. +However, lines of up to 76 characters seem to render correctly in the current +layout, so longer lines are tolerable. When possible, editors should try to +format code so that the bottom scrollbar doesn't appear in the code block. + +**Code Before Descriptions:** when long code blocks are broken up to allow +explanations in HTML paragraphs, the code fragment should come before the +explanation. For example: + +~~~ +> echo "Hello, World!" +~~~ + +Although the command above works in POSIX shell, it doesn't work as expected in +the bash shell because the `!` (bang) character has special meaning. + +~~~ +> echo 'Hello, World!' +~~~~ + +When the bang character is used, it should be escaped or placed in single quotes +to ensure it is interpreted literally. + +*References:* the shortening and spiting conventions were discussed in [an old pull +request](https://github.com/saivann/bitcoin.org/pull/11). Placing code +before descriptions was discussed in another [old pull +request](https://github.com/saivann/bitcoin.org/pull/74). + +## Style + +### Capitalization In Headings, Subheads, Captions, And Abbreviation Expansions + +The first letter of each word in headings, subheadings, captions, and +abbreviation expansions should be capitalized---this includes +prepositions. + +* Heading/Subhead: "Capitalization In Headings, [...]" +* Captions: "Some Of The Data Signed By Default" +* Abbreviation Expansions: "Pay To PubKey Hash (P2PKH)" + +*References:* this style was used without discussion since the first +section of the guide was written and is currently being used to avoid +a major revision for a minor issue. Some discussion was held in [pull +request #589](https://github.com/bitcoin-dot-org/bitcoin.org/pull/589#discussion-diff-18306278), +but a real discussion should be held about changing this before any +major revision of the docs. + +### First Paragraphs + +The first paragraph of an header-level-2 (h2) section in the developer +guide should briefly describe the topic. Subsections do not need to +follow this format, but it wouldn't hurt. + +### Linking + +All links should use Markdown-style reference links, for example: + +~~~ +My favorite Bitcoin library is [bitcoinj]. +~~~ + +Specifically: + +~~~ + [bitcoinj]: http://bitcoinj.org/ +~~~ + +### Hex + +Hexadecimal byte strings should always be prefixed by "0x" and should be +in lowercase. They should otherwise be treated like regular words, such +as adding punctuation after them. For example: 0x0123456789abcdef. +The should not be put inside `code` spans or blocks unless representing +literal program input or output. + +Long hex strings may be broken apart on byte boundaries to improve +readability. For example: 0x0123 4567 89ab cdef. + +Exception: program output or input should be in whatever format the +program uses. + + +### References + +**Internal Figures**: Figures included within the text shall be referred to by +their relative position. This is so the inclusion of a new figure, or the +deletion of an old figure, does not force the re-numbering of all other figures +and figure references. + +* *The figure above shows the block chain*. +* *~~Figure 1 shows the block chain~~*. + +### Default Unit Of Value: Satoshis + +Satoshis are the default unit of value. + +* *I sent him satoshis.* +* *~~I sent him bitcoins.~~* + +## Punctuation + +**Compound adjectives (hyphenation)**: Hyphenate them, unless the first part is +an adverb (ending in "-ly", for example). + +* *A UTXO used in multiple unconfirmed transactions is a likely sign of a double-spend attempt*. +* *Double-spend risk decreases with each confirmation*. +* *~~Successful miners receive a block reward of newly-created bitcoins~~*. + +In these cases, "double-spend" is an adjective that modifies the word that +follows it. However: + +* *Criminals may attempt to double spend bitcoins to avoid payment*. +* *The Bitcoin protocol provides a confidence score as a guide to protect against double spends*. + +**Dashes**: Em dashes should be written as three hyphens---as in this +example---without surrounding spaces. En dashes (which show ranges of +values, such as 1--10) should be written as two hyphens with no +surrounding spaces. Intra-word or connective hyphens should, of course, +be written without any surrounding spaces. + +**Periods**: One space after periods at the end of a sentence in pre-formatted +text. (This does not apply in Markdown or HTML text files.) + +* "Every major style guide---including the Modern Language Association + Style Manual and the Chicago Manual of Style---prescribes a single + space after a period." ---Farhad Manjoo, Slate, + http://www.slate.com/articles/technology/technology/2011/01/space_invaders.html + +### CamelCase Terms + +Within regular text, treat camelCase terms as common nouns by using a lowercase +first letter when not at the start of a sentence. If used in literal code, use +uppercase `CamelCase` as appropriate. + +We do not have a rule for when to use a camelCase term or when to break apart +the camel case into separate words. + +## Glossary + +### Bitcoin + +1. Not capitalized when referring to value or currency. (But satoshi +should be used instead---see Default Unit Of Value section above.) Follow the same rules as for "dollar" and "yen". + * *I spent 0.05 bitcoins at the restaurant*. + * *I love the feeling of bitcoins in my pocket*. +2. Capitalized when referring to something related to bitcoin that's *not* value. In these cases, treat it as if it's a proper name. + * *I was 28 when I became involved in the Bitcoin community*. + * *The Bitcoin white paper was a wake-up call*. + * *The block chain provides Bitcoin's ledger*. +3. Pluralized in normal fashion. + * *I spent 0.05 bitcoins at the restaurant*. + * *I have 3 bitcoins in my wallet*. + * *You can buy my car for 4.5 bitcoins*. +4. Refers only to a specific cryptocurrency. Never use it to refer to other cryptocurrencies, e.g. Litecoin, Dogecoin, etc.. + * *~~My favorite bitcoin is Primecoin~~*. + +### Block chain + +Two words. Ordinary capitalization. + +* *The block chain provides bitcoin’s ledger*. +* *His actions corrupted the block chain*. + +### Bloom Filter + +Although named after Burton Howard Bloom, bloom filter shall be treated as a common noun. + +* *Filterload loads a bloom filter.* +* *~~Filteradd adds a data element to a Bloom filter.~~* + +### Change [output|transaction] + +When referring to the part of a transaction input which is returned to the +spender, “change”, try to use it with a clarifying modifier (as seen in the +examples below) so the word doesn’t get confused with the regular English verb +and noun words, change. + +* *I spent the change transaction*. +* *Always use a new public key for your change output*. +* *You can resend change back to the same address*. + +### Coinbase Transaction (Not Generation Transaction) + +Use "coinbase transaction" instead of "generation transaction" to describe the first transaction in a block. + +* *The coinbase transaction must claim the block subsidy and transaction fees.* +* ~*Pool miners are often paid in generation transactions.*~ + +### Key pair + +Two words. Ordinary capitalization. + +* *A private key and a public are the two parts of a key pair*. + +### Merkle Block + +Two words when not the name of the `merkleblock` message. + +### Merkle [Tree|Root|Leaf|Branch|Link] + +Although named after Ralph Merkle, merkle tree elements are treated as common nouns. + +* *A block header includes a merkle root.* + +*References:* discussed on [pull #589](https://github.com/bitcoin-dot-org/bitcoin.org/pull/589#discussion-diff-18305822) + +### Money + +Avoid using “money” when referring to bitcoin. Use “bitcoin,” “millibit,” +“satoshi,” or some other sub-bitcoin unit instead. + +* *Bitcoin transactions send ~~money~~ satoshis*. + + +### PaymentRequest, PaymentDetails, Payment, PaymentACK + +Messages belonging to the payment protocol. Should always be capitalized and +single words with camelCase as necessary. When not too distracting, they should +be followed by the word "message", as in "PaymentRequest message". In +particular, "Payment" should almost always be followed by "message" to +disambiguate it from generic payments. + +### Pubkey, Signature, And Redeem Scripts + +The various script parts of transactions. Pubkey is capitalized as a +regular common noun (i.e., the K is not capitalized)---exception, when +used in an abbreviation (i.e. P2PKH means Pay-To-PubKey-Hash). + +* *Outputs include a pubkey script.* +* *Inputs include a signature script or a coinbase.* +* *P2SH outputs pay a hashed redeem script.* + +*References:* extensively discussed in pulls [#563](https://github.com/bitcoin-dot-org/bitcoin.org/pull/563) and [#566](https://github.com/bitcoin-dot-org/bitcoin.org/pull/566). + +### Stale Block (Not Orphan Or Orphan Block) + +Blocks which are not part of the most difficult (best) block chain shall be called stale blocks to avoid confusion with true orphan blocks that don't have a known parent block. Accordingly, forms of "orphan" shall not be used as a verb. + +* *After the reorg, it became a stale block.* +* ~*Because of propagation delays, miners produce one to two orphan blocks a week.*~ +* ~*The 0.8.0 blocks were orphaned by the 0.7.x chain.*~ + +*References:* discussed on [pull #589](https://github.com/bitcoin-dot-org/bitcoin.org/pull/589#discussion_r18310486). + +### Standard Transaction & IsStandard() + +A transaction which passes the Bitcoin Core IsStandard() test, indicating that +it will be relayed or mined by default peers and miners. Mainly +Pay-To-PubkeyHash (P2PH) and Pay-To-ScriptHash (P2SH) transaction types. Does +not include genesis transactions. IsStandard() always begins with a capital I, +and always includes the trailing parenthensis. + +* *The first standard transaction appeared in block 170*. +* *It passed the IsStandard() checks.* + +### Timestamp + +One word. Ordinary capitalization. Noun, but can be turned into a verb +(timestamp, timestamped, timestamping...). + +* *The timestamp showed that Gupta's transaction occurred before Smith's*. +* *The block chain provides a timestamped record of all confirmed transactions*. + +## Images + +Information about creating or changing illustrations can be found in [the image README](https://github.com/bitcoin-dot-org/bitcoin.org/blob/master/img/dev/README). + +SVG is the preferred file format for illustrations, but a corresponding +PNG file with the same basename should be created. Bitmap images should +be in PNG unless a special file format is warranted. All PNG images +should be optimized by the command, `optipng -o7 .png` + +(Note: optipng overwrites your original image, so make sure you have a +backup before running it.) diff --git a/examples/payment_processing.rst b/examples/payment_processing.rst index 1c93b49..48d3e13 100644 --- a/examples/payment_processing.rst +++ b/examples/payment_processing.rst @@ -32,7 +32,7 @@ The full sequence of events is illustrated below, starting with the spender clic BIP70 Payment Protocol -For the script to use the `protocol buffer `__, you will need a copy of Google’s `Protocol Buffer `__ compiler (``protoc``), which is available in most modern Linux package managers and `directly from Google. `__ Non-Google `protocol buffer `__ compilers are available for a variety of programming languages. You will also need a copy of the :ref:`PaymentRequest ` `Protocol Buffer description `__ from the Bitcoin Core source code. +For the script to use the `protocol buffer `__, you will need a copy of Google’s `Protocol Buffer `__ compiler (``protoc``), which is available in most modern Linux package managers and `directly from Google. `__ Non-Google `protocol buffer `__ compilers are available for a variety of programming languages. You will also need a copy of the :ref:`PaymentRequest ` `Protocol Buffer description `__ from the Bitcoin Core source code. Initialization Code ''''''''''''''''''' diff --git a/examples/testing.rst b/examples/testing.rst index 430b7d4..a02076c 100644 --- a/examples/testing.rst +++ b/examples/testing.rst @@ -6,7 +6,7 @@ Bitcoin Core provides testing tools designed to let developers test their applic Testnet ~~~~~~~ -When run with no arguments, all Bitcoin Core programs default to Bitcoin’s main `network <../devguide/p2p_network.html>`__ (:term:`mainnet`). However, for development, it’s safer and cheaper to use Bitcoin’s test `network <../devguide/p2p_network.html>`__ (testnet) where the satoshis spent have no real-world value. Testnet also relaxes some restrictions (such as standard transaction checks) so you can test functions which might currently be disabled by default on mainnet. +When run with no arguments, all Bitcoin Core programs default to Bitcoin’s main `network <../devguide/p2p_network.html>`__ (:term:`mainnet `). However, for development, it’s safer and cheaper to use Bitcoin’s test `network <../devguide/p2p_network.html>`__ (testnet) where the satoshis spent have no real-world value. Testnet also relaxes some restrictions (such as standard transaction checks) so you can test functions which might currently be disabled by default on mainnet. To use testnet, use the argument ``-testnet`` with ``bitcoin-cli``, ``bitcoind`` or ``bitcoin-qt`` or add ``testnet=1`` to your ``bitcoin.conf`` file as `described earlier <../examples/index.html>`__. To get free satoshis for testing, use `Piotr Piasecki’s testnet faucet `__. Testnet is a public resource provided for free by members of the community, so please don’t abuse it. diff --git a/examples/transactions.rst b/examples/transactions.rst index 3a8b40b..317bd94 100644 --- a/examples/transactions.rst +++ b/examples/transactions.rst @@ -93,7 +93,7 @@ Re-running the `“listunspent” RPC <../reference/rpc/listunspent.html>`__ wit :: - > bitcoin-cli -regtest generate 1 + > bitcoin-cli -regtest -generate 1 > unset NEW_ADDRESS @@ -303,7 +303,7 @@ Send the signed transaction to the connected node using the `“sendrawtransacti :: - > bitcoin-cli -regtest generate 1 + > bitcoin-cli -regtest -generate 1 > unset UTXO_TXID UTXO_VOUT NEW_ADDRESS RAW_TX SIGNED_RAW_TX diff --git a/glossary.rst b/glossary.rst index d49ca56..3c5c281 100644 --- a/glossary.rst +++ b/glossary.rst @@ -492,4 +492,158 @@ Glossary Watch-only address An address or pubkey script stored in the wallet without the corresponding private key, allowing the wallet to watch for outputs but not spend them. + + Bitcoin URI + A URI which allows receivers to encode payment details so spenders don't have to manually enter addresses and other details. + + Certificate chain + A chain of certificates connecting a individual's leaf certificate to the certificate authority's root certificate. + + Coinbase block height + The current block's height encoded into the first bytes of the coinbase field. + + Fiat + National currencies such as the dollar or euro. + + Intermediate certificate + A intermediate certificate authority certificate which helps connect a leaf (receiver) certificate to a root certificate authority. + + Key index + An index number used in the HD wallet formula to generate child keys from a parent key. + + Key pair + A private key and its derived public key. + + Label + The label parameter of a bitcoin: URI which provides the spender with the receiver's name (unauthenticated). + + Leaf certificate + The end-node in a certificate chain; in the payment protocol, it is the certificate belonging to the receiver of satoshis. + + Merge + Spending, in the same transaction, multiple outputs which can be traced back to different previous spenders, leaking information about how many satoshis you control. + + Merge avoidance + A strategy for selecting which outputs to spend that avoids merging outputs with different histories that could leak private information. + + Message + A parameter of bitcoin: URIs which allows the receiver to optionally specify a message to the spender. + + Micropayment channel + term-micropayment-channel (contracts-guide) (`original target `__) + + .. _term-msg_block: + The block header hash data type identifier of an inventory on the P2P network. + + .. _term-msg_cmpct_block: + An alternative to the block header hash data type identifier of an inventory on the P2P network used to request a compact block. + + .. _term-msg_filtered_witness_block: + An alternative to the block header hash data type identifier of an inventory on the P2P network that is reserved for future use and unused. + + .. _term-msg_tx: + The TXID data type identifier of an inventory on the P2P network. + + .. _term-msg_witness_block: + An alternative to the block header hash data type identifier of an inventory on the P2P network used to request a block with witness serialization for SegWit. + + .. _term-msg_witness_tx: + An alternative of the transaction data type identifier of an inventory on the P2P network used to request a transaction with witness serialization for SegWit. + + OP CHECKMULTISIG + Opcode which returns true if one or more provided signatures (m) sign the correct parts of a transaction and match one or more provided public keys (n). + + .. _term-op-checksig: + Opcode which returns true if a signature signs the correct parts of a transaction and matches a provided public key. + + .. _term-op-dup: + Operation which duplicates the entry below it on the stack. + + .. _term-op-equal: + Operation which returns true if the two entries below it on the stack are equivalent. + + .. _term-op-equalverify: + Operation which terminates the script in failure unless the two entries below it on the stack are equivalent. + + .. _term-op-hash160: + Operation which converts the entry below it on the stack into a RIPEMD(SHA256()) hashed version of itself. + + .. _term-op-return: + Operation which terminates the script in failure. + + .. _term-op-verify: + Operation which terminates the script if the entry below it on the stack is non-true (zero). + + Output index + The sequentially-numbered index of outputs in a single transaction starting from 0. + + .. _term-paymentdetails: + The PaymentDetails of the payment protocol which allows the receiver to specify the payment details to the spender. + + .. _term-paymentrequest: + The PaymentRequest of the payment protocol which contains and allows signing of the PaymentDetails. + + PKI + Public Key Infrastructure; usually meant to indicate the X.509 certificate system used for HTTP Secure (https). + + Point function + The ECDSA function used to create a public key from a private key. + + PP amount + Part of the Output part of the PaymentDetails part of a payment protocol where receivers can specify the amount of satoshis they want paid to a particular pubkey script. + + PP expires + The expires field of a PaymentDetails where the receiver tells the spender when the PaymentDetails expires. + + PP memo + The memo fields of PaymentDetails, Payment, and PaymentACK which allow spenders and receivers to send each other memos. + + PP merchant data + The merchant_data part of PaymentDetails and Payment which allows the receiver to send arbitrary data to the spender in PaymentDetails and receive it back in Payments. + + PP pki data + The pki_data field of a PaymentRequest which provides details such as certificates necessary to validate the request. + + PP pki type + The PKI field of a PaymentRequest which tells spenders how to validate this request as being from a specific recipient. + + PP script + The script field of a PaymentDetails where the receiver tells the spender what pubkey scripts to pay. + + Previous block header hash + A field in the block header which contains the SHA256(SHA256()) hash of the previous block's header. + + R parameter + The payment request parameter in a bitcoin: URI. + + Receipt + A cryptographically-verifiable receipt created using parts of a payment request and a confirmed transaction. + + Root certificate + A certificate belonging to a certificate authority (CA). + + SSL signature + Signatures created and recognized by major SSL implementations such as OpenSSL. + + Stanndard block relay + The regular block relay method: announcing a block with an inv message and waiting for a response. + + Transaction version number + A version number prefixed to transactions to allow upgrading. + + Unique Address + Address which are only used once to protect privacy and increase security. + + Unsolicited block push + When a miner sends a block message without sending an inv message first. + + URI qr code + A QR code containing a bitcoin: URI. + + V2 block + The current version of Bitcoin blocks. + + x509certificates + + term-x509certificates (developer-examples) (`original target `__) diff --git a/helpers/post_processor_rst.rb b/helpers/post_processor_rst.rb index 4269b1b..8eb0f72 100644 --- a/helpers/post_processor_rst.rb +++ b/helpers/post_processor_rst.rb @@ -180,7 +180,7 @@ def process_link(link) elsif target =~ /\/en\/developer-reference/ replace_reference_link(text, target) elsif target == "#avoiding-key-reuse" - "`#{text} <../transactions.html#avoiding-key-reuse>`__" + "`#{text} <../devguide/transactions.html#avoiding-key-reuse>`__" elsif target =~ /\/en\/release\/(.*)/ "`#{text} `__" elsif target =~ /\/en\/download/ diff --git a/helpers/rpc/.gitignore b/helpers/rpc/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/helpers/rpc/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/helpers/rpc/LICENSE b/helpers/rpc/LICENSE new file mode 100644 index 0000000..e6b8224 --- /dev/null +++ b/helpers/rpc/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Cornelius Schumacher + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/helpers/rpc/README.md b/helpers/rpc/README.md new file mode 100644 index 0000000..3bb5836 --- /dev/null +++ b/helpers/rpc/README.md @@ -0,0 +1,7 @@ +This repository contains a tool to generate Bitcoin Core RPC documentation. It +requires a running `bitcoin-cli` client and puts out the documentation in +Markdown format as used on [bitcoin.org](https://github.com/bitcoin-dot-org/bitcoin.org/tree/master/_data/devdocs/en/bitcoin-core/rpcs). + +Run `rpc-docs-helper` to get command line help. Run `rpc-docs-helper generate` +to generate the markdown. Run `pytest` to run the unit tests if you want to work +on the tool itself. diff --git a/helpers/rpc/TODO.md b/helpers/rpc/TODO.md new file mode 100644 index 0000000..01788d1 --- /dev/null +++ b/helpers/rpc/TODO.md @@ -0,0 +1,32 @@ +# RPC helper To do + +* Add command to add deprecation notice and deprecate getbalance, getunconfirmedbalance in 0.19 + +* Remove markdown support + * Remove renderer + * Remove helper subcommands which rely on markdown files + +* Add command to add "see also" and add references, e.g. in importaddress, importmulti, importprivkey, importpubkey, importwallet, rescanblockchain, walletprocesspsbt + +* Fix description + * gettxoutproof (first line cut off before "txids") + +* Fix result + * importmulti (include example output) + +* Fix examples in description + * deriveaddresses + * scantxoutset + +* Fix arguments + * sighashtype parameter table + * signrawtransactionwithwallet + * walletprocesspsbt + * multi-line argument description + * listsinceblock (include_removed) + +* Results of example commands + (https://github.com/cornelius/rpc-docs-helper/issues/4) + * Check how many commands have example results and how many are up to date + * Recreate current state with manually edited annotations file + * Look into auto-generating example results diff --git a/helpers/rpc/annotations-bitcoin-0.17.json b/helpers/rpc/annotations-bitcoin-0.17.json new file mode 100644 index 0000000..c232349 --- /dev/null +++ b/helpers/rpc/annotations-bitcoin-0.17.json @@ -0,0 +1,931 @@ +{ + "abandontransaction": { + "added": "0.12.0", + "args": { + "txid": { + "type": "hex" + } + }, + "see_also": { + "commands": [ + "sendrawtransaction" + ] + }, + "summary": "marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent." + }, + "abortrescan": { + "summary": "Stops current wallet rescan" + }, + "addmultisigaddress": { + "see_also": { + "commands": [ + "createmultisig", + "decodescript" + ], + "glossary": [ + [ + "p2sh-address", + "Pay-To-Script-Hash (P2SH)" + ] + ] + }, + "summary": "adds a P2SH multisig address to the wallet.", + "wallet": true + }, + "addnode": { + "args": { + "command": { + "description": "What to do with the IP address above. Options are:
\u2022 `add` to add a node to the addnode list. Up to 8 nodes can be added additional to the default 8 nodes. Not limited by `-maxconnections`
\u2022 `remove` to remove a node from the list. If currently connected, this will disconnect immediately
\u2022 `onetry` to immediately attempt connection to the node even if the outgoing connection slots are full; this will only attempt the connection once" + }, + "node": { + "description": "The node to add as a string in the form of `:`. The IP address may be a hostname resolvable through DNS, an IPv4 address, an IPv4-as-IPv6 address, or an IPv6 address" + } + }, + "changed": "0.14.0", + "see_also": { + "commands": [ + "getaddednodeinfo" + ] + } + }, + "backupwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importwallet" + ] + }, + "wallet": true + }, + "bumpfee": { + "added": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "fundrawtransaction", + "signrawtransaction", + "sendrawtransaction" + ] + } + }, + "clearbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "setban" + ] + } + }, + "createmultisig": { + "see_also": { + "commands": [ + "addmultisigaddress", + "decodescript" + ] + } + }, + "createrawtransaction": { + "changed": "0.14.1", + "see_also": { + "commands": [ + "decoderawtransaction", + "signrawtransaction", + "sendrawtransaction" + ] + } + }, + "decoderawtransaction": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "createrawtransaction", + "signrawtransaction", + "sendrawtransaction" + ] + } + }, + "decodescript": { + "see_also": { + "commands": [ + "createmultisig" + ] + } + }, + "disconnectnode": { + "added": "0.12.0", + "changed": "0.14.1", + "see_also": { + "commands": [ + "addnode", + "getaddednodeinfo" + ] + } + }, + "dumpprivkey": { + "see_also": { + "commands": [ + "importprivkey", + "dumpwallet" + ] + } + }, + "dumpwallet": { + "see_also": { + "commands": [ + "backupwallet", + "importwallet" + ] + } + }, + "encryptwallet": { + "see_also": { + "commands": [ + "walletpassphrase", + "walletlock", + "walletpassphrasechange" + ] + } + }, + "estimatefee": { + "see_also": { + "commands": [ + "settxfee" + ] + } + }, + "estimatepriority": { + "see_also": { + "commands": [ + "estimatefee" + ] + } + }, + "fundrawtransaction": { + "added": "0.12.0", + "changed": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction", + "signrawtransaction", + "sendrawtransaction" + ] + } + }, + "generate": { + "added": "0.11.0", + "changed": "0.13.0", + "see_also": { + "commands": [ + "generatetoaddress", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "generatetoaddress": { + "added": "0.13.0", + "see_also": { + "commands": [ + "generate", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "getaccount": { + "see_also": { + "commands": [ + "getaddressesbyaccount" + ] + } + }, + "getaccountaddress": { + "deprecated": true, + "see_also": { + "commands": [ + "getnewaddress", + "getrawchangeaddress", + "getaddressesbyaccount" + ] + } + }, + "getaddednodeinfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "addnode", + "getpeerinfo" + ] + } + }, + "getaddressbyaccount": { + "deprecated": true + }, + "getaddressesbyaccount": { + "see_also": { + "commands": [ + "getaccount", + "getbalance" + ] + } + }, + "getbalance": { + "see_also": { + "commands": [ + "listaccounts", + "getreceivedbyaccount", + "getreceivedbyaddress" + ] + } + }, + "getbestblockhash": { + "see_also": { + "commands": [ + "getblock", + "getblockhash" + ] + } + }, + "getblock": { + "args": { + "blockhash": { + "type": "hex" + } + }, + "changed": "0.13.0", + "see_also": { + "commands": [ + "getblockhash", + "getbestblockhash" + ] + }, + "summary": "gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." + }, + "getblockchaininfo": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getblockcount": { + "see_also": { + "commands": [ + "getblockhash", + "getblock" + ] + } + }, + "getblockhash": { + "see_also": { + "commands": [ + "getblock", + "getbestblockhash" + ] + } + }, + "getblockheader": { + "added": "0.12.0", + "see_also": { + "commands": [ + "getblock", + "getblockhash", + "getbestblockhash" + ] + } + }, + "getblocktemplate": { + "see_also": { + "commands": [ + "setgenerate", + "getmininginfo", + "submitblock", + "prioritisetransaction" + ] + } + }, + "getchaintips": { + "see_also": { + "commands": [ + "getbestblockhash", + "getblock", + "getblockchaininfo" + ] + } + }, + "getconnectioncount": { + "see_also": { + "commands": [ + "getnettotals", + "getpeerinfo", + "getnetworkinfo" + ] + } + }, + "getdifficulty": { + "see_also": { + "commands": [ + "getnetworkhashps", + "getmininginfo" + ] + } + }, + "getgenerate": { + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo" + ] + } + }, + "gethashespersec": { + "see_also": { + "commands": [ + "generate", + "getmininginfo" + ] + } + }, + "getinfo": { + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo", + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getmemoryinfo": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo" + ] + } + }, + "getmempoolancestors": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempooldescendants": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getrawmempool" + ] + } + }, + "getmempoolentry": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempoolinfo": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getblockchaininfo", + "getrawmempool", + "gettxoutsetinfo" + ] + } + }, + "getmininginfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getrawmempool", + "getblocktemplate", + "generate" + ] + } + }, + "getnettotals": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getnetworkinfo", + "getpeerinfo" + ] + } + }, + "getnetworkhashps": { + "see_also": { + "commands": [ + "getdifficulty", + "getblock" + ] + } + }, + "getnetworkinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getpeerinfo", + "getnettotals" + ] + } + }, + "getnewaddress": { + "see_also": { + "commands": [ + "getaccountaddress", + "getrawchangeaddress", + "getbalance" + ] + } + }, + "getpeerinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getaddednodeinfo", + "getnettotals", + "getnetworkinfo" + ] + } + }, + "getrawchangeaddress": { + "see_also": { + "commands": [ + "getnewaddress", + "getaccountaddress" + ] + } + }, + "getrawmempool": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getmempoolentry", + "gettxoutsetinfo" + ] + } + }, + "getrawtransaction": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "gettransaction" + ] + } + }, + "getreceivedbyaccount": { + "deprecated": true, + "see_also": { + "commands": [ + "getreceivedbyaddress", + "getaddressesbyaccount", + "listaccounts" + ] + } + }, + "getreceivedbyaddress": { + "see_also": { + "commands": [ + "getreceivedbyaccount", + "getaddressesbyaccount", + "listaccounts" + ] + } + }, + "gettransaction": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getrawtransaction" + ] + } + }, + "gettxout": { + "see_also": { + "commands": [ + "getrawtransaction", + "gettransaction" + ] + } + }, + "gettxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "verifytxoutproof" + ], + "messages": [ + [ + "merkleblock", + "A description of the\n format used for the proof." + ] + ] + } + }, + "gettxoutsetinfo": { + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo" + ] + } + }, + "getunconfirmedbalance": { + "see_also": { + "commands": [ + "getbalance" + ] + } + }, + "getwalletinfo": { + "see_also": { + "commands": [ + "listtransactions" + ] + } + }, + "getwork": { + "see_also": { + "commands": [ + "getblocktemplate", + "submitblock" + ] + } + }, + "importaddress": { + "see_also": { + "commands": [ + "importprivkey", + "listreceivedbyaddress" + ] + } + }, + "importmulti": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprivkey": { + "see_also": { + "commands": [ + "dumpprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "removeprunedfunds" + ] + } + }, + "importwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importprivkey" + ] + } + }, + "keypoolrefill": { + "see_also": { + "commands": [ + "getnewaddress", + "getaccountaddress", + "getwalletinfo" + ] + } + }, + "listaccounts": { + "deprecated": true, + "see_also": { + "commands": [ + "getaccount", + "getaddressesbyaccount", + "listreceivedbyaccount" + ] + } + }, + "listaddressgroupings": { + "see_also": { + "commands": [ + "getaddressesbyaccount", + "gettransaction" + ] + } + }, + "listbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "setban", + "clearbanned" + ] + } + }, + "listlockunspent": { + "see_also": { + "commands": [ + "lockunspent" + ] + } + }, + "listreceivedbyaccount": { + "deprecated": true, + "see_also": { + "commands": [ + "listreceivedbyaddress", + "getreceivedbyaccount", + "getreceivedbyaddress" + ] + } + }, + "listreceivedbyaddress": { + "see_also": { + "commands": [ + "listreceivedbyaccount", + "getreceivedbyaddress", + "getreceivedbyaccount" + ] + } + }, + "listsinceblock": { + "see_also": { + "commands": [ + "listreceivedbyaccount", + "listreceivedbyaddress" + ] + } + }, + "listtransactions": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "gettransaction", + "listsinceblock" + ] + } + }, + "listunspent": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "listtransactions", + "lockunspent" + ] + } + }, + "lockunspent": { + "see_also": { + "commands": [ + "listlockunspent", + "listunspent" + ] + } + }, + "move": { + "deprecated": true, + "see_also": { + "commands": [ + "listaccounts", + "sendfrom", + "sendtoaddress" + ] + } + }, + "ping": { + "see_also": { + "commands": [ + "getpeerinfo" + ] + } + }, + "preciousblock": { + "added": "0.14.0" + }, + "prioritisetransaction": { + "see_also": { + "commands": [ + "getrawmempool", + "getblocktemplate" + ] + } + }, + "pruneblockchain": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprunedfunds" + ] + } + }, + "removeprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "importprunedfunds" + ] + } + }, + "sendfrom": { + "deprecated": true, + "see_also": { + "commands": [ + "sendtoaddress", + "sendmany" + ] + } + }, + "sendmany": { + "see_also": { + "commands": [ + "sendfrom", + "sendtoaddress", + "move" + ] + } + }, + "sendrawtransaction": { + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction", + "signrawtransaction" + ] + } + }, + "sendtoaddress": { + "see_also": { + "commands": [ + "sendfrom", + "sendmany", + "move" + ] + } + }, + "setaccount": { + "deprecated": true, + "see_also": { + "commands": [ + "getaccount", + "listaccounts", + "getaddressesbyaccount" + ] + } + }, + "setban": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "clearbanned" + ] + } + }, + "setgenerate": { + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "setnetworkactive": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getnetworkinfo" + ] + } + }, + "settxfee": { + "see_also": { + "commands": [ + "getwalletinfo", + "getnetworkinfo" + ] + } + }, + "signmessage": { + "see_also": { + "commands": [ + "signmessagewithprivkey", + "verifymessage" + ] + } + }, + "signmessagewithprivkey": { + "added": "0.13.0", + "see_also": { + "commands": [ + "signmessage", + "verifymessage" + ] + } + }, + "signrawtransaction": { + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction", + "sendrawtransaction" + ] + } + }, + "submitblock": { + "see_also": { + "commands": [ + "getblocktemplate" + ] + } + }, + "validateaddress": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "importaddress", + "getnewaddress" + ] + } + }, + "verifychain": { + "see_also": { + "commands": [ + "getblockchaininfo", + "gettxoutsetinfo" + ] + } + }, + "verifymessage": { + "see_also": { + "commands": [ + "signmessage" + ] + } + }, + "verifytxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "gettxoutproof" + ] + } + }, + "walletlock": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletpassphrasechange" + ] + } + }, + "walletpassphrase": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrasechange", + "walletlock" + ] + } + }, + "walletpassphrasechange": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletlock" + ] + } + } +} \ No newline at end of file diff --git a/helpers/rpc/annotations-bitcoin-0.18.json b/helpers/rpc/annotations-bitcoin-0.18.json new file mode 100644 index 0000000..18a565b --- /dev/null +++ b/helpers/rpc/annotations-bitcoin-0.18.json @@ -0,0 +1,913 @@ +{ + "abandontransaction": { + "added": "0.12.0", + "args": { + "txid": { + "type": "hex" + } + }, + "see_also": { + "commands": [ + "sendrawtransaction" + ] + }, + "summary": "marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent." + }, + "abortrescan": { + "summary": "Stops current wallet rescan" + }, + "addmultisigaddress": { + "see_also": { + "commands": [ + "createmultisig", + "decodescript" + ], + "glossary": [ + [ + "p2sh-address", + "Pay-To-Script-Hash (P2SH)" + ] + ] + }, + "summary": "adds a P2SH multisig address to the wallet.", + "wallet": true + }, + "addnode": { + "args": { + "command": { + "description": "What to do with the IP address above. Options are:
\u2022 `add` to add a node to the addnode list. Up to 8 nodes can be added additional to the default 8 nodes. Not limited by `-maxconnections`
\u2022 `remove` to remove a node from the list. If currently connected, this will disconnect immediately
\u2022 `onetry` to immediately attempt connection to the node even if the outgoing connection slots are full; this will only attempt the connection once" + }, + "node": { + "description": "The node to add as a string in the form of `:`. The IP address may be a hostname resolvable through DNS, an IPv4 address, an IPv4-as-IPv6 address, or an IPv6 address" + } + }, + "changed": "0.14.0", + "see_also": { + "commands": [ + "getaddednodeinfo" + ] + } + }, + "addwitnessaddress": { + "deprecated": "0.16.0", + "removed": "0.17.0" + }, + "analyzepsbt": { + "added": "0.18.0" + }, + "backupwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importwallet" + ] + }, + "wallet": true + }, + "bumpfee": { + "added": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "fundrawtransaction", + "sendrawtransaction" + ] + } + }, + "clearbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "setban" + ] + } + }, + "createmultisig": { + "see_also": { + "commands": [ + "addmultisigaddress", + "decodescript" + ] + } + }, + "createrawtransaction": { + "changed": "0.14.1", + "see_also": { + "commands": [ + "decoderawtransaction", + "sendrawtransaction" + ] + } + }, + "decoderawtransaction": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "createrawtransaction", + "sendrawtransaction" + ] + } + }, + "decodescript": { + "see_also": { + "commands": [ + "createmultisig" + ] + } + }, + "deriveaddresses": { + "added": "0.18.0" + }, + "disconnectnode": { + "added": "0.12.0", + "changed": "0.14.1", + "see_also": { + "commands": [ + "addnode", + "getaddednodeinfo" + ] + } + }, + "dumpprivkey": { + "see_also": { + "commands": [ + "importprivkey", + "dumpwallet" + ] + } + }, + "dumpwallet": { + "see_also": { + "commands": [ + "backupwallet", + "importwallet" + ] + } + }, + "encryptwallet": { + "see_also": { + "commands": [ + "walletpassphrase", + "walletlock", + "walletpassphrasechange" + ] + } + }, + "estimatefee": { + "deprecated": "0.15.0", + "removed": "0.17.0", + "see_also": { + "commands": [ + "settxfee" + ] + } + }, + "estimatepriority": { + "removed": "0.15.0" + }, + "fundrawtransaction": { + "added": "0.12.0", + "changed": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction", + "sendrawtransaction" + ] + } + }, + "generate": { + "added": "0.11.0", + "changed": "0.13.0", + "deprecated": "0.18.0", + "see_also": { + "commands": [ + "generatetoaddress", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "generatetoaddress": { + "added": "0.13.0", + "see_also": { + "commands": [ + "generate", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "getaccount": { + "removed": "0.18.0" + }, + "getaccountaddress": { + "deprecated": true, + "removed": "0.18.0" + }, + "getaddednodeinfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "addnode", + "getpeerinfo" + ] + } + }, + "getaddressbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "getaddressesbyaccount": { + "removed": "0.18.0", + "see_also": { + "commands": [ + "getbalance" + ] + } + }, + "getaddressesbylabel": { + "added": "0.17.0" + }, + "getaddressinfo": { + "added": "0.17.0" + }, + "getbalance": { + "see_also": { + "commands": [ + "getreceivedbyaddress" + ] + } + }, + "getbestblockhash": { + "see_also": { + "commands": [ + "getblock", + "getblockhash" + ] + } + }, + "getblock": { + "args": { + "blockhash": { + "type": "hex" + } + }, + "changed": "0.13.0", + "see_also": { + "commands": [ + "getblockhash", + "getbestblockhash" + ] + }, + "summary": "gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." + }, + "getblockchaininfo": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getblockcount": { + "see_also": { + "commands": [ + "getblockhash", + "getblock" + ] + } + }, + "getblockhash": { + "see_also": { + "commands": [ + "getblock", + "getbestblockhash" + ] + } + }, + "getblockheader": { + "added": "0.12.0", + "see_also": { + "commands": [ + "getblock", + "getblockhash", + "getbestblockhash" + ] + } + }, + "getblocktemplate": { + "see_also": { + "commands": [ + "getmininginfo", + "submitblock", + "prioritisetransaction" + ] + } + }, + "getchaintips": { + "see_also": { + "commands": [ + "getbestblockhash", + "getblock", + "getblockchaininfo" + ] + } + }, + "getconnectioncount": { + "see_also": { + "commands": [ + "getnettotals", + "getpeerinfo", + "getnetworkinfo" + ] + } + }, + "getdescriptorinfo": { + "added": "0.18.0" + }, + "getdifficulty": { + "see_also": { + "commands": [ + "getnetworkhashps", + "getmininginfo" + ] + } + }, + "getgenerate": { + "removed": "0.13.0", + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo" + ] + } + }, + "gethashespersec": { + "removed": "0.11.0", + "see_also": { + "commands": [ + "generate", + "getmininginfo" + ] + } + }, + "getinfo": { + "removed": "0.16.0", + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo", + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getmemoryinfo": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo" + ] + } + }, + "getmempoolancestors": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempooldescendants": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getrawmempool" + ] + } + }, + "getmempoolentry": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempoolinfo": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getblockchaininfo", + "getrawmempool", + "gettxoutsetinfo" + ] + } + }, + "getmininginfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getrawmempool", + "getblocktemplate", + "generate" + ] + } + }, + "getnettotals": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getnetworkinfo", + "getpeerinfo" + ] + } + }, + "getnetworkhashps": { + "see_also": { + "commands": [ + "getdifficulty", + "getblock" + ] + } + }, + "getnetworkinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getpeerinfo", + "getnettotals" + ] + } + }, + "getnewaddress": { + "see_also": { + "commands": [ + "getrawchangeaddress", + "getbalance" + ] + } + }, + "getnodeaddresses": { + "added": "0.18.0" + }, + "getpeerinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getaddednodeinfo", + "getnettotals", + "getnetworkinfo" + ] + } + }, + "getrawchangeaddress": { + "see_also": { + "commands": [ + "getnewaddress" + ] + } + }, + "getrawmempool": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getmempoolentry", + "gettxoutsetinfo" + ] + } + }, + "getrawtransaction": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "gettransaction" + ] + } + }, + "getreceivedbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "getreceivedbyaddress": {}, + "getreceivedbylabel": { + "added": "0.17.0" + }, + "getrpcinfo": { + "added": "0.18.0" + }, + "gettransaction": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getrawtransaction" + ] + } + }, + "gettxout": { + "see_also": { + "commands": [ + "getrawtransaction", + "gettransaction" + ] + } + }, + "gettxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "verifytxoutproof" + ], + "messages": [ + [ + "merkleblock", + "A description of the\n format used for the proof." + ] + ] + } + }, + "gettxoutsetinfo": { + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo" + ] + } + }, + "getunconfirmedbalance": { + "see_also": { + "commands": [ + "getbalance" + ] + } + }, + "getwalletinfo": { + "see_also": { + "commands": [ + "listtransactions" + ] + } + }, + "getwork": { + "removed": "0.10.0", + "see_also": { + "commands": [ + "getblocktemplate", + "submitblock" + ] + } + }, + "importaddress": { + "see_also": { + "commands": [ + "importprivkey", + "listreceivedbyaddress" + ] + } + }, + "importmulti": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprivkey": { + "see_also": { + "commands": [ + "dumpprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "removeprunedfunds" + ] + } + }, + "importwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importprivkey" + ] + } + }, + "joinpsbts": { + "added": "0.18.0" + }, + "keypoolrefill": { + "see_also": { + "commands": [ + "getnewaddress", + "getwalletinfo" + ] + } + }, + "listaccounts": { + "deprecated": true, + "removed": "0.18.0" + }, + "listaddressgroupings": { + "see_also": { + "commands": [ + "gettransaction" + ] + } + }, + "listbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "setban", + "clearbanned" + ] + } + }, + "listlabels": { + "added": "0.17.0" + }, + "listlockunspent": { + "see_also": { + "commands": [ + "lockunspent" + ] + } + }, + "listreceivedbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "listreceivedbyaddress": { + "see_also": { + "commands": [ + "getreceivedbyaddress" + ] + } + }, + "listreceivedbylabel": { + "added": "0.17.0" + }, + "listsinceblock": { + "see_also": { + "commands": [ + "listreceivedbyaddress" + ] + } + }, + "listtransactions": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "gettransaction", + "listsinceblock" + ] + } + }, + "listunspent": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "listtransactions", + "lockunspent" + ] + } + }, + "listwalletdir": { + "added": "0.18.0" + }, + "lockunspent": { + "see_also": { + "commands": [ + "listlockunspent", + "listunspent" + ] + } + }, + "move": { + "deprecated": true, + "removed": "0.18.0" + }, + "ping": { + "see_also": { + "commands": [ + "getpeerinfo" + ] + } + }, + "preciousblock": { + "added": "0.14.0" + }, + "prioritisetransaction": { + "see_also": { + "commands": [ + "getrawmempool", + "getblocktemplate" + ] + } + }, + "pruneblockchain": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprunedfunds" + ] + } + }, + "removeprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "importprunedfunds" + ] + } + }, + "rescanblockchain": { + "added": "0.16.0" + }, + "savemempool": { + "added": "0.16.0" + }, + "sendfrom": { + "deprecated": true, + "removed": "0.18.0" + }, + "sendmany": { + "see_also": { + "commands": [ + "sendtoaddress" + ] + } + }, + "sendrawtransaction": { + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction" + ] + } + }, + "sendtoaddress": { + "see_also": { + "commands": [ + "sendmany" + ] + } + }, + "setaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "setban": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "clearbanned" + ] + } + }, + "setgenerate": { + "removed": "0.13.0", + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "setlabel": { + "added": "0.17.0" + }, + "setnetworkactive": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getnetworkinfo" + ] + } + }, + "settxfee": { + "see_also": { + "commands": [ + "getwalletinfo", + "getnetworkinfo" + ] + } + }, + "signmessage": { + "see_also": { + "commands": [ + "signmessagewithprivkey", + "verifymessage" + ] + } + }, + "signmessagewithprivkey": { + "added": "0.13.0", + "see_also": { + "commands": [ + "signmessage", + "verifymessage" + ] + } + }, + "signrawtransaction": { + "removed": "0.18.0" + }, + "submitblock": { + "see_also": { + "commands": [ + "getblocktemplate" + ] + } + }, + "submitheader": { + "added": "0.18.0" + }, + "utxoupdatepsbt": { + "added": "0.18.0" + }, + "validateaddress": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "importaddress", + "getnewaddress" + ] + } + }, + "verifychain": { + "see_also": { + "commands": [ + "getblockchaininfo", + "gettxoutsetinfo" + ] + } + }, + "verifymessage": { + "see_also": { + "commands": [ + "signmessage" + ] + } + }, + "verifytxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "gettxoutproof" + ] + } + }, + "walletlock": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletpassphrasechange" + ] + } + }, + "walletpassphrase": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrasechange", + "walletlock" + ] + } + }, + "walletpassphrasechange": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletlock" + ] + } + } +} \ No newline at end of file diff --git a/helpers/rpc/annotations-bitcoin-0.21.json b/helpers/rpc/annotations-bitcoin-0.21.json new file mode 100644 index 0000000..c9a637b --- /dev/null +++ b/helpers/rpc/annotations-bitcoin-0.21.json @@ -0,0 +1,937 @@ +{ + "abandontransaction": { + "added": "0.12.0", + "args": { + "txid": { + "type": "hex" + } + }, + "see_also": { + "commands": [ + "sendrawtransaction" + ] + }, + "summary": "marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent." + }, + "abortrescan": { + "summary": "Stops current wallet rescan" + }, + "addmultisigaddress": { + "see_also": { + "commands": [ + "createmultisig", + "decodescript" + ], + "glossary": [ + [ + "p2sh-address", + "Pay-To-Script-Hash (P2SH)" + ] + ] + }, + "summary": "adds a P2SH multisig address to the wallet.", + "wallet": true + }, + "addnode": { + "args": { + "command": { + "description": "What to do with the IP address above. Options are:
\u2022 `add` to add a node to the addnode list. Up to 8 nodes can be added additional to the default 8 nodes. Not limited by `-maxconnections`
\u2022 `remove` to remove a node from the list. If currently connected, this will disconnect immediately
\u2022 `onetry` to immediately attempt connection to the node even if the outgoing connection slots are full; this will only attempt the connection once" + }, + "node": { + "description": "The node to add as a string in the form of `:`. The IP address may be a hostname resolvable through DNS, an IPv4 address, an IPv4-as-IPv6 address, or an IPv6 address" + } + }, + "changed": "0.14.0", + "see_also": { + "commands": [ + "getaddednodeinfo" + ] + } + }, + "addwitnessaddress": { + "deprecated": "0.16.0", + "removed": "0.17.0" + }, + "analyzepsbt": { + "added": "0.18.0" + }, + "backupwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importwallet" + ] + }, + "wallet": true + }, + "bumpfee": { + "added": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "fundrawtransaction", + "sendrawtransaction" + ] + } + }, + "clearbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "setban" + ] + } + }, + "createmultisig": { + "see_also": { + "commands": [ + "addmultisigaddress", + "decodescript" + ] + } + }, + "createrawtransaction": { + "changed": "0.14.1", + "see_also": { + "commands": [ + "decoderawtransaction", + "sendrawtransaction" + ] + } + }, + "decoderawtransaction": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "createrawtransaction", + "sendrawtransaction" + ] + } + }, + "decodescript": { + "see_also": { + "commands": [ + "createmultisig" + ] + } + }, + "deriveaddresses": { + "added": "0.18.0" + }, + "disconnectnode": { + "added": "0.12.0", + "changed": "0.14.1", + "see_also": { + "commands": [ + "addnode", + "getaddednodeinfo" + ] + } + }, + "dumpprivkey": { + "see_also": { + "commands": [ + "importprivkey", + "dumpwallet" + ] + } + }, + "dumptxoutset": { + "added": "0.20" + }, + "dumpwallet": { + "see_also": { + "commands": [ + "backupwallet", + "importwallet" + ] + } + }, + "encryptwallet": { + "see_also": { + "commands": [ + "walletpassphrase", + "walletlock", + "walletpassphrasechange" + ] + } + }, + "estimatefee": { + "deprecated": "0.15.0", + "removed": "0.17.0", + "see_also": { + "commands": [ + "settxfee" + ] + } + }, + "estimatepriority": { + "removed": "0.15.0" + }, + "fundrawtransaction": { + "added": "0.12.0", + "changed": "0.14.0", + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction", + "sendrawtransaction" + ] + } + }, + "generate": { + "added": "0.11.0", + "changed": "0.13.0", + "deprecated": "0.18.0", + "removed": "0.19" + }, + "generateblock": { + "added": "0.21" + }, + "generatetoaddress": { + "added": "0.13.0", + "see_also": { + "commands": [ + "generate", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "generatetodescriptor": { + "added": "0.20" + }, + "getaccount": { + "removed": "0.18.0" + }, + "getaccountaddress": { + "deprecated": true, + "removed": "0.18.0" + }, + "getaddednodeinfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "addnode", + "getpeerinfo" + ] + } + }, + "getaddressbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "getaddressesbyaccount": { + "removed": "0.18.0", + "see_also": { + "commands": [ + "getbalance" + ] + } + }, + "getaddressesbylabel": { + "added": "0.17.0" + }, + "getaddressinfo": { + "added": "0.17.0" + }, + "getbalance": { + "see_also": { + "commands": [ + "getreceivedbyaddress" + ] + } + }, + "getbalances": { + "added": "0.19" + }, + "getbestblockhash": { + "see_also": { + "commands": [ + "getblock", + "getblockhash" + ] + } + }, + "getblock": { + "args": { + "blockhash": { + "type": "hex" + } + }, + "changed": "0.13.0", + "see_also": { + "commands": [ + "getblockhash", + "getbestblockhash" + ] + }, + "summary": "gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." + }, + "getblockchaininfo": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getblockcount": { + "see_also": { + "commands": [ + "getblockhash", + "getblock" + ] + } + }, + "getblockfilter": { + "added": "0.19" + }, + "getblockhash": { + "see_also": { + "commands": [ + "getblock", + "getbestblockhash" + ] + } + }, + "getblockheader": { + "added": "0.12.0", + "see_also": { + "commands": [ + "getblock", + "getblockhash", + "getbestblockhash" + ] + } + }, + "getblocktemplate": { + "see_also": { + "commands": [ + "getmininginfo", + "submitblock", + "prioritisetransaction" + ] + } + }, + "getchaintips": { + "see_also": { + "commands": [ + "getbestblockhash", + "getblock", + "getblockchaininfo" + ] + } + }, + "getconnectioncount": { + "see_also": { + "commands": [ + "getnettotals", + "getpeerinfo", + "getnetworkinfo" + ] + } + }, + "getdescriptorinfo": { + "added": "0.18.0" + }, + "getdifficulty": { + "see_also": { + "commands": [ + "getnetworkhashps", + "getmininginfo" + ] + } + }, + "getgenerate": { + "removed": "0.13.0", + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo" + ] + } + }, + "gethashespersec": { + "removed": "0.11.0", + "see_also": { + "commands": [ + "generate", + "getmininginfo" + ] + } + }, + "getindexinfo": { + "added": "0.20" + }, + "getinfo": { + "removed": "0.16.0", + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo", + "getmininginfo", + "getnetworkinfo", + "getwalletinfo" + ] + } + }, + "getmemoryinfo": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo" + ] + } + }, + "getmempoolancestors": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempooldescendants": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getrawmempool" + ] + } + }, + "getmempoolentry": { + "added": "0.13.0", + "see_also": { + "commands": [ + "getmempoolancestors", + "getmempooldescendants", + "getrawmempool" + ] + } + }, + "getmempoolinfo": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getblockchaininfo", + "getrawmempool", + "gettxoutsetinfo" + ] + } + }, + "getmininginfo": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getrawmempool", + "getblocktemplate", + "generate" + ] + } + }, + "getnettotals": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getnetworkinfo", + "getpeerinfo" + ] + } + }, + "getnetworkhashps": { + "see_also": { + "commands": [ + "getdifficulty", + "getblock" + ] + } + }, + "getnetworkinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getpeerinfo", + "getnettotals" + ] + } + }, + "getnewaddress": { + "see_also": { + "commands": [ + "getrawchangeaddress", + "getbalance" + ] + } + }, + "getnodeaddresses": { + "added": "0.18.0" + }, + "getpeerinfo": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getaddednodeinfo", + "getnettotals", + "getnetworkinfo" + ] + } + }, + "getrawchangeaddress": { + "see_also": { + "commands": [ + "getnewaddress" + ] + } + }, + "getrawmempool": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "getmempoolinfo", + "getmempoolentry", + "gettxoutsetinfo" + ] + } + }, + "getrawtransaction": { + "changed": "0.14.0", + "see_also": { + "commands": [ + "gettransaction" + ] + } + }, + "getreceivedbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "getreceivedbyaddress": {}, + "getreceivedbylabel": { + "added": "0.17.0" + }, + "getrpcinfo": { + "added": "0.18.0" + }, + "gettransaction": { + "changed": "0.12.0", + "see_also": { + "commands": [ + "getrawtransaction" + ] + } + }, + "gettxout": { + "see_also": { + "commands": [ + "getrawtransaction", + "gettransaction" + ] + } + }, + "gettxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "verifytxoutproof" + ], + "messages": [ + [ + "merkleblock", + "A description of the\n format used for the proof." + ] + ] + } + }, + "gettxoutsetinfo": { + "see_also": { + "commands": [ + "getblockchaininfo", + "getmempoolinfo" + ] + } + }, + "getunconfirmedbalance": { + "see_also": { + "commands": [ + "getbalance" + ] + } + }, + "getwalletinfo": { + "see_also": { + "commands": [ + "listtransactions" + ] + } + }, + "getwork": { + "removed": "0.10.0", + "see_also": { + "commands": [ + "getblocktemplate", + "submitblock" + ] + } + }, + "importaddress": { + "see_also": { + "commands": [ + "importprivkey", + "listreceivedbyaddress" + ] + } + }, + "importdescriptors": { + "added": "0.21" + }, + "importmulti": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprivkey": { + "see_also": { + "commands": [ + "dumpprivkey", + "importaddress", + "importwallet" + ] + } + }, + "importprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "removeprunedfunds" + ] + } + }, + "importwallet": { + "see_also": { + "commands": [ + "dumpwallet", + "importprivkey" + ] + } + }, + "joinpsbts": { + "added": "0.18.0" + }, + "keypoolrefill": { + "see_also": { + "commands": [ + "getnewaddress", + "getwalletinfo" + ] + } + }, + "listaccounts": { + "deprecated": true, + "removed": "0.18.0" + }, + "listaddressgroupings": { + "see_also": { + "commands": [ + "gettransaction" + ] + } + }, + "listbanned": { + "added": "0.12.0", + "see_also": { + "commands": [ + "setban", + "clearbanned" + ] + } + }, + "listlabels": { + "added": "0.17.0" + }, + "listlockunspent": { + "see_also": { + "commands": [ + "lockunspent" + ] + } + }, + "listreceivedbyaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "listreceivedbyaddress": { + "see_also": { + "commands": [ + "getreceivedbyaddress" + ] + } + }, + "listreceivedbylabel": { + "added": "0.17.0" + }, + "listsinceblock": { + "see_also": { + "commands": [ + "listreceivedbyaddress" + ] + } + }, + "listtransactions": { + "changed": "0.12.1", + "see_also": { + "commands": [ + "gettransaction", + "listsinceblock" + ] + } + }, + "listunspent": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "listtransactions", + "lockunspent" + ] + } + }, + "listwalletdir": { + "added": "0.18.0" + }, + "lockunspent": { + "see_also": { + "commands": [ + "listlockunspent", + "listunspent" + ] + } + }, + "move": { + "deprecated": true, + "removed": "0.18.0" + }, + "ping": { + "see_also": { + "commands": [ + "getpeerinfo" + ] + } + }, + "preciousblock": { + "added": "0.14.0" + }, + "prioritisetransaction": { + "see_also": { + "commands": [ + "getrawmempool", + "getblocktemplate" + ] + } + }, + "pruneblockchain": { + "added": "0.14.0", + "see_also": { + "commands": [ + "importprunedfunds" + ] + } + }, + "psbtbumpfee": { + "added": "0.21" + }, + "removeprunedfunds": { + "added": "0.13.0", + "see_also": { + "commands": [ + "importprivkey", + "importprunedfunds" + ] + } + }, + "rescanblockchain": { + "added": "0.16.0" + }, + "savemempool": { + "added": "0.16.0" + }, + "sendfrom": { + "deprecated": true, + "removed": "0.18.0" + }, + "sendmany": { + "see_also": { + "commands": [ + "sendtoaddress" + ] + } + }, + "sendrawtransaction": { + "see_also": { + "commands": [ + "createrawtransaction", + "decoderawtransaction" + ] + } + }, + "sendtoaddress": { + "see_also": { + "commands": [ + "sendmany" + ] + } + }, + "setaccount": { + "deprecated": true, + "removed": "0.18.0" + }, + "setban": { + "added": "0.12.0", + "see_also": { + "commands": [ + "listbanned", + "clearbanned" + ] + } + }, + "setgenerate": { + "removed": "0.13.0", + "see_also": { + "commands": [ + "generate", + "generatetoaddress", + "getmininginfo", + "getblocktemplate" + ] + } + }, + "setlabel": { + "added": "0.17.0" + }, + "setnetworkactive": { + "added": "0.14.0", + "see_also": { + "commands": [ + "getnetworkinfo" + ] + } + }, + "settxfee": { + "see_also": { + "commands": [ + "getwalletinfo", + "getnetworkinfo" + ] + } + }, + "setwalletflag": { + "added": "0.19" + }, + "signmessage": { + "see_also": { + "commands": [ + "signmessagewithprivkey", + "verifymessage" + ] + } + }, + "signmessagewithprivkey": { + "added": "0.13.0", + "see_also": { + "commands": [ + "signmessage", + "verifymessage" + ] + } + }, + "signrawtransaction": { + "removed": "0.18.0" + }, + "submitblock": { + "see_also": { + "commands": [ + "getblocktemplate" + ] + } + }, + "submitheader": { + "added": "0.18.0" + }, + "upgradewallet": { + "added": "0.21" + }, + "utxoupdatepsbt": { + "added": "0.18.0" + }, + "validateaddress": { + "changed": "0.13.0", + "see_also": { + "commands": [ + "importaddress", + "getnewaddress" + ] + } + }, + "verifychain": { + "see_also": { + "commands": [ + "getblockchaininfo", + "gettxoutsetinfo" + ] + } + }, + "verifymessage": { + "see_also": { + "commands": [ + "signmessage" + ] + } + }, + "verifytxoutproof": { + "added": "0.11.0", + "see_also": { + "commands": [ + "gettxoutproof" + ] + } + }, + "walletlock": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletpassphrasechange" + ] + } + }, + "walletpassphrase": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrasechange", + "walletlock" + ] + } + }, + "walletpassphrasechange": { + "see_also": { + "commands": [ + "encryptwallet", + "walletpassphrase", + "walletlock" + ] + } + } +} \ No newline at end of file diff --git a/helpers/rpc/annotations.py b/helpers/rpc/annotations.py new file mode 100644 index 0000000..7b47c6c --- /dev/null +++ b/helpers/rpc/annotations.py @@ -0,0 +1,118 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import json +from pathlib import Path +import os +import re + +from cli_caller import CliCaller +from help_parser import HelpParser + + +class Annotations: + def __init__(self, filename): + self.filename = filename + self.load() + + def load(self): + with open(self.filename) as file: + self.annotations = json.load(file) + + def save(self): + with open(self.filename, "w") as file: + file.write(json.dumps(self.annotations, indent=2, sort_keys=True)) + + def annotation(self, command): + if command in self.annotations: + return self.annotations[command] + else: + return {} + + def import_see_also(self, dir): + with open(self.filename) as file: + annotations = json.load(file) + for filename in os.listdir(dir): + command = filename.partition(".")[0] + print(command) + see_also_commands = [] + with open(Path(dir) / filename) as file: + found_see_also = False + for line in file: + if line.startswith("*See also*"): + found_see_also = True + continue + if found_see_also and line.startswith("* "): + match = re.match(r"^\* .*\[rpc (.*)\]", line) + if match: + print(" ", match.group(1)) + see_also_commands.append(match.group(1)) + if see_also_commands: + if not command in annotations: + annotations[command] = {} + commands = { + "commands": see_also_commands + } + if "see_also" in annotations[command]: + annotations[command]["see_also"].update(commands) + else: + annotations[command]["see_also"] = commands + with open(self.filename, "w") as file: + file.write(json.dumps(annotations, indent=2, sort_keys=True)) + + def clean_annotations(self): + self.load() + + to_be_cleaned = [] + removed_commands = [] + for command in self.annotations: + annotation = self.annotations[command] + if "see_also" in annotation: + if annotation["see_also"] == {"commands": [""]}: + annotation.pop("see_also") + if annotation == {}: + to_be_cleaned.append(command) + if "removed" in annotation: + removed_commands.append(command) + + for command in to_be_cleaned: + self.annotations.pop(command) + + for command in self.annotations: + annotation = self.annotations[command] + if "see_also" in annotation: + if "commands" in annotation["see_also"]: + commands = annotation["see_also"]["commands"] + for removed_command in removed_commands: + if removed_command in commands: + commands.remove(removed_command) + if not commands: + annotation["see_also"].pop("commands") + if not annotation["see_also"]: + annotation.pop("see_also") + + self.save() + + def mark_removed(self, version, command): + self.load() + if not command in self.annotations: + self.annotations[command] = {} + annotation = self.annotations[command] + annotation["removed"] = version + if "see_also" in annotation: + annotation.pop("see_also") + self.save() + + def mark_added(self, version, command): + self.load() + if not command in self.annotations: + self.annotations[command] = {} + annotation = self.annotations[command] + annotation["added"] = version + self.save() + + def show_missing(self, commands): + self.load() + for command in commands: + if not command in self.annotations: + print(command) diff --git a/helpers/rpc/cli_bitcoin.py b/helpers/rpc/cli_bitcoin.py new file mode 100644 index 0000000..892bb22 --- /dev/null +++ b/helpers/rpc/cli_bitcoin.py @@ -0,0 +1,18 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import os +import sys +from pathlib import Path + + +class CliBitcoin: + def __init__(self): + cli_path = os.environ.get("BITCOIN_CLI_PATH") + if not cli_path: + sys.exit("BITCOIN_CLI_PATH is not set. Set this to the command to " + "run the bitcoin-cli including any options. Exiting now.") + + self.cli_path = Path(cli_path.split(" ")[0]) +# self.cli_path = Path(cli_path.split(" ")[0]).expanduser() + self.cli_args = cli_path.split(" ")[1:] diff --git a/helpers/rpc/cli_caller.py b/helpers/rpc/cli_caller.py new file mode 100644 index 0000000..6e99d63 --- /dev/null +++ b/helpers/rpc/cli_caller.py @@ -0,0 +1,17 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import subprocess + + +class CliCaller: + def __init__(self, cli): + self.cli = cli + + def help(self, cmd=None): + arg = ["help"] + if cmd: + arg.append(cmd) + result = subprocess.check_output([str(self.cli.cli_path)] + self.cli.cli_args + + arg) + return result.rstrip().decode("utf-8") diff --git a/helpers/rpc/cli_controller.py b/helpers/rpc/cli_controller.py new file mode 100644 index 0000000..01371a2 --- /dev/null +++ b/helpers/rpc/cli_controller.py @@ -0,0 +1,58 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import os + +from generator import Generator +from cli_caller import CliCaller +from annotations import Annotations +from help_parser import HelpParser +from references import References + + +class CliController: + def generate(self, cli, renderer, command=None): + generator = Generator(cli, renderer) + if command: + generator.generate_command(command) + else: + generator.generate_overview() + + def get_help(self, cli, command): + print(CliCaller(cli).help(command)) + + def import_see_also(self, markdown_dir, annotations_file): + annotations = Annotations(annotations_file) + annotations.import_see_also(markdown_dir) + + def clean_annotations(self, annotations_file): + annotations = Annotations(annotations_file) + annotations.clean_annotations() + + def mark_removed(self, annotations_file, version, command): + annotations = Annotations(annotations_file) + annotations.mark_removed(version, command) + + def mark_added(self, annotations_file, version, command): + annotations = Annotations(annotations_file) + annotations.mark_added(version, command) + + def show_removed(self, cli, markdown_dir): + commands = HelpParser().parse_help_overview(CliCaller(cli).help()).flat() + removed_commands = [] + for markdown_file in os.listdir(markdown_dir): + command = os.path.splitext(markdown_file)[0] + if not command in commands: + removed_commands.append(command) + for command in sorted(removed_commands): + print(command) + + def show_missing(self, cli, annotations_file): + commands = HelpParser().parse_help_overview(CliCaller(cli).help()).flat() + annotations = Annotations(annotations_file) + annotations.show_missing(commands) + + def update_references(self, cli, docs_dir): + commands = HelpParser().parse_help_overview(CliCaller(cli).help()).flat() + references = References(docs_dir) + references.update(commands) diff --git a/helpers/rpc/generator.py b/helpers/rpc/generator.py new file mode 100644 index 0000000..cc1e682 --- /dev/null +++ b/helpers/rpc/generator.py @@ -0,0 +1,30 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. +from help_parser import HelpParser +from cli_caller import CliCaller + + +class Generator: + def __init__(self, cli, renderer): + self.cli = CliCaller(cli) + self.renderer = renderer + + def generate_command(self, command): + print("Command %s" % command) + command_output = self.cli.help(command) + help_data = HelpParser().parse_help_command(command_output) + self.renderer.render_cmd_page(command, help_data) + + def generate_overview(self): + help_output = self.cli.help() + command_list = HelpParser().parse_help_overview(help_output) + + self.renderer.render_overview_page(command_list.grouped(), + render_version_info=False) + + count = 1 + for command in command_list.flat(): + self.generate_command(command) + count += 1 + + print("Generated pages for %s commands." % count) diff --git a/helpers/rpc/help_data.py b/helpers/rpc/help_data.py new file mode 100644 index 0000000..7cc28e6 --- /dev/null +++ b/helpers/rpc/help_data.py @@ -0,0 +1,74 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +# List of words which are recognized in commands. The display_name method +# also recognizes strings between these words as own words so not all words +# appearing in command names have to be listed here but only enough to separate +# all words. +# +# Keep the list ordered alphabetically so it's easier for a developer to see if +# a word already is there +word_list = ["abort", "account", "address", "balance", "block", "by", "chain", + "change", "clear", "connection", "convert", "decode", + "fee", "generate", "get", "hash", "header", + "import", "info", "key", "label", + "message", "multi", "network", "node", "out", "psbt", "pool", + "priv", "pruned", "list", "raw", "save", "send", "smart", "totals", + "transaction", "tx", "unspent", "wallet", + ] + +# List of explicit display names which would otherwise wrongly generated from +# the word list +explicit_display_names = { + "setban": "SetBan", + "listaccounts": "ListAccounts", + "listwallets": "ListWallets", + "listtransactions": "ListTransactions", + "sethdseed": "SetHdSeed", + "getaddressesbylabel": "GetAddressesByLabel", + "getaddressesbyaccount": "GetAddressesByAccount", + "getnodeaddresses": "GetNodeAddresses", + "joinpsbts": "JoinPsbts", + "utxoupdatepsbt": "UtxoUpdatePsbt", + "deriveaddresses": "DeriveAddresses", + "listlabels": "ListLabels", +} + + +def capitalize(word): + if len(word) > 1: + return word[0].upper() + word[1:] + else: + return word.upper() + + +def uncapitalize(word): + if len(word) > 1: + return word[0].lower() + word[1:] + else: + return word.lower() + + +def display_name(command): + if command in explicit_display_names: + return explicit_display_names[command] + + name = "" + last_word_index = 0 + i = 0 + while i < len(command): + found_word = False + for word in word_list: + if command[i:i+len(word)] == word: + if last_word_index < i: + name += capitalize(command[last_word_index:i]) + name += capitalize(word) + i += len(word) + last_word_index = i + found_word = True + break + if not found_word: + i += 1 + if last_word_index < i: + name += capitalize(command[last_word_index:i]) + return capitalize(name) diff --git a/helpers/rpc/help_parser.py b/helpers/rpc/help_parser.py new file mode 100644 index 0000000..5790889 --- /dev/null +++ b/helpers/rpc/help_parser.py @@ -0,0 +1,202 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import re +from enum import Enum +from collections import defaultdict + + +class CommandList: + def __init__(self): + self.commands_by_group = defaultdict(list) + + def add(self, group, command): + self.commands_by_group[group].append(command) + + def grouped(self): + return self.commands_by_group + + def flat(self): + commands = [] + for group in self.commands_by_group: + for command in self.commands_by_group[group]: + commands.append(command.split(" ")[0]) + return sorted(commands) + + +class HelpParser: + '''A parser for the Bitcoin Core RPC command line help''' + + Section = Enum( + 'Section', 'command description result literal_result past_result ' + 'arguments literal_argument examples') + + def __init__(self): + self.json_level = 0 + + def parse_help_result(self, result_line): + match = re.match(r'([^\s]*)\s+\((.*)\)\s+(.*)', result_line) + if match: + name = match.group(1) + if name[0] == '"' and name[-1] == '"': + name = name[1:-1] + return {'format': 'table', 'name': name, "type": match.group(2), + "description": match.group(3)} + else: + return None + + def parse_help_argument(self, result_line): + match = re.match(r'\d\.\s+([^\s]*)\s+\((.*?)\)\s*(.*)', result_line) + if match: + name = match.group(1) + if name[0] == '"' and name[-1] == '"': + name = name[1:-1] + return {"name": name, "type": match.group(2), + "description": match.group(3)} + else: + return None + + def next_section(self, line, help_data): + """Check line for section identifiers and move state to next section if + found. Returns if a new section was found and the state was changed. + """ + previous_section = self.section + result_match = re.match(r'^Result:?([^:]*):?$', line) + if result_match and (':' in line or line == 'Result' or line.startswith('Result (')): + self.section = self.Section.result + help_data['results'].append( + {'title_extension': result_match.group(1)}) + elif line == "Arguments:": + self.section = self.Section.arguments + elif re.match(r'Examples?:', line): + self.section = self.Section.examples + return previous_section != self.section + + def check_opening_json(self, line): + """Checks line for brackets opening a JSON object and sets the + json_level accordingly. Detects one-line JSON which is closed in the + same line. + """ + if line.endswith('},') or line.endswith('],'): + line = line[:-1] + match = re.match(r"^ *([\[{])", line) + if match: + pairs = [ + ['{', '}'], + ['[', ']'], + ] + for pair in pairs: + if match.group(1) == pair[0] and (line[-len(pair[1]):] != pair[1]): + self.json_level += 1 + return + + def parse_help_overview(self, help_text): + command_list = CommandList() + group = "" + for line in help_text.splitlines(): + pattern = re.compile("== (.*) ==") + match = pattern.match(line) + if match: + group = match.group(1) + else: + if len(line) > 0: + command_list.add(group, line.rstrip()) + return command_list + + def parse_help_command(self, help_text): + self.section = self.Section.command + self.literal_description = False + help_data = { + "command": "", + "description": "", + "results": [], + "arguments": [], + "examples": [], + } + for line in help_text.splitlines(): + # print("LINE (" + self.section.name + ") " + line) + + if self.section == self.Section.command: + help_data['command'] = line.rstrip() + self.section = self.Section.description + + elif self.section == self.Section.description: + if not self.next_section(line, help_data): + if line: + if line.startswith(" "): + self.literal_description = True + else: + if self.literal_description: + help_data["description"] += '\n' + self.literal_description = False + if help_data["description"] and help_data["description"][-2] in ['.', ':']: + help_data["description"] += '\n' + help_data["description"] += line.rstrip() + '\n' + + elif self.section == self.Section.arguments: + if not self.next_section(line, help_data): + if line: + argument = self.parse_help_argument(line) + if argument: + help_data["arguments"].append(argument) + else: + if help_data['arguments']: + last_argument = help_data["arguments"][-1] + if last_argument: + self.check_opening_json(line) + if self.json_level > 0: + last_argument['literal_description'] = line + '\n' + self.section = self.Section.literal_argument + else: + if line.startswith(' '): + if last_argument['description']: + last_argument['description'] += '\n ' + last_argument['description'] += line.lstrip() + + elif self.section == self.Section.literal_argument: + last_argument = help_data['arguments'][-1] + last_argument['literal_description'] += line + '\n' + self.check_opening_json(line) + if re.match(r"^ *[\]}]", line): + self.json_level -= 1 + if self.json_level == 0: + self.section = self.Section.arguments + + elif self.section == self.Section.result: + if not self.next_section(line, help_data): + if line.startswith("{") or (line.startswith("[") and not "]" in line): + self.section = self.Section.literal_result + result_data = help_data['results'][-1] + result_data.update( + {'format': 'literal', 'text': ' ' + line + '\n'}) + else: + if line and not line.startswith(" "): + result_data_line = self.parse_help_result(line) + result_data = help_data['results'][-1] + if result_data_line: + result_data.update(result_data_line) + else: + result_data.update( + {'format': 'literal', 'text': ' ' + line + '\n'}) + self.section = self.Section.past_result + + elif self.section == self.Section.literal_result: + last_result = help_data['results'][-1] + last_result['text'] += ' ' + line.rstrip() + '\n' + if line == "}" or line == ']': + self.section = self.Section.past_result + + elif self.section == self.Section.past_result: + self.next_section(line, help_data) + + elif self.section == self.Section.examples: + if line: + help_data["examples"].append(line) + + self.fixup(help_data) + return help_data + + def fixup(self, help_data): + command = help_data["command"].split(" ")[0] + if command == "getblock" or command == "getblockheader": + help_data["description"] = help_data["description"].replace("", "'hash'") diff --git a/helpers/rpc/references.py b/helpers/rpc/references.py new file mode 100644 index 0000000..0f7e94d --- /dev/null +++ b/helpers/rpc/references.py @@ -0,0 +1,67 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +from pathlib import Path + +from help_data import display_name + +class References: + def __init__(self, docs_dir): + self.docs_dir = Path(docs_dir) + + def anchor(self, command): + if command == "ping": + return "ping-rpc" + else: + return command + + def update(self, commands): + self.update_references(commands) + self.update_autocrossref(commands) + self.update_config(commands) + self.update_api_intro(commands) + + def update_file(self, commands, path, start_marker, content_call, + replace_start_marker=False, end_marker=None): + file_path = self.docs_dir / path + print("Updating file %s ..." % file_path) + output = "" + with file_path.open() as ref_file: + skip_lines = False + for line in ref_file: + if skip_lines: + if (end_marker and end_marker in line) or (not end_marker and line == "\n"): + skip_lines = False + output += line + else: + if start_marker in line: + if not replace_start_marker: + output += line + skip_lines = True + for command in commands: + output += content_call(command) + "\n" + else: + output += line + + with file_path.open("w") as f: + f.write(output) + + def update_references(self, commands): + self.update_file(commands, Path("_includes", "references.md"), "" % (version, date)) + if new: + self.add_version_helper_assignment(page, "New", version, bold=bold) + if updated: + self.add_version_helper_assignment( + page, "Updated", version, bold=bold) + page.nl() + + def render_version_info(self, page): + with page.tag("comment"): + page.text("""Styling notes: use highly-visible style for upcoming changes (not yet +released) and changes made in the last 6 months. Use less-visible +style for changes made up to two years ago. Don't point out +changes made more than two years ago. + +Use v0.n.n in abbreviation title to prevent autocrossrefing.""") + page.nl() + page.text("") + page.tag("assign", "DEPRECATED='**Deprecated**'") + + self.add_version_helpers(page, "0.14.1", "April 2017", bold=True) + self.add_version_helpers( + page, "0.14.0", "March 2017", new=True, bold=True) + self.add_version_helpers(page, "0.13.1", "September 2016") + self.add_version_helpers(page, "0.13.0", "August 2016", new=True) + self.add_version_helpers(page, "0.12.1", "April 2016") + self.add_version_helpers(page, "0.12.0", "February 2016", new=True) + self.add_version_helpers( + page, "0.11.0", "July 2015", new=True, updated=False) + + def render_overview_page(self, all_commands, render_version_info=True): + with open(self.output_dir / "quick-reference.md", "w") as file: + page = Page() + + self.add_license_header(page) + page.tag( + "assign", 'filename="_data/devdocs/en/bitcoin-core/rpcs/quick-reference.md"') + page.nl() + page.text("#### Quick Reference {#rpc-quick-reference}") + page.tag("include", "helpers/subhead-links.md") + page.nl() + + if render_version_info: + self.render_version_info(page) + + page.text("""""") + page.tag("include", "helpers/summaries.md") + page.nl() + + for category in all_commands: + page.text("#### " + category + " RPCs") + page.text("{:.no_toc}") + page.text("\n") + with page.tag("autocrossref"): + page.nl() + if category == "Wallet": + page.text("""**Note:** the wallet RPCs are only available if Bitcoin Core was built +with [wallet support][]{:#term-wallet-support}{:.term}, which is the +default. +""") + for command in all_commands[category]: + cmd = command.split(" ")[0] + item = "* [" + display_name(cmd) + "]" + item += "[rpc " + cmd + "]: " + item += "{{summary_" + uncapitalize(display_name(cmd)) + if cmd == "ping": + item += "-rpc" + item += "}}" + if render_version_info: + annotation = self.annotations.annotation(cmd) + if "added" in annotation: + item += " {{NEW%s}}" % annotation["added"].replace( + ".", "_") + if "added" in annotation and "changed" in annotation: + item += "," + if "changed" in annotation: + item += " {{UPDATED%s}}" % annotation["changed"].replace( + ".", "_") + if "deprecated" in annotation: + item += " {{DEPRECATED}}" + page.text(item) + page.nl() + page.nl() + + file.write(page.out) diff --git a/helpers/rpc/renderer_rst.py b/helpers/rpc/renderer_rst.py new file mode 100644 index 0000000..27a9b6c --- /dev/null +++ b/helpers/rpc/renderer_rst.py @@ -0,0 +1,254 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +import os +import re +from collections import defaultdict +from pathlib import Path +import json + +from help_data import display_name, capitalize, uncapitalize +from annotations import Annotations + + +class RendererRst: + def __init__(self, output_dir): + self.output_dir = Path(output_dir) + self.annotations = Annotations("annotations-bitcoin-0.21.json") + + def add_version_note(self, page): + if "added" in self.annotation: + page.text("*Added in Bitcoin Core %s*\n" % + self.annotation["added"]) + + def add_wallet_note(self, page): + if "wallet" in self.annotation: + if self.annotation["wallet"]: + page.text("*Requires wallet support.*\n") + + def add_see_also_command(self, page, command): + name = display_name(command) + lower_name = uncapitalize(name) + page.text("* [%s][rpc %s]: {{summary_%s}}" % + (name, command, lower_name)) + + def add_see_also_glossary(self, page, text, link): + page.text("* [%s][/en/glossary/%s]" % (text, link)) + + def add_see_also_message(self, page, message, text): + page.text("* [`%s` message][%s message]: %s" % + (message, message, text)) + + def add_see_also(self, page): + if "see_also" in self.annotation: + page.text("*See also*\n") + see_also = self.annotation["see_also"] + if "commands" in see_also: + for command in see_also["commands"]: + self.add_see_also_command(page, command) + if "glossary" in see_also: + for glossary in see_also["glossary"]: + self.add_see_also_glossary(page, glossary[1], glossary[0]) + if "messages" in see_also: + for message in see_also["messages"]: + self.add_see_also_message(page, message[0], message[1]) + page.nl() + + def arg_summary(self, arg): + return arg["name"] + + def arg_n(self, arg): + return arg["name"] + + def arg_t(self, arg): + t = arg["type"].split(", ")[0] + if t == "numeric": + t = "number (int)" + if "args" in self.annotation: + args = self.annotation["args"] + if arg["name"] in args: + arg_annotation = args[arg["name"]] + if "type" in arg_annotation: + t += " (%s)" % arg_annotation["type"] + return t + + def arg_p(self, arg): + arg_line = arg["type"].split(", ") + if len(arg_line) == 1: + return "Required" + else: + p = arg_line[1] + if p == "required": + return "Required
(exactly 1)" + elif p == "optional": + if len(arg_line) == 3: + return "Optional
" + capitalize(arg_line[2]) + else: + return "Optional" + else: + return p + + def arg_d(self, arg): + d = arg["description"] + if "args" in self.annotation: + args = self.annotation["args"] + if arg["name"] in args: + arg_annotation = args[arg["name"]] + if "description" in arg_annotation: + d += ". " + arg_annotation["description"] + return d + + def result_t(self, result): + t = result["type"] + if t == "numeric": + t = "number (int)" + elif t == "string": + t += " (hex)" + return t + + def result_null(self): + return '''*Result---`null` on success* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "null" + p: "Required
(exactly 1)" + d: "JSON `null` when the command was successfull or a JSON with an error field on error." + +{% enditemplate %} +''' + + def yaml_escape(self, text): + return text.replace('"', '\\"') + + def guarded_code_block(self, block): + return "{% endautocrossref %}\n\n" + self.code_block(block) + "\n{% autocrossref %}\n" + + def code_block(self, block): + min_indentation = 999 + split_block = block.splitlines() + for line in split_block: + indentation = len(line) - len(line.lstrip(" ")) + if indentation < min_indentation: + min_indentation = indentation + + indented_block = "" + for line in split_block: + if min_indentation <= 4: + indented_block += " " * (4 - min_indentation) + line + else: + indented_block += line[min_indentation - 4:] + indented_block += "\n" + if not indented_block.endswith("\n"): + indented_block += "\n" + return indented_block + + def license_header(self): + output = "" + output += ".. This file is licensed under the MIT License (MIT) available on\n" + output += " http://opensource.org/licenses/MIT.\n\n" + return output + + def table(self, rows, title=None): + output = '.. list-table::' + if title: + output += ' ' + title + output += '\n :header-rows: 1\n\n' + output += ' * - Name\n - Type\n - Description\n' + for row in rows: + output += ' * - ' + row["name"] + '\n' + output += ' - ' + row["type"] + '\n' + if row["description"]: + description = row["description"] + else: + description = "object" + output += ' - ' + description + '\n' + return output + + def cmd_page(self, help_data): + output = "" + output += self.license_header() + output += self.title(help_data["command"].split(" ")[0]) + output += "\n" + output += '``' + help_data["command"] + '``\n\n' + output += help_data['description'].replace("*", r"\*") + '\n' + if help_data['arguments']: + number = 1 + for argument in help_data['arguments']: + title = 'Argument #' + str(number) + ' - ' + argument['name'] + output += title + '\n' + output += '~' * len(title) + '\n\n' + output += '**Type:** ' + argument['type'] + '\n\n' + if argument['description']: + output += argument['description'] + '\n\n' + if 'literal_description' in argument: + output += '::\n\n' + argument['literal_description'] + '\n' + number += 1 + if help_data['results']: + for result in help_data['results']: + if result and 'format' in result: + if result['format'] == 'table': + full_title = "Result" + if 'title_extension' in result: + full_title += result['title_extension'] + output += full_title + '\n' + output += '~' * len(full_title) + '\n\n' + output += self.table([result]) + '\n' + elif result['format'] == 'literal': + result_title = 'Result' + if 'title_extension' in result: + result_title += result['title_extension'] + output += result_title + '\n' + '~' * \ + len(result_title) + '\n\n::\n\n' + \ + result['text'] + '\n' + if help_data["examples"]: + output += 'Examples\n~~~~~~~~\n\n' + output += '\n.. highlight:: shell\n\n' + text = '' + for example_line in help_data['examples']: + if example_line.startswith('> '): + output += text + '::\n\n' + output += ' ' + example_line[2:].rstrip() + '\n\n' + text = '' + else: + text += example_line + return output + + def render_cmd_page(self, command, help_data): + command_file = command + ".rst" + with open(str(self.output_dir / command_file), "w") as cmd_file: + cmd_file.write(self.cmd_page(help_data)) + + def title(self, text, level=0): + underline_symbol = "=-~^"[level] + return text + "\n" + len(text) * underline_symbol + "\n" + + def index_page(self, all_commands): + output = "" + + output += self.title("RPC API Reference") + output += "\n" + + for category in sorted(all_commands): + output += self.title(category + " RPCs", level=1) + output += "\n" + if category == "Wallet": + output += """**Note:** the wallet RPCs are only available if Bitcoin Core was built +with wallet support, which is the default. + +""" + output += ".. toctree::\n" + output += " :maxdepth: 1\n\n" + for command in all_commands[category]: + cmd = command.split(" ")[0] + output += " " + cmd + "\n" + output += "\n" + + return output + + def render_overview_page(self, all_commands, render_version_info=True): + with open(str(self.output_dir / "index.rst"), "w") as index_file: + output = "" + output += self.license_header() + output += self.index_page(all_commands) + index_file.write(output) diff --git a/helpers/rpc/requirements.txt b/helpers/rpc/requirements.txt new file mode 100644 index 0000000..e5ed2a0 --- /dev/null +++ b/helpers/rpc/requirements.txt @@ -0,0 +1 @@ +docopt diff --git a/helpers/rpc/rpc_docs_helper b/helpers/rpc/rpc_docs_helper new file mode 100755 index 0000000..32c55ca --- /dev/null +++ b/helpers/rpc/rpc_docs_helper @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. +"""Usage: + rpc_docs_helper generate --output-dir= [--rst] [COMMAND] + rpc_docs_helper get-help COMMAND + rpc_docs_helper import-see-also MARKDOWN_DIR ANNOTATIONS_FILE + rpc_docs_helper clean-annotations ANNOTATIONS_FILE + rpc_docs_helper show-removed MARKDOWN_DIR + rpc_docs_helper mark-removed ANNOTATIONS_FILE VERSION COMMAND + rpc_docs_helper mark-added ANNOTATIONS_FILE VERSION COMMAND + rpc_docs_helper show-missing ANNOTATIONS_FILE + rpc_docs_helper update-references --docs-dir= + rpc_docs_helper -h | --help + +Commands: + generate Generate markdown documentation from client command line + help + get-help Show help for given command + import-see-also Import "see also" information from markdown into annotations + clean-annotations Remove empty objects from annotations + show-removed Show commands which are in markdown directory but not in + client help + mark-removed Mark command as removed in annotations + mark-added Mark command as added in annotations + show-missing Show commands which are in help but not in annotations + update-references Update references in references.md and _autocrossref.yaml + +Arguments: + COMMAND Name of the command to be rendered. If no command is given + the help is rendered for all commands. + ANNOTATIONS_FILE Name of annotations JSON file + MARKDOWN_DIR Name of directory with markdown files + VERSION Client version number + + For `generate`, `get-help`, and `show-removed` you need to set + the environment variable BITCOIN_CLI_CMD to a command able to run the cli. + This should include paths and required options if necessary, e.g. + `/my/path/bitcoin-cli -regtest`. + +Options: + -h, --help Show this help + --output-dir= Output directory where the rendered data is written + --docs-dir= Root directory of documentation repository + --rst Generate reStructuredText instead of Markdown +""" +from docopt import docopt +import sys + +from renderer_markdown import RendererMarkdown +from renderer_rst import RendererRst +from cli_bitcoin import CliBitcoin +from cli_controller import CliController + + +def main(): + arguments = docopt(__doc__) + output_dir = arguments["--output-dir"] + + controller = CliController() + if arguments["generate"]: + if arguments["--rst"]: + renderer = RendererRst(output_dir) + else: + renderer = RendererMarkdown(output_dir) + controller.generate(CliBitcoin(), renderer, arguments["COMMAND"]) + elif arguments["get-help"]: + controller.get_help(CliBitcoin(), arguments["COMMAND"]) + elif arguments["import-see-also"]: + controller.import_see_also( + arguments["MARKDOWN_DIR"], arguments["ANNOTATIONS_FILE"]) + elif arguments["clean-annotations"]: + controller.clean_annotations(arguments["ANNOTATIONS_FILE"]) + elif arguments["show-removed"]: + controller.show_removed(CliBitcoin(), arguments["MARKDOWN_DIR"]) + elif arguments["mark-removed"]: + controller.mark_removed(arguments["ANNOTATIONS_FILE"], + arguments["VERSION"], arguments["COMMAND"]) + elif arguments["mark-added"]: + controller.mark_added(arguments["ANNOTATIONS_FILE"], + arguments["VERSION"], arguments["COMMAND"]) + elif arguments["show-missing"]: + controller.show_missing(CliBitcoin(), arguments["ANNOTATIONS_FILE"]) + elif arguments["update-references"]: + controller.update_references(CliBitcoin(), arguments["--docs-dir"]) + else: + sys.exit("Unknown command. Exiting.") + + +if __name__ == '__main__': + main() diff --git a/helpers/rpc/test_data/abandontransaction b/helpers/rpc/test_data/abandontransaction new file mode 100644 index 0000000..a430cb4 --- /dev/null +++ b/helpers/rpc/test_data/abandontransaction @@ -0,0 +1,16 @@ +abandontransaction "txid" + +Mark in-wallet transaction as abandoned +This will mark this transaction and all its in-wallet descendants as abandoned which will allow +for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. +It only works on transactions which are not included in a block and are not currently in the mempool. +It has no effect on transactions which are already abandoned. + +Arguments: +1. "txid" (string, required) The transaction id + +Result: + +Examples: +> bitcoin-cli abandontransaction "1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d" +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "abandontransaction", "params": ["1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/addmultisigaddress b/helpers/rpc/test_data/addmultisigaddress new file mode 100644 index 0000000..41389d7 --- /dev/null +++ b/helpers/rpc/test_data/addmultisigaddress @@ -0,0 +1,31 @@ +addmultisigaddress nrequired ["key",...] ( "label" "address_type" ) + +Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. +Each key is a Bitcoin address or hex-encoded public key. +This functionality is only intended for use with non-watchonly addresses. +See `importaddress` for watchonly p2sh address support. +If 'label' is specified, assign address to that label. + +Arguments: +1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses. +2. "keys" (string, required) A json array of bitcoin addresses or hex-encoded public keys + [ + "address" (string) bitcoin address or hex-encoded public key + ..., + ] +3. "label" (string, optional) A label to assign the addresses to. +4. "address_type" (string, optional) The address type to use. Options are "legacy", "p2sh-segwit", and "bech32". Default is set by -addresstype. + +Result: +{ + "address":"multisigaddress", (string) The value of the new multisig address. + "redeemScript":"script" (string) The string value of the hex-encoded redemption script. +} + +Examples: + +Add a multisig address from 2 addresses +> bitcoin-cli addmultisigaddress 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]" + +As json rpc call +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "addmultisigaddress", "params": [2, "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/addnode b/helpers/rpc/test_data/addnode new file mode 100644 index 0000000..03f7940 --- /dev/null +++ b/helpers/rpc/test_data/addnode @@ -0,0 +1,14 @@ +addnode "node" "add|remove|onetry" + +Attempts to add or remove a node from the addnode list. +Or try a connection to a node once. +Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be +full nodes/support SegWit as other outbound peers are (though such peers will not be synced from). + +Arguments: +1. "node" (string, required) The node (see getpeerinfo for nodes) +2. "command" (string, required) 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once + +Examples: +> bitcoin-cli addnode "192.168.0.6:8333" "onetry" +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "addnode", "params": ["192.168.0.6:8333", "onetry"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/analyzepsbt b/helpers/rpc/test_data/analyzepsbt new file mode 100644 index 0000000..d38f65c --- /dev/null +++ b/helpers/rpc/test_data/analyzepsbt @@ -0,0 +1,36 @@ +analyzepsbt "psbt" + +Analyzes and provides information about the current status of a PSBT and its inputs + +Arguments: +1. psbt (string, required) A base64 string of a PSBT + +Result: +{ + "inputs" : [ (array of json objects) + { + "has_utxo" : true|false (boolean) Whether a UTXO is provided + "is_final" : true|false (boolean) Whether the input is finalized + "missing" : { (json object, optional) Things that are missing that are required to complete this input + "pubkeys" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing + ] + "signatures" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose signature is missing + ] + "redeemscript" : "hash" (string, optional) Hash160 of the redeemScript that is missing + "witnessscript" : "hash" (string, optional) SHA256 of the witnessScript that is missing + } + "next" : "role" (string, optional) Role of the next person that this input needs to go to + } + ,... + ] + "estimated_vsize" : vsize (numeric, optional) Estimated vsize of the final signed transaction + "estimated_feerate" : feerate (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled. + "fee" : fee (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled. + "next" : "role" (string) Role of the next person that this psbt needs to go to +} + +Examples: +> bitcoin-cli analyzepsbt "psbt" + diff --git a/helpers/rpc/test_data/deriveaddresses b/helpers/rpc/test_data/deriveaddresses new file mode 100644 index 0000000..7adc250 --- /dev/null +++ b/helpers/rpc/test_data/deriveaddresses @@ -0,0 +1,26 @@ +deriveaddresses "descriptor" ( range ) + +Derives one or more addresses corresponding to an output descriptor. +Examples of output descriptors are: + pkh() P2PKH outputs for the given pubkey + wpkh() Native segwit P2PKH outputs for the given pubkey + sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys + raw() Outputs whose scriptPubKey equals the specified hex scripts + +In the above, either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one +or more path elements separated by "/", where "h" represents a hardened child key. +For more information on output descriptors, see the documentation in the doc/descriptors.md file. + + https://example.com + +Arguments: +1. descriptor (string, required) The descriptor. +2. range (numeric or array, optional) If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive. + +Result: +[ address ] (array) the derived addresses + +Examples: +First three native segwit receive addresses +> bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu" "[0,2]" + diff --git a/helpers/rpc/test_data/examplecommand b/helpers/rpc/test_data/examplecommand new file mode 100644 index 0000000..ee44c37 --- /dev/null +++ b/helpers/rpc/test_data/examplecommand @@ -0,0 +1,45 @@ +examplecommand "arg" "object" ( "optional-arg" ) + +Returns something. + +Arguments: +1. "arg" (string, required) An argument. +2. "otherarg" (string, required) Line one + line two +3. "object" (array, required) Some data + [ (array of json objects) + { + "key": "value", (type) desc + } + ,... + ] +4. "optional-arg" (string, optional) An optional argument. +5. options (json, optional) + { + "rescan": , (xx) yy + } +6. "inputs" (array) A json array + [ + { + "txid":"id", (s) id + [vout_index,...] + } + ,... + ] +7. "outputs" (object) a json object + { + "address": x.xxx, (ns) a + "data": "hex" (s) data + ,... + } + +Note: Some important +information + +Result: +"hex" (string) the result, hex encoded + +Examples: +> bitcoin-cli examplecommand foo +> curl --user myusername --data-binary someargs + diff --git a/helpers/rpc/test_data/getbestblockhash b/helpers/rpc/test_data/getbestblockhash new file mode 100644 index 0000000..847bdf6 --- /dev/null +++ b/helpers/rpc/test_data/getbestblockhash @@ -0,0 +1,10 @@ +getbestblockhash + +Returns the hash of the best (tip) block in the longest blockchain. + +Result: +"hex" (string) the block hash hex encoded + +Examples: +> bitcoin-cli getbestblockhash +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/getblock b/helpers/rpc/test_data/getblock new file mode 100644 index 0000000..dd09e26 --- /dev/null +++ b/helpers/rpc/test_data/getblock @@ -0,0 +1,51 @@ +getblock "blockhash" ( verbosity ) + +If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'. +If verbosity is 1, returns an Object with information about block . +If verbosity is 2, returns an Object with information about block and information about each transaction. + +Arguments: +1. "blockhash" (string, required) The block hash +2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data + +Result (for verbosity = 0): +"data" (string) A string that is serialized, hex-encoded data for block 'hash'. + +Result (for verbosity = 1): +{ + "hash" : "hash", (string) the block hash (same as provided) + "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain + "size" : n, (numeric) The block size + "strippedsize" : n, (numeric) The block size excluding witness data + "weight" : n (numeric) The block weight as defined in BIP 141 + "height" : n, (numeric) The block height or index + "version" : n, (numeric) The block version + "versionHex" : "00000000", (string) The block version formatted in hexadecimal + "merkleroot" : "xxxx", (string) The merkle root + "tx" : [ (array of string) The transaction ids + "transactionid" (string) The transaction id + ,... + ], + "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) + "mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) + "nonce" : n, (numeric) The nonce + "bits" : "1d00ffff", (string) The bits + "difficulty" : x.xxx, (numeric) The difficulty + "chainwork" : "xxxx", (string) Expected number of hashes required to produce the chain up to this block (in hex) + "nTx" : n, (numeric) The number of transactions in the block. + "previousblockhash" : "hash", (string) The hash of the previous block + "nextblockhash" : "hash" (string) The hash of the next block +} + +Result (for verbosity = 2): +{ + ..., Same output as verbosity = 1. + "tx" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result. + ,... + ], + ,... Same output as verbosity = 1. +} + +Examples: +> bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/getblockstats b/helpers/rpc/test_data/getblockstats new file mode 100644 index 0000000..9ff8246 --- /dev/null +++ b/helpers/rpc/test_data/getblockstats @@ -0,0 +1,58 @@ +getblockstats hash_or_height ( stats ) + +Compute per block statistics for a given window. All amounts are in satoshis. +It won't work for some heights with pruning. +It won't work without -txindex for utxo_size_inc, *fee or *feerate stats. + +Arguments: +1. hash_or_height (string or numeric, required) The block hash or height of the target block +2. stats (json array, optional, default=all values) Values to plot (see result below) + [ + "height", (string) Selected statistic + "time", (string) Selected statistic + ... + ] + +Result: +{ (json object) + "avgfee": xxxxx, (numeric) Average fee in the block + "avgfeerate": xxxxx, (numeric) Average feerate (in satoshis per virtual byte) + "avgtxsize": xxxxx, (numeric) Average transaction size + "blockhash": xxxxx, (string) The block hash (to check for potential reorgs) + "feerate_percentiles": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte) + "10th_percentile_feerate", (numeric) The 10th percentile feerate + "25th_percentile_feerate", (numeric) The 25th percentile feerate + "50th_percentile_feerate", (numeric) The 50th percentile feerate + "75th_percentile_feerate", (numeric) The 75th percentile feerate + "90th_percentile_feerate", (numeric) The 90th percentile feerate + ], + "height": xxxxx, (numeric) The height of the block + "ins": xxxxx, (numeric) The number of inputs (excluding coinbase) + "maxfee": xxxxx, (numeric) Maximum fee in the block + "maxfeerate": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte) + "maxtxsize": xxxxx, (numeric) Maximum transaction size + "medianfee": xxxxx, (numeric) Truncated median fee in the block + "mediantime": xxxxx, (numeric) The block median time past + "mediantxsize": xxxxx, (numeric) Truncated median transaction size + "minfee": xxxxx, (numeric) Minimum fee in the block + "minfeerate": xxxxx, (numeric) Minimum feerate (in satoshis per virtual byte) + "mintxsize": xxxxx, (numeric) Minimum transaction size + "outs": xxxxx, (numeric) The number of outputs + "subsidy": xxxxx, (numeric) The block subsidy + "swtotal_size": xxxxx, (numeric) Total size of all segwit transactions + "swtotal_weight": xxxxx, (numeric) Total weight of all segwit transactions divided by segwit scale factor (4) + "swtxs": xxxxx, (numeric) The number of segwit transactions + "time": xxxxx, (numeric) The block time + "total_out": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee]) + "total_size": xxxxx, (numeric) Total size of all non-coinbase transactions + "total_weight": xxxxx, (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4) + "totalfee": xxxxx, (numeric) The fee total + "txs": xxxxx, (numeric) The number of transactions (excluding coinbase) + "utxo_increase": xxxxx, (numeric) The increase/decrease in the number of unspent outputs + "utxo_size_inc": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar) +} + +Examples: +> bitcoin-cli getblockstats 1000 '["minfeerate","avgfeerate"]' +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockstats", "params": [1000 '["minfeerate","avgfeerate"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/helpers/rpc/test_data/getmemoryinfo b/helpers/rpc/test_data/getmemoryinfo new file mode 100644 index 0000000..ab184e3 --- /dev/null +++ b/helpers/rpc/test_data/getmemoryinfo @@ -0,0 +1,25 @@ +getmemoryinfo ("mode") +Returns an object containing information about memory usage. +Arguments: +1. "mode" determines what kind of information is returned. This argument is optional, the default mode is "stats". + - "stats" returns general statistics about memory usage in the daemon. + - "mallocinfo" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+). + +Result (mode "stats"): +{ + "locked": { (json object) Information about locked memory manager + "used": xxxxx, (numeric) Number of bytes used + "free": xxxxx, (numeric) Number of bytes available in current arenas + "total": xxxxxxx, (numeric) Total number of bytes managed + "locked": xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk. + "chunks_used": xxxxx, (numeric) Number allocated chunks + "chunks_free": xxxxx, (numeric) Number unused chunks + } +} + +Result (mode "mallocinfo"): +"..." + +Examples: +> bitcoin-cli getmemoryinfo +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/gettxoutproof b/helpers/rpc/test_data/gettxoutproof new file mode 100644 index 0000000..5ed7748 --- /dev/null +++ b/helpers/rpc/test_data/gettxoutproof @@ -0,0 +1,19 @@ +gettxoutproof ["txid",...] ( blockhash ) + +Returns a hex-encoded proof that "txid" was included in a block. + +NOTE: By default this function only works sometimes. This is when there is an +unspent output in the utxo for this transaction. To make it always work, +you need to maintain a transaction index, using the -txindex command line option or +specify the block in which the transaction is included manually (by blockhash). + +Arguments: +1. "txids" (string) A json array of txids to filter + [ + "txid" (string) A transaction hash + ,... + ] +2. "blockhash" (string, optional) If specified, looks for txid in the block with this hash + +Result: +"data" (string) A string that is a serialized, hex-encoded data for the proof. diff --git a/helpers/rpc/test_data/markdown/abandontransaction.md b/helpers/rpc/test_data/markdown/abandontransaction.md new file mode 100644 index 0000000..9544dea --- /dev/null +++ b/helpers/rpc/test_data/markdown/abandontransaction.md @@ -0,0 +1,56 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/abandontransaction.md" %} + +##### AbandonTransaction +{% include helpers/subhead-links.md %} + +{% assign summary_abandonTransaction="marks an in-wallet transaction and all its in-wallet descendants as abandoned. This allows their inputs to be respent." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.12.0* + +The `abandontransaction` RPC {{summary_abandonTransaction}} + +Mark in-wallet transaction as abandoned +This will mark this transaction and all its in-wallet descendants as abandoned which will allow +for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. + +It only works on transactions which are not included in a block and are not currently in the mempool. + +It has no effect on transactions which are already abandoned. + +*Parameter #1---txid* + +{% itemplate ntpd1 %} +- n: "txid" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The transaction id" + +{% enditemplate %} + +*Result---`null` on success* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "null" + p: "Required
(exactly 1)" + d: "JSON `null` when the command was successfull or a JSON with an error field on error." + +{% enditemplate %} + +*Example* + +{% highlight bash %} +bitcoin-cli abandontransaction "1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d" +{% endhighlight %} + +*See also* + +* [SendRawTransaction][rpc sendrawtransaction]: {{summary_sendRawTransaction}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/addmultisigaddress.md b/helpers/rpc/test_data/markdown/addmultisigaddress.md new file mode 100644 index 0000000..e0a0d3f --- /dev/null +++ b/helpers/rpc/test_data/markdown/addmultisigaddress.md @@ -0,0 +1,102 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/addmultisigaddress.md" %} + +##### AddMultiSigAddress +{% include helpers/subhead-links.md %} + +{% assign summary_addMultiSigAddress="adds a P2SH multisig address to the wallet." %} + +{% autocrossref %} + +*Requires wallet support.* + +The `addmultisigaddress` RPC {{summary_addMultiSigAddress}} + +Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. + +Each key is a Bitcoin address or hex-encoded public key. + +This functionality is only intended for use with non-watchonly addresses. + +See `importaddress` for watchonly p2sh address support. + +If 'label' is specified, assign address to that label. + +*Parameter #1---nrequired* + +{% itemplate ntpd1 %} +- n: "nrequired" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The number of required signatures out of the n keys or addresses." + +{% enditemplate %} + +*Parameter #2---keys* + +{% itemplate ntpd1 %} +- n: "keys" + t: "string" + p: "Required
(exactly 1)" + d: "A json array of bitcoin addresses or hex-encoded public keys" + +{% enditemplate %} + +{% endautocrossref %} + + [ + "address" (string) bitcoin address or hex-encoded public key + ..., + ] + +{% autocrossref %} + +*Parameter #3---label* + +{% itemplate ntpd1 %} +- n: "label" + t: "string" + p: "Optional" + d: "A label to assign the addresses to." + +{% enditemplate %} + +*Parameter #4---address_type* + +{% itemplate ntpd1 %} +- n: "address_type" + t: "string" + p: "Optional" + d: "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype." + +{% enditemplate %} + +*Result* + +{% endautocrossref %} + + { + "address":"multisigaddress", (string) The value of the new multisig address. + "redeemScript":"script" (string) The string value of the hex-encoded redemption script. + } + +{% autocrossref %} + +*Example* + +Add a multisig address from 2 addresses + +{% highlight bash %} +bitcoin-cli addmultisigaddress 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]" +{% endhighlight %} + +*See also* + +* [CreateMultiSig][rpc createmultisig]: {{summary_createMultiSig}} +* [DecodeScript][rpc decodescript]: {{summary_decodeScript}} +* [Pay-To-Script-Hash (P2SH)][/en/glossary/p2sh-address] + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/addnode.md b/helpers/rpc/test_data/markdown/addnode.md new file mode 100644 index 0000000..1d7b32e --- /dev/null +++ b/helpers/rpc/test_data/markdown/addnode.md @@ -0,0 +1,61 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/addnode.md" %} + +##### AddNode +{% include helpers/subhead-links.md %} + +{% assign summary_addNode="attempts to add or remove a node from the addnode list." %} + +{% autocrossref %} + +The `addnode` RPC {{summary_addNode}} + +Or try a connection to a node once. + +Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be +full nodes/support SegWit as other outbound peers are (though such peers will not be synced from). + +*Parameter #1---node* + +{% itemplate ntpd1 %} +- n: "node" + t: "string" + p: "Required
(exactly 1)" + d: "The node (see getpeerinfo for nodes). The node to add as a string in the form of `:`. The IP address may be a hostname resolvable through DNS, an IPv4 address, an IPv4-as-IPv6 address, or an IPv6 address" + +{% enditemplate %} + +*Parameter #2---command* + +{% itemplate ntpd1 %} +- n: "command" + t: "string" + p: "Required
(exactly 1)" + d: "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once. What to do with the IP address above. Options are:
• `add` to add a node to the addnode list. Up to 8 nodes can be added additional to the default 8 nodes. Not limited by `-maxconnections`
• `remove` to remove a node from the list. If currently connected, this will disconnect immediately
• `onetry` to immediately attempt connection to the node even if the outgoing connection slots are full; this will only attempt the connection once" + +{% enditemplate %} + +*Result---`null` on success* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "null" + p: "Required
(exactly 1)" + d: "JSON `null` when the command was successfull or a JSON with an error field on error." + +{% enditemplate %} + +*Example* + +{% highlight bash %} +bitcoin-cli addnode "192.168.0.6:8333" "onetry" +{% endhighlight %} + +*See also* + +* [GetAddedNodeInfo][rpc getaddednodeinfo]: {{summary_getAddedNodeInfo}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/analyzepsbt.md b/helpers/rpc/test_data/markdown/analyzepsbt.md new file mode 100644 index 0000000..29be1d0 --- /dev/null +++ b/helpers/rpc/test_data/markdown/analyzepsbt.md @@ -0,0 +1,65 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/analyzepsbt.md" %} + +##### AnalyzePsbt +{% include helpers/subhead-links.md %} + +{% assign summary_analyzePsbt="analyzes and provides information about the current status of a PSBT and its inputs." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.18.0* + +The `analyzepsbt` RPC {{summary_analyzePsbt}} + +*Parameter #1---psbt* + +{% itemplate ntpd1 %} +- n: "psbt" + t: "string" + p: "Required
(exactly 1)" + d: "A base64 string of a PSBT" + +{% enditemplate %} + +*Result* + +{% endautocrossref %} + + { + "inputs" : [ (array of json objects) + { + "has_utxo" : true|false (boolean) Whether a UTXO is provided + "is_final" : true|false (boolean) Whether the input is finalized + "missing" : { (json object, optional) Things that are missing that are required to complete this input + "pubkeys" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing + ] + "signatures" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose signature is missing + ] + "redeemscript" : "hash" (string, optional) Hash160 of the redeemScript that is missing + "witnessscript" : "hash" (string, optional) SHA256 of the witnessScript that is missing + } + "next" : "role" (string, optional) Role of the next person that this input needs to go to + } + ,... + ] + "estimated_vsize" : vsize (numeric, optional) Estimated vsize of the final signed transaction + "estimated_feerate" : feerate (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled. + "fee" : fee (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled. + "next" : "role" (string) Role of the next person that this psbt needs to go to + } + +{% autocrossref %} + +*Example* + +{% highlight bash %} +bitcoin-cli analyzepsbt "psbt" +{% endhighlight %} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/deriveaddresses.md b/helpers/rpc/test_data/markdown/deriveaddresses.md new file mode 100644 index 0000000..9185570 --- /dev/null +++ b/helpers/rpc/test_data/markdown/deriveaddresses.md @@ -0,0 +1,76 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/deriveaddresses.md" %} + +##### DeriveAddresses +{% include helpers/subhead-links.md %} + +{% assign summary_deriveAddresses="derives one or more addresses corresponding to an output descriptor." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.18.0* + +The `deriveaddresses` RPC {{summary_deriveAddresses}} + +Examples of output descriptors are: + +{% endautocrossref %} + + pkh() P2PKH outputs for the given pubkey + wpkh() Native segwit P2PKH outputs for the given pubkey + sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys + raw() Outputs whose scriptPubKey equals the specified hex scripts + +{% autocrossref %} + +In the above, either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one +or more path elements separated by "/", where "h" represents a hardened child key. + +For more information on output descriptors, see the documentation in the doc/descriptors.md file. + +{% endautocrossref %} + + https://example.com + +{% autocrossref %} + +*Parameter #1---descriptor* + +{% itemplate ntpd1 %} +- n: "descriptor" + t: "string" + p: "Required
(exactly 1)" + d: "The descriptor." + +{% enditemplate %} + +*Parameter #2---range* + +{% itemplate ntpd1 %} +- n: "range" + t: "numeric or array" + p: "Optional" + d: "If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive." + +{% enditemplate %} + +*Result* + +{% endautocrossref %} + + [ address ] (array) the derived addresses + +{% autocrossref %} + +*Example* + +First three native segwit receive addresses + +{% highlight bash %} +bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu" "[0,2]" +{% endhighlight %} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/getbestblockhash.md b/helpers/rpc/test_data/markdown/getbestblockhash.md new file mode 100644 index 0000000..c496ffc --- /dev/null +++ b/helpers/rpc/test_data/markdown/getbestblockhash.md @@ -0,0 +1,39 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/getbestblockhash.md" %} + +##### GetBestBlockHash +{% include helpers/subhead-links.md %} + +{% assign summary_getBestBlockHash="returns the hash of the best (tip) block in the longest blockchain." %} + +{% autocrossref %} + +The `getbestblockhash` RPC {{summary_getBestBlockHash}} + +*Parameters: none* + +*Result* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "the block hash hex encoded" + +{% enditemplate %} + +*Example* + +{% highlight bash %} +bitcoin-cli getbestblockhash +{% endhighlight %} + +*See also* + +* [GetBlock][rpc getblock]: {{summary_getBlock}} +* [GetBlockHash][rpc getblockhash]: {{summary_getBlockHash}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/getblock.md b/helpers/rpc/test_data/markdown/getblock.md new file mode 100644 index 0000000..ca58dda --- /dev/null +++ b/helpers/rpc/test_data/markdown/getblock.md @@ -0,0 +1,108 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/getblock.md" %} + +##### GetBlock +{% include helpers/subhead-links.md %} + +{% assign summary_getBlock="gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block." %} + +{% autocrossref %} + +The `getblock` RPC {{summary_getBlock}} + +If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'. + +If verbosity is 1, returns an Object with information about block 'hash'. + +If verbosity is 2, returns an Object with information about block 'hash' and information about each transaction. + +*Parameter #1---blockhash* + +{% itemplate ntpd1 %} +- n: "blockhash" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "The block hash" + +{% enditemplate %} + +*Parameter #2---verbosity* + +{% itemplate ntpd1 %} +- n: "verbosity" + t: "number (int)" + p: "Optional
Default=1" + d: "0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data" + +{% enditemplate %} + +*Result---(for verbosity = 0)* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "A string that is serialized, hex-encoded data for block 'hash'." + +{% enditemplate %} + +*Result---(for verbosity = 1)* + +{% endautocrossref %} + + { + "hash" : "hash", (string) the block hash (same as provided) + "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain + "size" : n, (numeric) The block size + "strippedsize" : n, (numeric) The block size excluding witness data + "weight" : n (numeric) The block weight as defined in BIP 141 + "height" : n, (numeric) The block height or index + "version" : n, (numeric) The block version + "versionHex" : "00000000", (string) The block version formatted in hexadecimal + "merkleroot" : "xxxx", (string) The merkle root + "tx" : [ (array of string) The transaction ids + "transactionid" (string) The transaction id + ,... + ], + "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) + "mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) + "nonce" : n, (numeric) The nonce + "bits" : "1d00ffff", (string) The bits + "difficulty" : x.xxx, (numeric) The difficulty + "chainwork" : "xxxx", (string) Expected number of hashes required to produce the chain up to this block (in hex) + "nTx" : n, (numeric) The number of transactions in the block. + "previousblockhash" : "hash", (string) The hash of the previous block + "nextblockhash" : "hash" (string) The hash of the next block + } + +{% autocrossref %} + +*Result---(for verbosity = 2)* + +{% endautocrossref %} + + { + ..., Same output as verbosity = 1. + "tx" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result. + ,... + ], + ,... Same output as verbosity = 1. + } + +{% autocrossref %} + +*Example* + +{% highlight bash %} +bitcoin-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" +{% endhighlight %} + +*See also* + +* [GetBlockHash][rpc getblockhash]: {{summary_getBlockHash}} +* [GetBestBlockHash][rpc getbestblockhash]: {{summary_getBestBlockHash}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/getmemoryinfo.md b/helpers/rpc/test_data/markdown/getmemoryinfo.md new file mode 100644 index 0000000..1bcc025 --- /dev/null +++ b/helpers/rpc/test_data/markdown/getmemoryinfo.md @@ -0,0 +1,55 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/getmemoryinfo.md" %} + +##### GetMemoryInfo +{% include helpers/subhead-links.md %} + +{% assign summary_getMemoryInfo="returns an object containing information about memory usage." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.14.0* + +The `getmemoryinfo` RPC {{summary_getMemoryInfo}} + +*Parameters: none* + +*Result---(mode "stats")* + +{% endautocrossref %} + + { + "locked": { (json object) Information about locked memory manager + "used": xxxxx, (numeric) Number of bytes used + "free": xxxxx, (numeric) Number of bytes available in current arenas + "total": xxxxxxx, (numeric) Total number of bytes managed + "locked": xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk. + "chunks_used": xxxxx, (numeric) Number allocated chunks + "chunks_free": xxxxx, (numeric) Number unused chunks + } + } + +{% autocrossref %} + +*Result---(mode "mallocinfo")* + +{% endautocrossref %} + + "..." + +{% autocrossref %} + +*Example* + +{% highlight bash %} +bitcoin-cli getmemoryinfo +{% endhighlight %} + +*See also* + +* [GetMemPoolInfo][rpc getmempoolinfo]: {{summary_getMemPoolInfo}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/gettxoutproof.md b/helpers/rpc/test_data/markdown/gettxoutproof.md new file mode 100644 index 0000000..b41f919 --- /dev/null +++ b/helpers/rpc/test_data/markdown/gettxoutproof.md @@ -0,0 +1,68 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/gettxoutproof.md" %} + +##### GetTxOutProof +{% include helpers/subhead-links.md %} + +{% assign summary_getTxOutProof="returns a hex-encoded proof that "txid" was included in a block." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.11.0* + +The `gettxoutproof` RPC {{summary_getTxOutProof}} + +NOTE: By default this function only works sometimes. This is when there is an +unspent output in the utxo for this transaction. To make it always work, +you need to maintain a transaction index, using the -txindex command line option or +specify the block in which the transaction is included manually (by blockhash). + +*Parameter #1---txids* + +{% itemplate ntpd1 %} +- n: "txids" + t: "string" + p: "Required" + d: "A json array of txids to filter" + +{% enditemplate %} + +{% endautocrossref %} + + [ + "txid" (string) A transaction hash + ,... + ] + +{% autocrossref %} + +*Parameter #2---blockhash* + +{% itemplate ntpd1 %} +- n: "blockhash" + t: "string" + p: "Optional" + d: "If specified, looks for txid in the block with this hash" + +{% enditemplate %} + +*Result* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "string (hex)" + p: "Required
(exactly 1)" + d: "A string that is a serialized, hex-encoded data for the proof." + +{% enditemplate %} + +*See also* + +* [VerifyTxOutProof][rpc verifytxoutproof]: {{summary_verifyTxOutProof}} +* [`merkleblock` message][merkleblock message]: A description of the + format used for the proof. + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/ping.md b/helpers/rpc/test_data/markdown/ping.md new file mode 100644 index 0000000..69e42f6 --- /dev/null +++ b/helpers/rpc/test_data/markdown/ping.md @@ -0,0 +1,42 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/ping.md" %} + +##### Ping {#ping-rpc} +{% include helpers/subhead-links.md %} + +{% assign summary_ping-rpc="requests that a ping be sent to all other nodes, to measure ping time." %} + +{% autocrossref %} + +The `ping` RPC {{summary_ping-rpc}} + +Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds. + +Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping. + +*Parameters: none* + +*Result---`null` on success* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "null" + p: "Required
(exactly 1)" + d: "JSON `null` when the command was successfull or a JSON with an error field on error." + +{% enditemplate %} + +*Example* + +{% highlight bash %} +bitcoin-cli ping +{% endhighlight %} + +*See also* + +* [GetPeerInfo][rpc getpeerinfo]: {{summary_getPeerInfo}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/markdown/pruneblockchain.md b/helpers/rpc/test_data/markdown/pruneblockchain.md new file mode 100644 index 0000000..7b55ddd --- /dev/null +++ b/helpers/rpc/test_data/markdown/pruneblockchain.md @@ -0,0 +1,49 @@ +{% comment %} +This file is licensed under the MIT License (MIT) available on +http://opensource.org/licenses/MIT. +{% endcomment %} +{% assign filename="_data/devdocs/en/bitcoin-core/rpcs/rpcs/pruneblockchain.md" %} + +##### PruneBlockChain +{% include helpers/subhead-links.md %} + +{% assign summary_pruneBlockChain="does PruneBlockChain." %} + +{% autocrossref %} + +*Added in Bitcoin Core 0.14.0* + +The `pruneblockchain` RPC {{summary_pruneBlockChain}} + +*Parameter #1---height* + +{% itemplate ntpd1 %} +- n: "height" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The block height to prune up to. May be set to a discrete height, or a unix timestamp + to prune blocks whose block time is at least 2 hours older than the provided timestamp." + +{% enditemplate %} + +*Result* + +{% itemplate ntpd1 %} +- n: "`result`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "Height of the last block pruned." + +{% enditemplate %} + +*Example* + +{% highlight bash %} +bitcoin-cli pruneblockchain 1000 +{% endhighlight %} + +*See also* + +* [ImportPrunedFunds][rpc importprunedfunds]: {{summary_importPrunedFunds}} + +{% endautocrossref %} diff --git a/helpers/rpc/test_data/ping b/helpers/rpc/test_data/ping new file mode 100644 index 0000000..c99e059 --- /dev/null +++ b/helpers/rpc/test_data/ping @@ -0,0 +1,10 @@ +ping + +Requests that a ping be sent to all other nodes, to measure ping time. +Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds. +Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping. + +Examples: +> bitcoin-cli ping +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "ping", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/helpers/rpc/test_data/pruneblockchain b/helpers/rpc/test_data/pruneblockchain new file mode 100644 index 0000000..6e1ca30 --- /dev/null +++ b/helpers/rpc/test_data/pruneblockchain @@ -0,0 +1,12 @@ +pruneblockchain + +Arguments: +1. "height" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp + to prune blocks whose block time is at least 2 hours older than the provided timestamp. + +Result: +n (numeric) Height of the last block pruned. + +Examples: +> bitcoin-cli pruneblockchain 1000 +> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "pruneblockchain", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/helpers/rpc/test_data/rst/analyzepsbt.rst b/helpers/rpc/test_data/rst/analyzepsbt.rst new file mode 100644 index 0000000..3931797 --- /dev/null +++ b/helpers/rpc/test_data/rst/analyzepsbt.rst @@ -0,0 +1,57 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +analyzepsbt +=========== + +``analyzepsbt "psbt"`` + +Analyzes and provides information about the current status of a PSBT and its inputs + +Argument #1 - psbt +~~~~~~~~~~~~~~~~~~ + +**Type:** string, required + +A base64 string of a PSBT + +Result +~~~~~~ + +:: + + { + "inputs" : [ (array of json objects) + { + "has_utxo" : true|false (boolean) Whether a UTXO is provided + "is_final" : true|false (boolean) Whether the input is finalized + "missing" : { (json object, optional) Things that are missing that are required to complete this input + "pubkeys" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing + ] + "signatures" : [ (array, optional) + "keyid" (string) Public key ID, hash160 of the public key, of a public key whose signature is missing + ] + "redeemscript" : "hash" (string, optional) Hash160 of the redeemScript that is missing + "witnessscript" : "hash" (string, optional) SHA256 of the witnessScript that is missing + } + "next" : "role" (string, optional) Role of the next person that this input needs to go to + } + ,... + ] + "estimated_vsize" : vsize (numeric, optional) Estimated vsize of the final signed transaction + "estimated_feerate" : feerate (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled. + "fee" : fee (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled. + "next" : "role" (string) Role of the next person that this psbt needs to go to + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli analyzepsbt "psbt" + diff --git a/helpers/rpc/test_data/rst/deriveaddresses.rst b/helpers/rpc/test_data/rst/deriveaddresses.rst new file mode 100644 index 0000000..e9b37f5 --- /dev/null +++ b/helpers/rpc/test_data/rst/deriveaddresses.rst @@ -0,0 +1,55 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +deriveaddresses +=============== + +``deriveaddresses "descriptor" ( range )`` + +Derives one or more addresses corresponding to an output descriptor. + +Examples of output descriptors are: + + pkh() P2PKH outputs for the given pubkey + wpkh() Native segwit P2PKH outputs for the given pubkey + sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys + raw() Outputs whose scriptPubKey equals the specified hex scripts + +In the above, either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one +or more path elements separated by "/", where "h" represents a hardened child key. + +For more information on output descriptors, see the documentation in the doc/descriptors.md file. + + https://example.com + +Argument #1 - descriptor +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, required + +The descriptor. + +Argument #2 - range +~~~~~~~~~~~~~~~~~~~ + +**Type:** numeric or array, optional + +If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive. + +Result +~~~~~~ + +:: + + [ address ] (array) the derived addresses + +Examples +~~~~~~~~ + + +.. highlight:: shell + +First three native segwit receive addresses:: + + bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu" "[0,2]" + diff --git a/helpers/rpc/test_data/rst/getblockstats.rst b/helpers/rpc/test_data/rst/getblockstats.rst new file mode 100644 index 0000000..72a917e --- /dev/null +++ b/helpers/rpc/test_data/rst/getblockstats.rst @@ -0,0 +1,93 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +getblockstats +============= + +``getblockstats hash_or_height ( stats )`` + +Compute per block statistics for a given window. All amounts are in satoshis. + +It won't work for some heights with pruning. + +It won't work without -txindex for utxo_size_inc, \*fee or \*feerate stats. + +Argument #1 - hash_or_height +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string or numeric, required + +The block hash or height of the target block + +Argument #2 - stats +~~~~~~~~~~~~~~~~~~~ + +**Type:** json array, optional, default=all values + +Values to plot (see result below) + +:: + + [ + "height", (string) Selected statistic + "time", (string) Selected statistic + ... + ] + +Result +~~~~~~ + +:: + + { (json object) + "avgfee": xxxxx, (numeric) Average fee in the block + "avgfeerate": xxxxx, (numeric) Average feerate (in satoshis per virtual byte) + "avgtxsize": xxxxx, (numeric) Average transaction size + "blockhash": xxxxx, (string) The block hash (to check for potential reorgs) + "feerate_percentiles": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte) + "10th_percentile_feerate", (numeric) The 10th percentile feerate + "25th_percentile_feerate", (numeric) The 25th percentile feerate + "50th_percentile_feerate", (numeric) The 50th percentile feerate + "75th_percentile_feerate", (numeric) The 75th percentile feerate + "90th_percentile_feerate", (numeric) The 90th percentile feerate + ], + "height": xxxxx, (numeric) The height of the block + "ins": xxxxx, (numeric) The number of inputs (excluding coinbase) + "maxfee": xxxxx, (numeric) Maximum fee in the block + "maxfeerate": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte) + "maxtxsize": xxxxx, (numeric) Maximum transaction size + "medianfee": xxxxx, (numeric) Truncated median fee in the block + "mediantime": xxxxx, (numeric) The block median time past + "mediantxsize": xxxxx, (numeric) Truncated median transaction size + "minfee": xxxxx, (numeric) Minimum fee in the block + "minfeerate": xxxxx, (numeric) Minimum feerate (in satoshis per virtual byte) + "mintxsize": xxxxx, (numeric) Minimum transaction size + "outs": xxxxx, (numeric) The number of outputs + "subsidy": xxxxx, (numeric) The block subsidy + "swtotal_size": xxxxx, (numeric) Total size of all segwit transactions + "swtotal_weight": xxxxx, (numeric) Total weight of all segwit transactions divided by segwit scale factor (4) + "swtxs": xxxxx, (numeric) The number of segwit transactions + "time": xxxxx, (numeric) The block time + "total_out": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee]) + "total_size": xxxxx, (numeric) Total size of all non-coinbase transactions + "total_weight": xxxxx, (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4) + "totalfee": xxxxx, (numeric) The fee total + "txs": xxxxx, (numeric) The number of transactions (excluding coinbase) + "utxo_increase": xxxxx, (numeric) The increase/decrease in the number of unspent outputs + "utxo_size_inc": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar) + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli getblockstats 1000 '["minfeerate","avgfeerate"]' + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockstats", "params": [1000 '["minfeerate","avgfeerate"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/helpers/rpc/test_help_data.py b/helpers/rpc/test_help_data.py new file mode 100644 index 0000000..bbcd949 --- /dev/null +++ b/helpers/rpc/test_help_data.py @@ -0,0 +1,38 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +from help_data import display_name, capitalize, uncapitalize + + +def test_display_name(): + assert display_name("abandontransaction") == "AbandonTransaction" + assert display_name("addmultisigaddress") == "AddMultiSigAddress" + assert display_name("addnode") == "AddNode" + assert display_name("disconnectnode") == "DisconnectNode" + assert display_name("listsinceblock") == "ListSinceBlock" + assert display_name("listwallets") == "ListWallets" + assert display_name("setban") == "SetBan" + assert display_name("signmessagewithprivkey") == "SignMessageWithPrivKey" + assert display_name("listaccounts") == "ListAccounts" + assert display_name("listtransactions") == "ListTransactions" + assert display_name("listwallets") == "ListWallets" + assert display_name("getaddressesbyaccount") == "GetAddressesByAccount" + assert display_name("submitheader") == "SubmitHeader" + assert display_name("getnodeaddresses") == "GetNodeAddresses" + assert display_name("joinpsbts") == "JoinPsbts" + assert display_name("utxoupdatepsbt") == "UtxoUpdatePsbt" + assert display_name("deriveaddresses") == "DeriveAddresses" + assert display_name("setlabel") == "SetLabel" + assert display_name("listlabels") == "ListLabels" + + +def test_capitalize(): + assert capitalize("word") == "Word" + assert capitalize("x") == "X" + assert capitalize("") == "" + + +def test_uncapitalize(): + assert uncapitalize("Word") == "word" + assert uncapitalize("X") == "x" + assert uncapitalize("") == "" diff --git a/helpers/rpc/test_help_parser.py b/helpers/rpc/test_help_parser.py new file mode 100644 index 0000000..b2d49ce --- /dev/null +++ b/helpers/rpc/test_help_parser.py @@ -0,0 +1,125 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. +from pathlib import Path +import os + +from help_parser import HelpParser, CommandList + +test_data_dir = Path(os.path.dirname(__file__)) / "test_data" + + +def test_parse_help(): + with open(str(test_data_dir / "examplecommand")) as file: + input = file.read() + result = HelpParser().parse_help_command(input) + assert result["command"] == 'examplecommand "arg" "object" ( "optional-arg" )' + assert result["description"] == "Returns something.\n" + assert len(result["arguments"]) == 7 + assert result["arguments"][0] == { + 'name': 'arg', 'type': 'string, required', + 'description': 'An argument.'} + assert result["arguments"][1] == { + 'name': 'otherarg', 'type': 'string, required', + 'description': 'Line one\n line two'} + assert result["arguments"][2] == { + 'name': 'object', + 'type': 'array, required', + 'description': 'Some data', + 'literal_description': ' [ (array of json objects)\n' + ' {\n' + ' "key": "value", (type) desc\n' + ' }\n' + ' ,...\n' + ' ]\n', + } + assert result["arguments"][3] == { + 'name': 'optional-arg', 'type': 'string, optional', + 'description': 'An optional argument.'} + assert result["arguments"][4] == { + 'name': 'options', + 'type': 'json, optional', + 'description': '', + 'literal_description': ' {\n' + ' "rescan": , (xx) yy\n' + ' }\n', + } + assert result["arguments"][5] == { + 'name': 'inputs', + 'type': 'array', + 'description': 'A json array', + 'literal_description': ' [\n' + ' {\n' + ' "txid":"id", (s) id\n' + ' [vout_index,...]\n' + ' }\n' + ' ,...\n' + ' ]\n', + } + assert result["arguments"][6] == { + 'name': 'outputs', + 'type': 'object', + 'description': 'a json object', + 'literal_description': ' {\n' + ' "address": x.xxx, (ns) a\n' + ' "data": "hex" (s) data\n' + ' ,...\n' + ' }\n', + } + assert result["results"] == [{'format': 'table', 'title_extension': '', + 'name': "hex", "type": "string", + "description": "the result, hex encoded"}] + assert result["examples"] == ["> bitcoin-cli examplecommand foo", + "> curl --user myusername --data-binary someargs"] + + +def test_parse_help_result_with_quotes(): + assert HelpParser().parse_help_result('"hex" (string) some thing') == { + 'format': 'table', 'name': 'hex', 'type': 'string', 'description': 'some thing'} + + +def test_parse_help_result_without_quotes(): + assert HelpParser().parse_help_result('hex (string) some thing') == { + 'format': 'table', 'name': 'hex', 'type': 'string', 'description': 'some thing'} + + +def test_parse_help_argument_with_quotes(): + assert HelpParser().parse_help_argument('1. "inputs" (hex, required) some arg.') == { + 'name': 'inputs', 'type': 'hex, required', 'description': 'some arg.'} + + +def test_parse_help_argument_without_quotes(): + assert HelpParser().parse_help_argument('1. inputs (hex, required) some arg.') == { + 'name': 'inputs', 'type': 'hex, required', 'description': 'some arg.'} + + +def test_parse_help_arguments_without_description(): + assert HelpParser().parse_help_argument('2. options (object, optional)') == { + 'name': 'options', 'type': 'object, optional', 'description': ''} + + +def test_check_and_set_json_level(): + parser = HelpParser() + + def check(line, expected_json_level): + parser.check_opening_json(line) + assert parser.json_level == expected_json_level + + check(' x', 0) + check(' {', 1) + check(' [', 2) + check(' []', 2) + check(' {}', 2) + check(' {},', 2) + check(' [],', 2) + + +def test_command_list(): + cmds = CommandList() + cmds.add("group1", "cmd1") + cmds.add("group1", "cmd2 arg") + cmds.add("group2", "anothercmd") + assert cmds.grouped() == { + "group1": ["cmd1", "cmd2 arg"], + "group2": ["anothercmd"] + } + assert cmds.flat() == ["anothercmd", "cmd1", "cmd2"] diff --git a/helpers/rpc/test_renderer_markdown.py b/helpers/rpc/test_renderer_markdown.py new file mode 100644 index 0000000..e38cae4 --- /dev/null +++ b/helpers/rpc/test_renderer_markdown.py @@ -0,0 +1,72 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. +from renderer_markdown import RendererMarkdown +from help_parser import HelpParser +from pathlib import Path +import os + +test_data_dir = Path(os.path.dirname(__file__)) / "test_data" + + +def test_process_command_help(): + cmds = [ + 'abandontransaction', + 'addmultisigaddress', + 'addnode', + 'getbestblockhash', + 'getblock', + 'gettxoutproof', + 'pruneblockchain', + 'getmemoryinfo', + 'analyzepsbt', + 'deriveaddresses', + 'ping', + ] + for cmd in cmds: + with open(str(test_data_dir / cmd)) as file: + input = file.read() + help_data = HelpParser().parse_help_command(input) + with open(str(test_data_dir / "markdown" / (cmd + ".md"))) as file: + expected_output = file.read() + assert RendererMarkdown("").process_command_help( + help_data) == expected_output + + +def test_code_block(): + r = RendererMarkdown("") + + assert r.code_block("abc") == " abc\n" + assert r.code_block(" def") == " def\n" + assert r.code_block(" xxx\n yyy") == " xxx\n yyy\n" + assert r.code_block(" {\n x\n }\n") == " {\n x\n }\n" + assert r.code_block( + " {\n x\n }\n") == " {\n x\n }\n" + + +def test_yaml_escape(): + r = RendererMarkdown("") + + assert r.yaml_escape('a "string"') == 'a \\"string\\"' + + +def test_split_description(): + r = RendererMarkdown("") + r.annotation = {} + + summary, description = r.split_description("One line\n") + assert summary == "one line." + assert description == "" + + summary, description = r.split_description("One line.") + assert summary == "one line." + assert description == "" + + summary, description = r.split_description("First line\nsecond line\n") + print(summary) + assert summary == "first line second line." + assert description == "" + + summary, description = r.split_description("First\nsecond. Third.\n") + print(summary) + assert summary == "first second." + assert description == "Third.\n" diff --git a/helpers/rpc/test_renderer_rst.py b/helpers/rpc/test_renderer_rst.py new file mode 100644 index 0000000..8bb000a --- /dev/null +++ b/helpers/rpc/test_renderer_rst.py @@ -0,0 +1,25 @@ +# Distributed under the MIT software license, see the accompanying +# file LICENSE or https://www.opensource.org/licenses/MIT. + +from renderer_rst import RendererRst +from help_parser import HelpParser +from pathlib import Path +import os + +test_data_dir = Path(os.path.dirname(__file__)) / "test_data" + + +def test_process_command_help(): + cmds = [ + 'analyzepsbt', + 'deriveaddresses', + 'getblockstats', + ] + for cmd in cmds: + with open(str(test_data_dir / cmd)) as file: + input = file.read() + help_data = HelpParser().parse_help_command(input) + with open(str(test_data_dir / "rst" / (cmd + ".rst"))) as file: + expected_output = file.read() + assert RendererRst("").cmd_page( + help_data) == expected_output diff --git a/img/dev/en-p2p-control-messages.dot b/img/dev/en-p2p-control-messages.dot index ddb3523..8fd91bb 100644 --- a/img/dev/en-p2p-control-messages.dot +++ b/img/dev/en-p2p-control-messages.dot @@ -13,10 +13,12 @@ graph [ penwidth = 1.75, fontname="Sans" ] version -> verack; ping -> pong; getaddr -> addr; +getaddr -> addrv2 filterload -> filteradd; filterload -> filterclear; alert; +sendaddrv2; sendheaders; ERROR [ style = "invis" ]; diff --git a/img/dev/en-p2p-control-messages.png b/img/dev/en-p2p-control-messages.png index f9b69d2..e93fc1d 100644 Binary files a/img/dev/en-p2p-control-messages.png and b/img/dev/en-p2p-control-messages.png differ diff --git a/img/dev/en-p2p-control-messages.svg b/img/dev/en-p2p-control-messages.svg index eab7012..0aa1051 100644 --- a/img/dev/en-p2p-control-messages.svg +++ b/img/dev/en-p2p-control-messages.svg @@ -1,96 +1,129 @@ - - - - -%3 - - -Overview Of P2P Protocol Control And Advisory Messages + + + + + +Overview Of P2P Protocol Control And Advisory Messages -version - -version + +version + +version -verack - -verack + +verack + +verack -version->verack - + +version->verack + -ping - -ping + +ping + +ping -pong - -pong + +pong + +pong -ping->pong - + +ping->pong + -getaddr - -getaddr + +getaddr + +getaddr -addr - -addr + +addr + +addr -getaddr->addr - + +getaddr->addr + + + + +addrv2 + +addrv2 + + + +getaddr->addrv2 + -filterload - -filterload + +filterload + +filterload -filteradd - -filteradd + +filteradd + +filteradd -filterload->filteradd - + +filterload->filteradd + -filterclear - -filterclear + +filterclear + +filterclear -filterload->filterclear - + +filterload->filterclear + -alert - -alert + +alert + +alert + + + +sendaddrv2 + +sendaddrv2 -sendheaders - -sendheaders + +sendheaders + +sendheaders -reject - -reject + +reject + +reject diff --git a/index.rst b/index.rst index 08eae1d..49dc437 100644 --- a/index.rst +++ b/index.rst @@ -1,5 +1,5 @@ -Welcome -======== +Getting Started +=============== The site aims to provide the information you need to understand Bitcoin and start building Bitcoin-based applications. To make the best use of @@ -20,7 +20,7 @@ developer documentation that led to this site. .. _make sure you're running a node: https://bitcoin.org/en/full-node .. _Bitcoin Stack Exchange: https://bitcoin.stackexchange.com/ -.. _GitHub: https://github.com/bitcoin-documentation/website/issues/new +.. _GitHub: https://github.com/bitcoin-dot-org/developer.bitcoin.org/issues/new/choose .. _David Harding: https://github.com/harding .. _Cornelius Schumacher: https://github.com/cornelius diff --git a/reference/block_chain.rst b/reference/block_chain.rst index 6bacca8..0a7b7e4 100644 --- a/reference/block_chain.rst +++ b/reference/block_chain.rst @@ -11,7 +11,7 @@ Block headers are serialized in the 80-byte format described below and then hash +-------+------------------------------------------------------------------------------------------+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Bytes | Name | Data Type | Description | +=======+==========================================================================================+===========+=================================================================================================================================================================================================================================================================================================================================================+ -| 4 | version | int32_t | The :term:`block version ` number indicates which set of block validation rules to follow. See the list of block versions below. | +| 4 | version | int32_t | The :term:`block version ` number indicates which set of block validation rules to follow. See the list of block versions below. | +-------+------------------------------------------------------------------------------------------+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 32 | :ref:`previous block header hash ` | char[32] | A SHA256(SHA256()) hash in internal byte order of the previous block’s header. This ensures no previous block can be changed without also changing this block’s header. | +-------+------------------------------------------------------------------------------------------+-----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -50,9 +50,7 @@ Block Versions - :ref:`Version 2 ` was introduced in `Bitcoin Core 0.7.0 `__ (September 2012) as a soft fork. As described in `BIP34 `__, valid :ref:`version 2 blocks ` require a :ref:`block height parameter in the coinbase `. Also described in `BIP34 `__ are rules for rejecting certain blocks; based on those rules, `Bitcoin Core 0.7.0 `__ and later versions began to reject :ref:`version 2 blocks ` without the block height in coinbase at block height 224,412 (March 2013) and began to reject new version 1 blocks three weeks later at block height 227,930. -- **Version 3** blocks were introduced in `Bitcoin Core 0.10.0 `__ (February - - 2015) as a soft fork. When the fork reached full enforcement (July 2015), it required strict `DER `__ encoding of all `ECDSA `__ signatures in new blocks as described in `BIP66 `__. Transactions that do not use strict `DER `__ encoding had previously been non-standard since `Bitcoin Core 0.8.0 `__ (February 2012). +- **Version 3** blocks were introduced in `Bitcoin Core 0.10.0 `__ (February 2015) as a soft fork. When the fork reached full enforcement (July 2015), it required strict `DER `__ encoding of all `ECDSA `__ signatures in new blocks as described in `BIP66 `__. Transactions that do not use strict `DER `__ encoding had previously been non-standard since `Bitcoin Core 0.8.0 `__ (February 2012). - **Version 4** blocks specified in BIP65 and introduced in `Bitcoin Core 0.11.2 `__ (November 2015) as a soft fork became active in December 2015. These blocks now support the new ``OP_CHECKLOCKTIMEVERIFY`` opcode described in that BIP. @@ -135,8 +133,8 @@ Under current consensus rules, a block is not valid unless its serialized size i | *Varies* | txns | raw transaction | Every transaction in this block, one after another, in raw transaction format. Transactions must appear in the data stream in the same order their TXIDs appeared in the first row of the merkle tree. See the `merkle tree section <../reference/block_chain.html#merkle-trees>`__ for details. | +----------+--------------+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -The first transaction in a block must be a :term:`coinbase transaction` which should collect and spend any transaction fees paid by transactions included in this block. +The first transaction in a block must be a :term:`coinbase transaction ` which should collect and spend any transaction fees paid by transactions included in this block. All blocks with a block height less than 6,930,000 are entitled to receive a block subsidy of newly created bitcoin value, which also should be spent in the coinbase transaction. (The block subsidy started at 50 bitcoins and is being halved every 210,000 blocks—approximately once every four years. As of November 2017, it’s 12.5 bitcoins.) -Together, the transaction fees and block subsidy are called the :term:`block reward`. A coinbase transaction is invalid if it tries to spend more value than is available from the block reward. +Together, the transaction fees and block subsidy are called the :term:`block reward `. A coinbase transaction is invalid if it tries to spend more value than is available from the block reward. diff --git a/reference/p2p_networking.rst b/reference/p2p_networking.rst index 5afbdca..488ba3a 100644 --- a/reference/p2p_networking.rst +++ b/reference/p2p_networking.rst @@ -1,7 +1,7 @@ P2P Network ----------- -This section describes the Bitcoin P2P `network <../devguide/p2p_network.html>`__ protocol (but it is `not a specification <../reference/intro.html#not-a-specification>`__). It does not describe the discontinued direct `IP-to-IP payment protocol `__, the :term:`deprecated BIP70 payment protocol `, the `GetBlockTemplate mining protocol <../devguide/mining.html#getblocktemplate-rpc>`__, or any `network <../devguide/p2p_network.html>`__ protocol never implemented in an official version of Bitcoin Core. +This section describes the Bitcoin P2P `network <../devguide/p2p_network.html>`__ protocol (but it is `not a specification <../reference/intro.html#not-a-specification>`__). It does not describe the discontinued direct `IP-to-IP payment protocol `__, the :term:`deprecated BIP70 payment protocol `, the `GetBlockTemplate mining protocol <../devguide/mining.html#getblocktemplate-rpc>`__, or any `network <../devguide/p2p_network.html>`__ protocol never implemented in an official version of Bitcoin Core. All `peer-to-peer <../devguide/p2p_network.html>`__ communication occurs entirely over TCP. @@ -13,7 +13,7 @@ Constants And Defaults The following constants and defaults are taken from Bitcoin Core’s `chainparams.cpp `__ source code file. +--------------------------------------------+--------------+------------------------------------------+------------+ -| `Network <../devguide/p2p_network.html>`__ | Default Port | :term:`Start String ` | Max nBits | +| `Network <../devguide/p2p_network.html>`__ | Default Port | :term:`Start String ` | Max nBits | +============================================+==============+==========================================+============+ | Mainnet | 8333 | 0xf9beb4d9 | 0x1d00ffff | +--------------------------------------------+--------------+------------------------------------------+------------+ @@ -107,7 +107,7 @@ The following `network <../devguide/p2p_network.html>`__ messages all request or Overview Of P2P Protocol Data Request And Reply Messages -Many of the data messages use :term:`inventories ` as unique identifiers for transactions and blocks. Inventories have a simple 36-byte structure: +Many of the data messages use :term:`inventories ` as unique identifiers for transactions and blocks. Inventories have a simple 36-byte structure: +-------+-----------------+-----------+--------------------------------------------------------------------------+ | Bytes | Name | Data Type | Description | @@ -598,7 +598,7 @@ Note that almost none of the control messages are authenticated in any way, mean Addr ^^^^ -The ``addr`` (IP address) message relays connection information for peers on the `network <../devguide/p2p_network.html>`__. Each peer which wants to accept incoming connections creates an `“addr” message <../reference/p2p_networking.html#addr>`__ providing its connection information and then sends that message to its peers unsolicited. Some of its peers send that information to their peers (also unsolicited), some of which further distribute it, allowing decentralized peer discovery for any program already on the `network <../devguide/p2p_network.html>`__. +The ``addr`` (IP address) message relays connection information for peers on the `network <../devguide/p2p_network.html>`__. Each peer which wants to accept incoming connections creates an `“addr” <../reference/p2p_networking.html#addr>`__ or `“addrv2” <../reference/p2p_networking.html#addrv2>`__ message providing its connection information and then sends that message to its peers unsolicited. Some of its peers send that information to their peers (also unsolicited), some of which further distribute it, allowing decentralized peer discovery for any program already on the `network <../devguide/p2p_network.html>`__. An `“addr” message <../reference/p2p_networking.html#addr>`__ may also be sent in response to a `“getaddr” message <../reference/p2p_networking.html#getaddr>`__. @@ -639,6 +639,54 @@ The following annotated hexdump shows part of an `“addr” message <../referen [...] .............................. (999 more addresses omitted) +Addrv2 +^^^^^^ + +The ``addrv2`` (address version two) message relays connection information for peers on the `network <../devguide/p2p_network.html>`__ in a similar way to the `“addr“ message <../reference/p2p_networking.html#addr>`__ except that it uses a different encoding which supports addresses longer than 16 bytes. + ++----------+------------------+-------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ +| Bytes | Name | Data Type | Description | ++==========+==================+=======================================================+============================================================================================================================+ +| *Varies* | address count | compactSize uint | The number of address entries up to a maximum of 1,000. | ++----------+------------------+-------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ +| *Varies* | addresses | `network <../devguide/p2p_network.html>`__ address | Address entries. See the table below for the format of a Bitcoin `network <../devguide/p2p_network.html>`__ addrv2 address.| ++----------+------------------+-------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ + +Each encapsulated address uses the following structure (``addrv2`` encoding): + ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| Bytes | Name | Data Type | Description | ++==========+================+==================+===================================================================================================================================================+ +| 4 | time | uint32 | Same as in the `“addr” message <../reference/p2p_networking.html#addr>`__. | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| *Varies* | services | compactSize uint | Same as in the `“addr” message <../reference/p2p_networking.html#addr>`__, but encoded as compactSize. | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| 1 | network id | uint8_t | The id of the network to which the address belongs to, as defined in `BIP155 `__. | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| *Varies* | address length | compactSize uint | The size of the address in the following field (in bytes). | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| *Varies* | address | byte[] | The network address. The interpretation depends on the network id. | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ +| 2 | port | uint16_t | Same as in the `“addr” message <../reference/p2p_networking.html#addr>`__. | ++----------+----------------+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ + +The following annotated hexdump shows part of an `“addrv2” message <../reference/p2p_networking.html#addrv2>`__ (the message header has been omitted). + +.. highlight:: text + +:: + + fde803 ............................. Address count: 1000 + + d91f4854 ........................... [Epoch time][unix epoch time]: 1414012889 + fd4804 ............................. Service bits: compactSize(NODE_WITNESS | NODE_COMPACT_FILTERS | NODE_NETWORK_LIMITED) + 01 ................................. BIP155 network id: IPv4 + 04 ................................. Address length: compactSize(4) + c0000233 ........................... Address: 192.0.2.51 + 208d ............................... Port: 8333 + + [...] .............................. (999 more addresses omitted) + Alert ^^^^^ @@ -879,7 +927,7 @@ In addition, because the filter size stays the same even though additional eleme GetAddr ^^^^^^^ -The `“getaddr” message <../reference/p2p_networking.html#getaddr>`__ requests an `“addr” message <../reference/p2p_networking.html#addr>`__ from the receiving node, preferably one with lots of IP addresses of other receiving nodes. The transmitting node can use those IP addresses to quickly update its database of available nodes rather than waiting for unsolicited `“addr” messages <../reference/p2p_networking.html#addr>`__ to arrive over time. +The `“getaddr” message <../reference/p2p_networking.html#getaddr>`__ requests an `“addr” <../reference/p2p_networking.html#addr>`__ or `“addrv2” <../reference/p2p_networking.html#addrv2>`__ message from the receiving node, preferably one with lots of addresses of other receiving nodes. The transmitting node can use those addresses to quickly update its database of available nodes rather than waiting for unsolicited `“addr” <../reference/p2p_networking.html#addr>`__ or `“addrv2” <../reference/p2p_networking.html#addrv2>`__ messages to arrive over time. There is no payload in a `“getaddr” message <../reference/p2p_networking.html#getaddr>`__. See the `message header section <../reference/p2p_networking.html#message-headers>`__ for an example of a message without a payload. @@ -990,6 +1038,13 @@ The `“sendheaders” message <../reference/p2p_networking.html#sendheaders>`__ There is no payload in a `“sendheaders” message <../reference/p2p_networking.html#sendheaders>`__. See the `message header section <../reference/p2p_networking.html#message-headers>`__ for an example of a message without a payload. +SendAddrv2 +^^^^^^^^^^^ + +The `“sendaddrv2” message <../reference/p2p_networking.html#sendaddrv2>`__ tells the receiving peer that the sender can understand `“addrv2” messages <../reference/p2p_networking.html#addrv2>`__ and prefers to receive them instead of `“addr” messages <../reference/p2p_networking.html#addr>`__. + +There is no payload in a `“sendaddrv2” message <../reference/p2p_networking.html#sendaddrv2>`__. See the `message header section <../reference/p2p_networking.html#message-headers>`__ for an example of a message without a payload. + VerAck ^^^^^^ diff --git a/reference/rpc/abandontransaction.rst b/reference/rpc/abandontransaction.rst index ae6f9b7..b999f86 100644 --- a/reference/rpc/abandontransaction.rst +++ b/reference/rpc/abandontransaction.rst @@ -21,6 +21,13 @@ Argument #1 - txid The transaction id +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -33,5 +40,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "abandontransaction", "params": ["1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "abandontransaction", "params": ["1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/abortrescan.rst b/reference/rpc/abortrescan.rst index 2378796..15fa0d6 100644 --- a/reference/rpc/abortrescan.rst +++ b/reference/rpc/abortrescan.rst @@ -8,6 +8,21 @@ abortrescan Stops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call. +Note: Use "getwalletinfo" to query the scanning progress. + +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - true|false + - boolean + - Whether the abort was successful + Examples ~~~~~~~~ @@ -24,5 +39,5 @@ Abort the running wallet rescan:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "abortrescan", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "abortrescan", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/addmultisigaddress.rst b/reference/rpc/addmultisigaddress.rst index e9fb9e1..35bcff5 100644 --- a/reference/rpc/addmultisigaddress.rst +++ b/reference/rpc/addmultisigaddress.rst @@ -6,7 +6,7 @@ addmultisigaddress ``addmultisigaddress nrequired ["key",...] ( "label" "address_type" )`` -Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. +Add an nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. Each key is a Bitcoin address or hex-encoded public key. @@ -28,7 +28,7 @@ Argument #2 - keys **Type:** json array, required -A json array of bitcoin addresses or hex-encoded public keys +The bitcoin addresses or hex-encoded public keys :: @@ -56,9 +56,10 @@ Result :: - { - "address":"multisigaddress", (string) The value of the new multisig address. - "redeemScript":"script" (string) The string value of the hex-encoded redemption script. + { (json object) + "address" : "str", (string) The value of the new multisig address + "redeemScript" : "hex", (string) The string value of the hex-encoded redemption script + "descriptor" : "str" (string) The descriptor for this multisig } Examples @@ -69,9 +70,9 @@ Examples Add a multisig address from 2 addresses:: - bitcoin-cli addmultisigaddress 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]" + bitcoin-cli addmultisigaddress 2 "[\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\",\"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3\"]" As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "addmultisigaddress", "params": [2, "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "addmultisigaddress", "params": [2, "[\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\",\"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3\"]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/addnode.rst b/reference/rpc/addnode.rst index 58d91a7..2d66366 100644 --- a/reference/rpc/addnode.rst +++ b/reference/rpc/addnode.rst @@ -27,6 +27,13 @@ Argument #2 - command 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -39,5 +46,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "addnode", "params": ["192.168.0.6:8333", "onetry"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "addnode", "params": ["192.168.0.6:8333", "onetry"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/analyzepsbt.rst b/reference/rpc/analyzepsbt.rst index 3931797..85b1fa7 100644 --- a/reference/rpc/analyzepsbt.rst +++ b/reference/rpc/analyzepsbt.rst @@ -20,29 +20,32 @@ Result :: - { - "inputs" : [ (array of json objects) - { - "has_utxo" : true|false (boolean) Whether a UTXO is provided - "is_final" : true|false (boolean) Whether the input is finalized - "missing" : { (json object, optional) Things that are missing that are required to complete this input - "pubkeys" : [ (array, optional) - "keyid" (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing - ] - "signatures" : [ (array, optional) - "keyid" (string) Public key ID, hash160 of the public key, of a public key whose signature is missing - ] - "redeemscript" : "hash" (string, optional) Hash160 of the redeemScript that is missing - "witnessscript" : "hash" (string, optional) SHA256 of the witnessScript that is missing - } - "next" : "role" (string, optional) Role of the next person that this input needs to go to - } - ,... - ] - "estimated_vsize" : vsize (numeric, optional) Estimated vsize of the final signed transaction - "estimated_feerate" : feerate (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled. - "fee" : fee (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled. - "next" : "role" (string) Role of the next person that this psbt needs to go to + { (json object) + "inputs" : [ (json array) + { (json object) + "has_utxo" : true|false, (boolean) Whether a UTXO is provided + "is_final" : true|false, (boolean) Whether the input is finalized + "missing" : { (json object, optional) Things that are missing that are required to complete this input + "pubkeys" : [ (json array, optional) + "hex", (string) Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing + ... + ], + "signatures" : [ (json array, optional) + "hex", (string) Public key ID, hash160 of the public key, of a public key whose signature is missing + ... + ], + "redeemscript" : "hex", (string, optional) Hash160 of the redeemScript that is missing + "witnessscript" : "hex" (string, optional) SHA256 of the witnessScript that is missing + }, + "next" : "str" (string, optional) Role of the next person that this input needs to go to + }, + ... + ], + "estimated_vsize" : n, (numeric, optional) Estimated vsize of the final signed transaction + "estimated_feerate" : n, (numeric, optional) Estimated feerate of the final signed transaction in BTC/kB. Shown only if all UTXO slots in the PSBT have been filled + "fee" : n, (numeric, optional) The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled + "next" : "str", (string) Role of the next person that this psbt needs to go to + "error" : "str" (string, optional) Error message (if there is one) } Examples diff --git a/reference/rpc/backupwallet.rst b/reference/rpc/backupwallet.rst index 7b60b36..d24e1d9 100644 --- a/reference/rpc/backupwallet.rst +++ b/reference/rpc/backupwallet.rst @@ -15,6 +15,13 @@ Argument #1 - destination The destination directory or file +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -27,5 +34,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "backupwallet", "params": ["backup.dat"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "backupwallet", "params": ["backup.dat"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/bumpfee.rst b/reference/rpc/bumpfee.rst index 4e26110..b6877fd 100644 --- a/reference/rpc/bumpfee.rst +++ b/reference/rpc/bumpfee.rst @@ -10,21 +10,25 @@ Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transactio An opt-in RBF transaction with the given txid must be in the wallet. -The command will pay the additional fee by decreasing (or perhaps removing) its change output. +The command will pay the additional fee by reducing change outputs or adding inputs when necessary. + +It may add a new change output if one does not already exist. + +All inputs in the original transaction will be included in the replacement transaction. -If the change output is not big enough to cover the increased fee, the command will currently fail -instead of adding new inputs to compensate. (A future implementation could improve this.) The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs. -By default, the new fee will be calculated automatically using estimatesmartfee. +By default, the new fee will be calculated automatically using the estimatesmartfee RPC. The user can specify a confirmation target for estimatesmartfee. -Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate. +Alternatively, the user can specify a fee rate in sat/vB for the new transaction. At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee returned by getnetworkinfo) to enter the node's mempool. +\* WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. \* + Argument #1 - txid ~~~~~~~~~~~~~~~~~~ @@ -40,11 +44,13 @@ Argument #2 - options :: { - "confTarget": n, (numeric, optional, default=fallback to wallet's default) Confirmation target (in blocks) - "totalFee": n, (numeric, optional, default=fallback to 'confTarget') Total fee (NOT feerate) to pay, in satoshis. - In rare cases, the actual fee paid might be slightly higher than the specified - totalFee if the tx change output has to be removed because it is too close to - the dust threshold. + "conf_target": n, (numeric, optional, default=wallet -txconfirmtarget) Confirmation target in blocks + + "fee_rate": amount, (numeric or string, optional, default=not set, fall back to wallet fee estimation) + Specify a fee rate in sat/vB instead of relying on the built-in fee estimator. + Must be at least 1.000 sat/vB higher than the current transaction fee rate. + WARNING: before version 0.21, fee_rate was in BTC/kvB. As of 0.21, fee_rate is in sat/vB. + "replaceable": bool, (boolean, optional, default=true) Whether the new transaction should still be marked bip-125 replaceable. If true, the sequence numbers in the transaction will be left unchanged from the original. If false, any input sequence numbers in the @@ -52,10 +58,11 @@ Argument #2 - options so the new transaction will not be explicitly bip-125 replaceable (though it may still be replaceable in practice, for example if it has unconfirmed ancestors which are replaceable). - "estimate_mode": "str", (string, optional, default=UNSET) The fee estimate mode, must be one of: - "UNSET" - "ECONOMICAL" - "CONSERVATIVE" + + "estimate_mode": "str", (string, optional, default=unset) The fee estimate mode, must be one of (case insensitive): + "unset" + "economical" + "conservative" } Result @@ -63,11 +70,15 @@ Result :: - { - "txid": "value", (string) The id of the new transaction - "origfee": n, (numeric) Fee of the replaced transaction - "fee": n, (numeric) Fee of the new transaction - "errors": [ str... ] (json array of strings) Errors encountered during processing (may be empty) + { (json object) + "psbt" : "str", (string) The base64-encoded unsigned PSBT of the new transaction. Only returned when wallet private keys are disabled. (DEPRECATED) + "txid" : "hex", (string) The id of the new transaction. Only returned when wallet private keys are enabled. + "origfee" : n, (numeric) The fee of the replaced transaction. + "fee" : n, (numeric) The fee of the new transaction. + "errors" : [ (json array) Errors encountered during processing (may be empty). + "str", (string) + ... + ] } Examples @@ -76,7 +87,7 @@ Examples .. highlight:: shell -Bump the fee, get the new transaction's txid:: +Bump the fee, get the new transaction'stxid:: bitcoin-cli bumpfee diff --git a/reference/rpc/clearbanned.rst b/reference/rpc/clearbanned.rst index 688c0a8..5398f34 100644 --- a/reference/rpc/clearbanned.rst +++ b/reference/rpc/clearbanned.rst @@ -8,6 +8,13 @@ clearbanned Clear all banned IPs. +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -20,5 +27,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "clearbanned", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "clearbanned", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/combinepsbt.rst b/reference/rpc/combinepsbt.rst index 42ae6bc..c86eade 100644 --- a/reference/rpc/combinepsbt.rst +++ b/reference/rpc/combinepsbt.rst @@ -15,7 +15,7 @@ Argument #1 - txs **Type:** json array, required -A json array of base64 strings of partially signed transactions +The base64 strings of partially signed transactions :: @@ -24,6 +24,19 @@ A json array of base64 strings of partially signed transactions ... ] +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - str + - string + - The base64-encoded partially signed transaction + Examples ~~~~~~~~ @@ -32,5 +45,5 @@ Examples :: - bitcoin-cli combinepsbt ["mybase64_1", "mybase64_2", "mybase64_3"] + bitcoin-cli combinepsbt '["mybase64_1", "mybase64_2", "mybase64_3"]' diff --git a/reference/rpc/combinerawtransaction.rst b/reference/rpc/combinerawtransaction.rst index 0696d9f..8287b2a 100644 --- a/reference/rpc/combinerawtransaction.rst +++ b/reference/rpc/combinerawtransaction.rst @@ -16,12 +16,12 @@ Argument #1 - txs **Type:** json array, required -A json array of hex strings of partially signed transactions +The hex strings of partially signed transactions :: [ - "hexstring", (string) A transaction hash + "hexstring", (string) A hex-encoded raw transaction ... ] @@ -34,7 +34,7 @@ Result * - Name - Type - Description - * - hex + * - str - string - The hex-encoded raw transaction with signature(s) @@ -46,5 +46,5 @@ Examples :: - bitcoin-cli combinerawtransaction ["myhex1", "myhex2", "myhex3"] + bitcoin-cli combinerawtransaction '["myhex1", "myhex2", "myhex3"]' diff --git a/reference/rpc/converttopsbt.rst b/reference/rpc/converttopsbt.rst index 53678e1..91cd85a 100644 --- a/reference/rpc/converttopsbt.rst +++ b/reference/rpc/converttopsbt.rst @@ -21,7 +21,7 @@ Argument #2 - permitsigdata **Type:** boolean, optional, default=false -If true, any signatures in the input will be discarded and conversion. +If true, any signatures in the input will be discarded and conversion will continue. If false, RPC will fail if any signatures are present. Argument #3 - iswitness @@ -30,9 +30,24 @@ Argument #3 - iswitness **Type:** boolean, optional, default=depends on heuristic tests Whether the transaction hex is a serialized witness transaction. - If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion - will be tried. If false, only non-witness deserialization will be tried. Only has an effect if - permitsigdata is true. + If iswitness is not present, heuristic tests will be used in decoding. + If true, only witness deserialization will be tried. + If false, only non-witness deserialization will be tried. + This boolean should reflect whether the transaction has inputs + (e.g. fully valid, or on-chain transactions), if known by the caller. + +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - str + - string + - The resulting raw transaction (base64-encoded string) Examples ~~~~~~~~ diff --git a/reference/rpc/createmultisig.rst b/reference/rpc/createmultisig.rst index f6739a5..23a3bea 100644 --- a/reference/rpc/createmultisig.rst +++ b/reference/rpc/createmultisig.rst @@ -22,7 +22,7 @@ Argument #2 - keys **Type:** json array, required -A json array of hex-encoded public keys. +The hex-encoded public keys. :: @@ -43,9 +43,10 @@ Result :: - { - "address":"multisigaddress", (string) The value of the new multisig address. - "redeemScript":"script" (string) The string value of the hex-encoded redemption script. + { (json object) + "address" : "str", (string) The value of the new multisig address. + "redeemScript" : "hex", (string) The string value of the hex-encoded redemption script. + "descriptor" : "str" (string) The descriptor for this multisig } Examples @@ -60,5 +61,5 @@ Create a multisig address from 2 public keys:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createmultisig", "params": [2, "[\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createmultisig", "params": [2, "[\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/createpsbt.rst b/reference/rpc/createpsbt.rst index 5d12c45..2e5f3d5 100644 --- a/reference/rpc/createpsbt.rst +++ b/reference/rpc/createpsbt.rst @@ -15,7 +15,7 @@ Argument #1 - inputs **Type:** json array, required -A json array of json objects +The json objects :: @@ -33,7 +33,7 @@ Argument #2 - outputs **Type:** json array, required -a json array with outputs (key-value pairs), where none of the keys are duplicated. +The outputs (key-value pairs), where none of the keys are duplicated. That is, each address can only appear once and there can only be one 'data' object. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter. @@ -65,6 +65,19 @@ Argument #4 - replaceable Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible. +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - str + - string + - The resulting raw transaction (base64-encoded string) + Examples ~~~~~~~~ diff --git a/reference/rpc/createrawtransaction.rst b/reference/rpc/createrawtransaction.rst index 9bb3526..33444e8 100644 --- a/reference/rpc/createrawtransaction.rst +++ b/reference/rpc/createrawtransaction.rst @@ -20,7 +20,7 @@ Argument #1 - inputs **Type:** json array, required -A json array of json objects +The inputs :: @@ -38,7 +38,7 @@ Argument #2 - outputs **Type:** json array, required -a json array with outputs (key-value pairs), where none of the keys are duplicated. +The outputs (key-value pairs), where none of the keys are duplicated. That is, each address can only appear once and there can only be one 'data' object. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also accepted as second parameter. @@ -79,7 +79,7 @@ Result * - Name - Type - Description - * - transaction + * - hex - string - hex string of the transaction @@ -99,9 +99,9 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"data\":\"00010203\"}]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"data\":\"00010203\"}]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/createwallet.rst b/reference/rpc/createwallet.rst index 91e991f..c978840 100644 --- a/reference/rpc/createwallet.rst +++ b/reference/rpc/createwallet.rst @@ -4,7 +4,7 @@ createwallet ============ -``createwallet "wallet_name" ( disable_private_keys blank )`` +``createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )`` Creates and loads a new wallet. @@ -29,14 +29,42 @@ Argument #3 - blank Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed. +Argument #4 - passphrase +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string + +Encrypt the wallet with this passphrase. + +Argument #5 - avoid_reuse +~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=false + +Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind. + +Argument #6 - descriptors +~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=false + +Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation + +Argument #7 - load_on_startup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=null + +Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged. + Result ~~~~~~ :: - { - "name" : , (string) The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path. - "warning" : , (string) Warning message if wallet was not loaded cleanly. + { (json object) + "name" : "str", (string) The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path. + "warning" : "str" (string) Warning message if wallet was not loaded cleanly. } Examples @@ -51,5 +79,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createwallet", "params": ["testwallet"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["testwallet"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/decodepsbt.rst b/reference/rpc/decodepsbt.rst index 137c6e4..c7e0609 100644 --- a/reference/rpc/decodepsbt.rst +++ b/reference/rpc/decodepsbt.rst @@ -20,91 +20,93 @@ Result :: - { - "tx" : { (json object) The decoded network-serialized unsigned transaction. - ... The layout is the same as the output of decoderawtransaction. + { (json object) + "tx" : { (json object) The decoded network-serialized unsigned transaction. + ... The layout is the same as the output of decoderawtransaction. }, - "unknown" : { (json object) The unknown global fields - "key" : "value" (key-value pair) An unknown key-value pair - ... + "unknown" : { (json object) The unknown global fields + "key" : "hex", (string) (key-value pair) An unknown key-value pair + ... }, - "inputs" : [ (array of json objects) - { - "non_witness_utxo" : { (json object, optional) Decoded network transaction for non-witness UTXOs + "inputs" : [ (json array) + { (json object) + "non_witness_utxo" : { (json object, optional) Decoded network transaction for non-witness UTXOs ... }, - "witness_utxo" : { (json object, optional) Transaction output for witness UTXOs - "amount" : x.xxx, (numeric) The value in BTC - "scriptPubKey" : { (json object) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - "address" : "address" (string) Bitcoin address if there is one + "witness_utxo" : { (json object, optional) Transaction output for witness UTXOs + "amount" : n, (numeric) The value in BTC + "scriptPubKey" : { (json object) + "asm" : "str", (string) The asm + "hex" : "hex", (string) The hex + "type" : "str", (string) The type, eg 'pubkeyhash' + "address" : "str" (string) Bitcoin address if there is one } }, "partial_signatures" : { (json object, optional) - "pubkey" : "signature", (string) The public key and signature that corresponds to it. - ,... - } - "sighash" : "type", (string, optional) The sighash type to be used - "redeem_script" : { (json object, optional) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - } - "witness_script" : { (json object, optional) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - } - "bip32_derivs" : { (json object, optional) - "pubkey" : { (json object, optional) The public key with the derivation path as the value. - "master_fingerprint" : "fingerprint" (string) The fingerprint of the master key - "path" : "path", (string) The path - } - ,... - } - "final_scriptsig" : { (json object, optional) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - } - "final_scriptwitness": ["hex", ...] (array of string) hex-encoded witness data (if any) - "unknown" : { (json object) The unknown global fields - "key" : "value" (key-value pair) An unknown key-value pair - ... + "pubkey" : "str", (string) The public key and signature that corresponds to it. + ... }, - } - ,... - ] - "outputs" : [ (array of json objects) - { - "redeem_script" : { (json object, optional) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - } - "witness_script" : { (json object, optional) - "asm" : "asm", (string) The asm - "hex" : "hex", (string) The hex - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - } - "bip32_derivs" : [ (array of json objects, optional) - { - "pubkey" : "pubkey", (string) The public key this path corresponds to - "master_fingerprint" : "fingerprint" (string) The fingerprint of the master key - "path" : "path", (string) The path - } - } - ,... + "sighash" : "str", (string, optional) The sighash type to be used + "redeem_script" : { (json object, optional) + "asm" : "str", (string) The asm + "hex" : "hex", (string) The hex + "type" : "str" (string) The type, eg 'pubkeyhash' + }, + "witness_script" : { (json object, optional) + "asm" : "str", (string) The asm + "hex" : "hex", (string) The hex + "type" : "str" (string) The type, eg 'pubkeyhash' + }, + "bip32_derivs" : [ (json array, optional) + { (json object, optional) The public key with the derivation path as the value. + "master_fingerprint" : "str", (string) The fingerprint of the master key + "path" : "str" (string) The path + }, + ... + ], + "final_scriptsig" : { (json object, optional) + "asm" : "str", (string) The asm + "hex" : "str" (string) The hex + }, + "final_scriptwitness" : [ (json array) + "hex", (string) hex-encoded witness data (if any) + ... ], - "unknown" : { (json object) The unknown global fields - "key" : "value" (key-value pair) An unknown key-value pair - ... + "unknown" : { (json object) The unknown global fields + "key" : "hex", (string) (key-value pair) An unknown key-value pair + ... + } + }, + ... + ], + "outputs" : [ (json array) + { (json object) + "redeem_script" : { (json object, optional) + "asm" : "str", (string) The asm + "hex" : "hex", (string) The hex + "type" : "str" (string) The type, eg 'pubkeyhash' }, - } - ,... - ] - "fee" : fee (numeric, optional) The transaction fee paid if all UTXOs slots in the PSBT have been filled. + "witness_script" : { (json object, optional) + "asm" : "str", (string) The asm + "hex" : "hex", (string) The hex + "type" : "str" (string) The type, eg 'pubkeyhash' + }, + "bip32_derivs" : [ (json array, optional) + { (json object) + "pubkey" : "str", (string) The public key this path corresponds to + "master_fingerprint" : "str", (string) The fingerprint of the master key + "path" : "str" (string) The path + }, + ... + ], + "unknown" : { (json object) The unknown global fields + "key" : "hex", (string) (key-value pair) An unknown key-value pair + ... + } + }, + ... + ], + "fee" : n (numeric, optional) The transaction fee paid if all UTXOs slots in the PSBT have been filled. } Examples diff --git a/reference/rpc/decoderawtransaction.rst b/reference/rpc/decoderawtransaction.rst index 923ad18..2dfe594 100644 --- a/reference/rpc/decoderawtransaction.rst +++ b/reference/rpc/decoderawtransaction.rst @@ -20,52 +20,59 @@ Argument #2 - iswitness **Type:** boolean, optional, default=depends on heuristic tests -Whether the transaction hex is a serialized witness transaction - If iswitness is not present, heuristic tests will be used in decoding +Whether the transaction hex is a serialized witness transaction. + If iswitness is not present, heuristic tests will be used in decoding. + If true, only witness deserialization will be tried. + If false, only non-witness deserialization will be tried. + This boolean should reflect whether the transaction has inputs + (e.g. fully valid, or on-chain transactions), if known by the caller. Result ~~~~~~ :: - { - "txid" : "id", (string) The transaction id - "hash" : "id", (string) The transaction hash (differs from txid for witness transactions) - "size" : n, (numeric) The transaction size - "vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions) - "weight" : n, (numeric) The transaction's weight (between vsize*4 - 3 and vsize*4) - "version" : n, (numeric) The version - "locktime" : ttt, (numeric) The lock time - "vin" : [ (array of json objects) - { - "txid": "id", (string) The transaction id - "vout": n, (numeric) The output number - "scriptSig": { (json object) The script - "asm": "asm", (string) asm - "hex": "hex" (string) hex - }, - "txinwitness": ["hex", ...] (array of string) hex-encoded witness data (if any) - "sequence": n (numeric) The script sequence number - } - ,... - ], - "vout" : [ (array of json objects) - { - "value" : x.xxx, (numeric) The value in BTC - "n" : n, (numeric) index - "scriptPubKey" : { (json object) - "asm" : "asm", (string) the asm - "hex" : "hex", (string) the hex - "reqSigs" : n, (numeric) The required sigs - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - "addresses" : [ (json array of string) - "12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc" (string) bitcoin address - ,... - ] - } - } - ,... + { (json object) + "txid" : "hex", (string) The transaction id + "hash" : "hex", (string) The transaction hash (differs from txid for witness transactions) + "size" : n, (numeric) The transaction size + "vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions) + "weight" : n, (numeric) The transaction's weight (between vsize*4 - 3 and vsize*4) + "version" : n, (numeric) The version + "locktime" : xxx, (numeric) The lock time + "vin" : [ (json array) + { (json object) + "txid" : "hex", (string) The transaction id + "vout" : n, (numeric) The output number + "scriptSig" : { (json object) The script + "asm" : "str", (string) asm + "hex" : "hex" (string) hex + }, + "txinwitness" : [ (json array) + "hex", (string) hex-encoded witness data (if any) + ... + ], + "sequence" : n (numeric) The script sequence number + }, + ... ], + "vout" : [ (json array) + { (json object) + "value" : n, (numeric) The value in BTC + "n" : n, (numeric) index + "scriptPubKey" : { (json object) + "asm" : "str", (string) the asm + "hex" : "hex", (string) the hex + "reqSigs" : n, (numeric) The required sigs + "type" : "str", (string) The type, eg 'pubkeyhash' + "addresses" : [ (json array) + "str", (string) bitcoin address + ... + ] + } + }, + ... + ] } Examples @@ -80,5 +87,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "decoderawtransaction", "params": ["hexstring"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "decoderawtransaction", "params": ["hexstring"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/decodescript.rst b/reference/rpc/decodescript.rst index 02212c9..123ed9c 100644 --- a/reference/rpc/decodescript.rst +++ b/reference/rpc/decodescript.rst @@ -20,16 +20,26 @@ Result :: - { - "asm":"asm", (string) Script public key - "hex":"hex", (string) hex-encoded public key - "type":"type", (string) The output type - "reqSigs": n, (numeric) The required signatures - "addresses": [ (json array of string) - "address" (string) bitcoin address - ,... + { (json object) + "asm" : "str", (string) Script public key + "type" : "str", (string) The output type (e.g. nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_unknown) + "reqSigs" : n, (numeric) The required signatures + "addresses" : [ (json array) + "str", (string) bitcoin address + ... ], - "p2sh","address" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH). + "p2sh" : "str", (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH) + "segwit" : { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness) + "asm" : "str", (string) String representation of the script public key + "hex" : "hex", (string) Hex string of the script public key + "type" : "str", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash) + "reqSigs" : n, (numeric) The required signatures (always 1) + "addresses" : [ (json array) (always length 1) + "str", (string) segwit address + ... + ], + "p2sh-segwit" : "str" (string) address of the P2SH script wrapping this witness redeem script + } } Examples @@ -44,5 +54,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "decodescript", "params": ["hexstring"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "decodescript", "params": ["hexstring"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/deriveaddresses.rst b/reference/rpc/deriveaddresses.rst index c87a04b..dbc6976 100644 --- a/reference/rpc/deriveaddresses.rst +++ b/reference/rpc/deriveaddresses.rst @@ -39,7 +39,10 @@ Result :: - [ address ] (array) the derived addresses + [ (json array) + "str", (string) the derived addresses + ... + ] Examples ~~~~~~~~ @@ -49,5 +52,5 @@ Examples First three native segwit receive addresses:: - bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#trd0mf0l" "[0,2]" + bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu" "[0,2]" diff --git a/reference/rpc/disconnectnode.rst b/reference/rpc/disconnectnode.rst index c319021..ec4db53 100644 --- a/reference/rpc/disconnectnode.rst +++ b/reference/rpc/disconnectnode.rst @@ -26,6 +26,13 @@ Argument #2 - nodeid The node ID (see getpeerinfo for node IDs) +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -42,9 +49,9 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "disconnectnode", "params": ["192.168.0.6:8333"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "disconnectnode", "params": ["192.168.0.6:8333"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "disconnectnode", "params": ["", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "disconnectnode", "params": ["", 1]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/dumpprivkey.rst b/reference/rpc/dumpprivkey.rst index 4d214b9..52bfe2b 100644 --- a/reference/rpc/dumpprivkey.rst +++ b/reference/rpc/dumpprivkey.rst @@ -26,7 +26,7 @@ Result * - Name - Type - Description - * - key + * - str - string - The private key @@ -46,5 +46,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpprivkey", "params": ["myaddress"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "dumpprivkey", "params": ["myaddress"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/dumpwallet.rst b/reference/rpc/dumpwallet.rst index 872d09e..6e426b0 100644 --- a/reference/rpc/dumpwallet.rst +++ b/reference/rpc/dumpwallet.rst @@ -18,15 +18,15 @@ Argument #1 - filename **Type:** string, required -The filename with path (either absolute or relative to bitcoind) +The filename with path (absolute path recommended) Result ~~~~~~ :: - { (json object) - "filename" : { (string) The filename with full absolute path + { (json object) + "filename" : "str" (string) The filename with full absolute path } Examples @@ -41,5 +41,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpwallet", "params": ["test"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "dumpwallet", "params": ["test"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/encryptwallet.rst b/reference/rpc/encryptwallet.rst index f21b7e5..a2085c3 100644 --- a/reference/rpc/encryptwallet.rst +++ b/reference/rpc/encryptwallet.rst @@ -22,6 +22,19 @@ Argument #1 - passphrase The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long. +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - str + - string + - A string with further instructions + Examples ~~~~~~~~ @@ -46,5 +59,5 @@ Now lock the wallet again by removing the passphrase:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "encryptwallet", "params": ["my pass phrase"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "encryptwallet", "params": ["my pass phrase"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/estimatesmartfee.rst b/reference/rpc/estimatesmartfee.rst index edfe95b..678bc74 100644 --- a/reference/rpc/estimatesmartfee.rst +++ b/reference/rpc/estimatesmartfee.rst @@ -38,10 +38,17 @@ Result :: - { - "feerate" : x.x, (numeric, optional) estimate fee rate in BTC/kB - "errors": [ str... ] (json array of strings, optional) Errors encountered during processing - "blocks" : n (numeric) block number where estimate was found + { (json object) + "feerate" : n, (numeric, optional) estimate fee rate in BTC/kB (only present if no errors were encountered) + "errors" : [ (json array, optional) Errors encountered during processing (if there are any) + "str", (string) error + ... + ], + "blocks" : n (numeric) block number where estimate was found + The request target will be clamped between 2 and the highest target + fee estimation is able to return based on how long it has been running. + An error is returned if not enough transactions and blocks + have been observed to make an estimate for any number of blocks. } Examples diff --git a/reference/rpc/finalizepsbt.rst b/reference/rpc/finalizepsbt.rst index bb18890..c9f3ae5 100644 --- a/reference/rpc/finalizepsbt.rst +++ b/reference/rpc/finalizepsbt.rst @@ -32,11 +32,10 @@ Result :: - { - "psbt" : "value", (string) The base64-encoded partially signed transaction if not extracted - "hex" : "value", (string) The hex-encoded network transaction if extracted - "complete" : true|false, (boolean) If the transaction has a complete set of signatures - ] + { (json object) + "psbt" : "str", (string) The base64-encoded partially signed transaction if not extracted + "hex" : "hex", (string) The hex-encoded network transaction if extracted + "complete" : true|false (boolean) If the transaction has a complete set of signatures } Examples diff --git a/reference/rpc/fundrawtransaction.rst b/reference/rpc/fundrawtransaction.rst index f35ab03..0a1280a 100644 --- a/reference/rpc/fundrawtransaction.rst +++ b/reference/rpc/fundrawtransaction.rst @@ -6,9 +6,9 @@ fundrawtransaction ``fundrawtransaction "hexstring" ( options iswitness )`` -Add inputs to a transaction until it has enough in value to meet its out value. +If the transaction has no inputs, they will be automatically selected to meet its out value. -This will not modify existing inputs, and will add at most one change output to the outputs. +It will add at most one change output to the outputs. No existing outputs will be modified unless "subtractFeeFromOutputs" is specified. @@ -39,25 +39,29 @@ Argument #2 - options **Type:** json object, optional for backward compatibility: passing in a true instead of an object will result in {"includeWatching":true} - "replaceable": bool, (boolean, optional, default=fallback to wallet's default) Marks this transaction as BIP125 replaceable. + "replaceable": bool, (boolean, optional, default=wallet default) Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees - "conf_target": n, (numeric, optional, default=fallback to wallet's default) Confirmation target (in blocks) - "estimate_mode": "str", (string, optional, default=UNSET) The fee estimate mode, must be one of: - "UNSET" - "ECONOMICAL" - "CONSERVATIVE" + "conf_target": n, (numeric, optional, default=wallet -txconfirmtarget) Confirmation target in blocks + "estimate_mode": "str", (string, optional, default=unset) The fee estimate mode, must be one of (case insensitive): + "unset" + "economical" + "conservative" } :: { + "add_inputs": bool, (boolean, optional, default=true) For a transaction with existing inputs, automatically include more if they are not enough. "changeAddress": "str", (string, optional, default=pool address) The bitcoin address to receive the change "changePosition": n, (numeric, optional, default=random) The index of the change output "change_type": "str", (string, optional, default=set by -changetype) The output type to use. Only valid if changeAddress is not specified. Options are "legacy", "p2sh-segwit", and "bech32". - "includeWatching": bool, (boolean, optional, default=false) Also select inputs which are watch only + "includeWatching": bool, (boolean, optional, default=true for watch-only wallets, otherwise false) Also select inputs which are watch only. + Only solvable inputs can be used. Watch-only destinations are solvable if the public key and/or output script was imported, + e.g. with 'importpubkey' or 'importmulti' with the 'pubkeys' or 'desc' field. "lockUnspents": bool, (boolean, optional, default=false) Lock selected unspent outputs - "feeRate": amount, (numeric or string, optional, default=not set: makes wallet determine the fee) Set a specific fee rate in BTC/kB - "subtractFeeFromOutputs": [ (json array, optional, default=empty array) A json array of integers. + "fee_rate": amount, (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in sat/vB. + "feeRate": amount, (numeric or string, optional, default=not set, fall back to wallet fee estimation) Specify a fee rate in BTC/kvB. + "subtractFeeFromOutputs": [ (json array, optional, default=empty array) The integers. The fee will be equally deducted from the amount of each specified output. Those recipients will receive less bitcoins than you enter in their corresponding amount field. If no outputs are specified here, the sender pays the fee. @@ -70,18 +74,22 @@ Argument #3 - iswitness **Type:** boolean, optional, default=depends on heuristic tests -Whether the transaction hex is a serialized witness transaction - If iswitness is not present, heuristic tests will be used in decoding +Whether the transaction hex is a serialized witness transaction. + If iswitness is not present, heuristic tests will be used in decoding. + If true, only witness deserialization will be tried. + If false, only non-witness deserialization will be tried. + This boolean should reflect whether the transaction has inputs + (e.g. fully valid, or on-chain transactions), if known by the caller. Result ~~~~~~ :: - { - "hex": "value", (string) The resulting raw transaction (hex-encoded string) - "fee": n, (numeric) Fee in BTC the resulting transaction pays - "changepos": n (numeric) The position of the added change output, or -1 + { (json object) + "hex" : "hex", (string) The resulting raw transaction (hex-encoded string) + "fee" : n, (numeric) Fee in BTC the resulting transaction pays + "changepos" : n (numeric) The position of the added change output, or -1 } Examples diff --git a/reference/rpc/generate.rst b/reference/rpc/generate.rst deleted file mode 100644 index 421c97a..0000000 --- a/reference/rpc/generate.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. This file is licensed under the MIT License (MIT) available on - http://opensource.org/licenses/MIT. - -generate -======== - -``generate nblocks ( maxtries )`` - -Mine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet. - -Argument #1 - nblocks -~~~~~~~~~~~~~~~~~~~~~ - -**Type:** numeric, required - -How many blocks are generated immediately. - -Argument #2 - maxtries -~~~~~~~~~~~~~~~~~~~~~~ - -**Type:** numeric, optional, default=1000000 - -How many iterations to try. - -Result -~~~~~~ - -:: - - [ blockhashes ] (array) hashes of blocks generated - -Examples -~~~~~~~~ - - -.. highlight:: shell - -Generate 11 blocks:: - - bitcoin-cli generate 11 - diff --git a/reference/rpc/generateblock.rst b/reference/rpc/generateblock.rst new file mode 100644 index 0000000..b703155 --- /dev/null +++ b/reference/rpc/generateblock.rst @@ -0,0 +1,52 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +generateblock +============= + +``generateblock "output" ["rawtx/txid",...]`` + +Mine a block with a set of ordered transactions immediately to a specified address or descriptor (before the RPC call returns) + +Argument #1 - output +~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, required + +The address or descriptor to send the newly generated bitcoin to. + +Argument #2 - transactions +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** json array, required + +An array of hex strings which are either txids or raw transactions. + Txids must reference transactions currently in the mempool. + All transactions must be valid and in valid order, otherwise the block will be rejected. + +:: + + [ + "rawtx/txid", (string) + ... + ] + +Result +~~~~~~ + +:: + + { (json object) + "hash" : "hex" (string) hash of generated block + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +Generate a block to myaddress, with txs rawtx and mempool_txid:: + + bitcoin-cli generateblock "myaddress" '["rawtx", "mempool_txid"]' + diff --git a/reference/rpc/generatetoaddress.rst b/reference/rpc/generatetoaddress.rst index ccbc335..0bbbea0 100644 --- a/reference/rpc/generatetoaddress.rst +++ b/reference/rpc/generatetoaddress.rst @@ -34,7 +34,10 @@ Result :: - [ blockhashes ] (array) hashes of blocks generated + [ (json array) hashes of blocks generated + "hex", (string) blockhash + ... + ] Examples ~~~~~~~~ @@ -46,7 +49,7 @@ Generate 11 blocks to myaddress:: bitcoin-cli generatetoaddress 11 "myaddress" -If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with::: +If you are using the Bitcoin Core wallet, you can get a new address to send the newly generated bitcoin to with::: bitcoin-cli getnewaddress diff --git a/reference/rpc/generatetodescriptor.rst b/reference/rpc/generatetodescriptor.rst new file mode 100644 index 0000000..bed3987 --- /dev/null +++ b/reference/rpc/generatetodescriptor.rst @@ -0,0 +1,51 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +generatetodescriptor +==================== + +``generatetodescriptor num_blocks "descriptor" ( maxtries )`` + +Mine blocks immediately to a specified descriptor (before the RPC call returns) + +Argument #1 - num_blocks +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** numeric, required + +How many blocks are generated immediately. + +Argument #2 - descriptor +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, required + +The descriptor to send the newly generated bitcoin to. + +Argument #3 - maxtries +~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** numeric, optional, default=1000000 + +How many iterations to try. + +Result +~~~~~~ + +:: + + [ (json array) hashes of blocks generated + "hex", (string) blockhash + ... + ] + +Examples +~~~~~~~~ + + +.. highlight:: shell + +Generate 11 blocks to mydesc:: + + bitcoin-cli generatetodescriptor 11 "mydesc" + diff --git a/reference/rpc/getaddednodeinfo.rst b/reference/rpc/getaddednodeinfo.rst index 8a73faa..984b09c 100644 --- a/reference/rpc/getaddednodeinfo.rst +++ b/reference/rpc/getaddednodeinfo.rst @@ -21,18 +21,19 @@ Result :: - [ - { - "addednode" : "192.168.0.201", (string) The node IP address or name (as provided to addnode) - "connected" : true|false, (boolean) If connected - "addresses" : [ (list of objects) Only when connected = true - { - "address" : "192.168.0.201:8333", (string) The bitcoin server IP and port we're connected to - "connected" : "outbound" (string) connection, inbound or outbound - } - ] - } - ,... + [ (json array) + { (json object) + "addednode" : "str", (string) The node IP address or name (as provided to addnode) + "connected" : true|false, (boolean) If connected + "addresses" : [ (json array) Only when connected = true + { (json object) + "address" : "str", (string) The bitcoin server IP and port we're connected to + "connected" : "str" (string) connection, inbound or outbound + }, + ... + ] + }, + ... ] Examples @@ -47,5 +48,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddednodeinfo", "params": ["192.168.0.201"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getaddednodeinfo", "params": ["192.168.0.201"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getaddressesbylabel.rst b/reference/rpc/getaddressesbylabel.rst index 5bcf409..9e833d1 100644 --- a/reference/rpc/getaddressesbylabel.rst +++ b/reference/rpc/getaddressesbylabel.rst @@ -20,10 +20,11 @@ Result :: - { (json object with addresses as keys) - "address": { (json object with information about address) - "purpose": "string" (string) Purpose of address ("send" for sending address, "receive" for receiving address) - },... + { (json object) json object with addresses as keys + "address" : { (json object) json object with information about address + "purpose" : "str" (string) Purpose of address ("send" for sending address, "receive" for receiving address) + }, + ... } Examples @@ -38,5 +39,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressesbylabel", "params": ["tabby"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getaddressesbylabel", "params": ["tabby"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getaddressinfo.rst b/reference/rpc/getaddressinfo.rst index 3e18de1..8690aae 100644 --- a/reference/rpc/getaddressinfo.rst +++ b/reference/rpc/getaddressinfo.rst @@ -6,56 +6,58 @@ getaddressinfo ``getaddressinfo "address"`` -Return information about the given bitcoin address. Some information requires the address -to be in the wallet. +Return information about the given bitcoin address. + +Some of the information will only be present if the address is in the active wallet. Argument #1 - address ~~~~~~~~~~~~~~~~~~~~~ **Type:** string, required -The bitcoin address to get the information of. +The bitcoin address for which to get information. Result ~~~~~~ :: - { - "address" : "address", (string) The bitcoin address validated - "scriptPubKey" : "hex", (string) The hex-encoded scriptPubKey generated by the address - "ismine" : true|false, (boolean) If the address is yours or not - "iswatchonly" : true|false, (boolean) If the address is watchonly - "solvable" : true|false, (boolean) Whether we know how to spend coins sent to this address, ignoring the possible lack of private keys - "desc" : "desc", (string, optional) A descriptor for spending coins sent to this address (only when solvable) - "isscript" : true|false, (boolean) If the key is a script - "ischange" : true|false, (boolean) If the address was used for change output - "iswitness" : true|false, (boolean) If the address is a witness address - "witness_version" : version (numeric, optional) The version number of the witness program - "witness_program" : "hex" (string, optional) The hex value of the witness program - "script" : "type" (string, optional) The output script type. Only if "isscript" is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash, witness_unknown - "hex" : "hex", (string, optional) The redeemscript for the p2sh address - "pubkeys" (string, optional) Array of pubkeys associated with the known redeemscript (only if "script" is "multisig") - [ - "pubkey" - ,... - ] - "sigsrequired" : xxxxx (numeric, optional) Number of signatures required to spend multisig output (only if "script" is "multisig") - "pubkey" : "publickeyhex", (string, optional) The hex value of the raw public key, for single-key addresses (possibly embedded in P2SH or P2WSH) - "embedded" : {...}, (object, optional) Information about the address embedded in P2SH or P2WSH, if relevant and known. It includes all getaddressinfo output fields for the embedded address, excluding metadata ("timestamp", "hdkeypath", "hdseedid") and relation to the wallet ("ismine", "iswatchonly"). - "iscompressed" : true|false, (boolean, optional) If the pubkey is compressed - "label" : "label" (string) The label associated with the address, "" is the default label - "timestamp" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT) - "hdkeypath" : "keypath" (string, optional) The HD keypath if the key is HD and available - "hdseedid" : "" (string, optional) The Hash160 of the HD seed - "hdmasterfingerprint" : "" (string, optional) The fingperint of the master key. - "labels" (object) Array of labels associated with the address. - [ - { (json object of label data) - "name": "labelname" (string) The label - "purpose": "string" (string) Purpose of address ("send" for sending address, "receive" for receiving address) - },... - ] + { (json object) + "address" : "str", (string) The bitcoin address validated. + "scriptPubKey" : "hex", (string) The hex-encoded scriptPubKey generated by the address. + "ismine" : true|false, (boolean) If the address is yours. + "iswatchonly" : true|false, (boolean) If the address is watchonly. + "solvable" : true|false, (boolean) If we know how to spend coins sent to this address, ignoring the possible lack of private keys. + "desc" : "str", (string, optional) A descriptor for spending coins sent to this address (only when solvable). + "isscript" : true|false, (boolean) If the key is a script. + "ischange" : true|false, (boolean) If the address was used for change output. + "iswitness" : true|false, (boolean) If the address is a witness address. + "witness_version" : n, (numeric, optional) The version number of the witness program. + "witness_program" : "hex", (string, optional) The hex value of the witness program. + "script" : "str", (string, optional) The output script type. Only if isscript is true and the redeemscript is known. Possible + types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, + witness_v0_scripthash, witness_unknown. + "hex" : "hex", (string, optional) The redeemscript for the p2sh address. + "pubkeys" : [ (json array, optional) Array of pubkeys associated with the known redeemscript (only if script is multisig). + "str", (string) + ... + ], + "sigsrequired" : n, (numeric, optional) The number of signatures required to spend multisig output (only if script is multisig). + "pubkey" : "hex", (string, optional) The hex value of the raw public key for single-key addresses (possibly embedded in P2SH or P2WSH). + "embedded" : { (json object, optional) Information about the address embedded in P2SH or P2WSH, if relevant and known. + ... Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid) + and relation to the wallet (ismine, iswatchonly). + }, + "iscompressed" : true|false, (boolean, optional) If the pubkey is compressed. + "timestamp" : xxx, (numeric, optional) The creation time of the key, if available, expressed in UNIX epoch time. + "hdkeypath" : "str", (string, optional) The HD keypath, if the key is HD and available. + "hdseedid" : "hex", (string, optional) The Hash160 of the HD seed. + "hdmasterfingerprint" : "hex", (string, optional) The fingerprint of the master key. + "labels" : [ (json array) Array of labels associated with the address. Currently limited to one label but returned + as an array to keep the API stable if multiple labels are enabled in the future. + "str", (string) Label name (defaults to ""). + ... + ] } Examples @@ -66,9 +68,9 @@ Examples :: - bitcoin-cli getaddressinfo "1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc" + bitcoin-cli getaddressinfo "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressinfo", "params": ["1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getaddressinfo", "params": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getbalance.rst b/reference/rpc/getbalance.rst index 382da4d..6733c20 100644 --- a/reference/rpc/getbalance.rst +++ b/reference/rpc/getbalance.rst @@ -4,7 +4,7 @@ getbalance ========== -``getbalance ( "dummy" minconf include_watchonly )`` +``getbalance ( "dummy" minconf include_watchonly avoid_reuse )`` Returns the total available balance. @@ -28,10 +28,17 @@ Only include transactions confirmed at least this many times. Argument #3 - include_watchonly ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**Type:** boolean, optional, default=false +**Type:** boolean, optional, default=true for watch-only wallets, otherwise false Also include balance in watch-only addresses (see 'importaddress') +Argument #4 - avoid_reuse +~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=true + +(only available if avoid_reuse wallet flag is set) Do not include balance in dirty outputs; addresses are considered dirty if they have previously been used in a transaction. + Result ~~~~~~ @@ -41,7 +48,7 @@ Result * - Name - Type - Description - * - amount + * - n - numeric - The total amount in BTC received for this wallet. @@ -51,15 +58,15 @@ Examples .. highlight:: shell -The total amount in the wallet with 1 or more confirmations:: +The total amount in the wallet with 0 or more confirmations:: bitcoin-cli getbalance -The total amount in the wallet at least 6 blocks confirmed:: +The total amount in the wallet with at least 6 confirmations:: bitcoin-cli getbalance "*" 6 As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": ["*", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getbalance", "params": ["*", 6]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getbalances.rst b/reference/rpc/getbalances.rst new file mode 100644 index 0000000..b8f94dc --- /dev/null +++ b/reference/rpc/getbalances.rst @@ -0,0 +1,43 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +getbalances +=========== + +``getbalances`` + +Returns an object with all balances in BTC. + +Result +~~~~~~ + +:: + + { (json object) + "mine" : { (json object) balances from outputs that the wallet can sign + "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs) + "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool) + "immature" : n, (numeric) balance from immature coinbase outputs + "used" : n (numeric) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating) + }, + "watchonly" : { (json object) watchonly balances (not present if wallet does not watch anything) + "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs) + "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool) + "immature" : n (numeric) balance from immature coinbase outputs + } + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli getbalances + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getbalances", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/reference/rpc/getbestblockhash.rst b/reference/rpc/getbestblockhash.rst index fc8061d..297af4b 100644 --- a/reference/rpc/getbestblockhash.rst +++ b/reference/rpc/getbestblockhash.rst @@ -6,7 +6,7 @@ getbestblockhash ``getbestblockhash`` -Returns the hash of the best (tip) block in the longest blockchain. +Returns the hash of the best (tip) block in the most-work fully-validated chain. Result ~~~~~~ @@ -33,5 +33,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getbestblockhash", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblock.rst b/reference/rpc/getblock.rst index ac4b01c..729b0c5 100644 --- a/reference/rpc/getblock.rst +++ b/reference/rpc/getblock.rst @@ -35,38 +35,38 @@ Result (for verbosity = 0) * - Name - Type - Description - * - data + * - hex - string - - A string that is serialized, hex-encoded data for block 'hash'. + - A string that is serialized, hex-encoded data for block 'hash' Result (for verbosity = 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~ :: - { - "hash" : "hash", (string) the block hash (same as provided) - "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain - "size" : n, (numeric) The block size - "strippedsize" : n, (numeric) The block size excluding witness data - "weight" : n (numeric) The block weight as defined in BIP 141 - "height" : n, (numeric) The block height or index - "version" : n, (numeric) The block version - "versionHex" : "00000000", (string) The block version formatted in hexadecimal - "merkleroot" : "xxxx", (string) The merkle root - "tx" : [ (array of string) The transaction ids - "transactionid" (string) The transaction id - ,... + { (json object) + "hash" : "hex", (string) the block hash (same as provided) + "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain + "size" : n, (numeric) The block size + "strippedsize" : n, (numeric) The block size excluding witness data + "weight" : n, (numeric) The block weight as defined in BIP 141 + "height" : n, (numeric) The block height or index + "version" : n, (numeric) The block version + "versionHex" : "hex", (string) The block version formatted in hexadecimal + "merkleroot" : "hex", (string) The merkle root + "tx" : [ (json array) The transaction ids + "hex", (string) The transaction id + ... ], - "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) - "mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) - "nonce" : n, (numeric) The nonce - "bits" : "1d00ffff", (string) The bits - "difficulty" : x.xxx, (numeric) The difficulty - "chainwork" : "xxxx", (string) Expected number of hashes required to produce the chain up to this block (in hex) - "nTx" : n, (numeric) The number of transactions in the block. - "previousblockhash" : "hash", (string) The hash of the previous block - "nextblockhash" : "hash" (string) The hash of the next block + "time" : xxx, (numeric) The block time expressed in UNIX epoch time + "mediantime" : xxx, (numeric) The median block time expressed in UNIX epoch time + "nonce" : n, (numeric) The nonce + "bits" : "hex", (string) The bits + "difficulty" : n, (numeric) The difficulty + "chainwork" : "hex", (string) Expected number of hashes required to produce the chain up to this block (in hex) + "nTx" : n, (numeric) The number of transactions in the block + "previousblockhash" : "hex", (string) The hash of the previous block + "nextblockhash" : "hex" (string) The hash of the next block } Result (for verbosity = 2) @@ -74,12 +74,14 @@ Result (for verbosity = 2) :: - { - ..., Same output as verbosity = 1. - "tx" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result. - ,... - ], - ,... Same output as verbosity = 1. + { (json object) + ..., Same output as verbosity = 1 + "tx" : [ (json array) + { (json object) + ... The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result + }, + ... + ] } Examples @@ -94,5 +96,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblockchaininfo.rst b/reference/rpc/getblockchaininfo.rst index 6ba9559..e4c726f 100644 --- a/reference/rpc/getblockchaininfo.rst +++ b/reference/rpc/getblockchaininfo.rst @@ -13,47 +13,44 @@ Result :: - { - "chain": "xxxx", (string) current network name as defined in BIP70 (main, test, regtest) - "blocks": xxxxxx, (numeric) the current number of blocks processed in the server - "headers": xxxxxx, (numeric) the current number of headers we have validated - "bestblockhash": "...", (string) the hash of the currently best block - "difficulty": xxxxxx, (numeric) the current difficulty - "mediantime": xxxxxx, (numeric) median time for the current best block - "verificationprogress": xxxx, (numeric) estimate of verification progress [0..1] - "initialblockdownload": xxxx, (bool) (debug information) estimate of whether this node is in Initial Block Download mode. - "chainwork": "xxxx" (string) total amount of work in active chain, in hexadecimal - "size_on_disk": xxxxxx, (numeric) the estimated size of the block and undo files on disk - "pruned": xx, (boolean) if the blocks are subject to pruning - "pruneheight": xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled) - "automatic_pruning": xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled) - "prune_target_size": xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled) - "softforks": [ (array) status of softforks in progress - { - "id": "xxxx", (string) name of softfork - "version": xx, (numeric) block version - "reject": { (object) progress toward rejecting pre-softfork blocks - "status": xx, (boolean) true if threshold reached - }, - }, ... - ], - "bip9_softforks": { (object) status of BIP9 softforks in progress - "xxxx" : { (string) name of the softfork - "status": "xxxx", (string) one of "defined", "started", "locked_in", "active", "failed" - "bit": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for "started" status) - "startTime": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning - "timeout": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in - "since": xx, (numeric) height of the first block to which the status applies - "statistics": { (object) numeric statistics about BIP9 signalling for a softfork (only for "started" status) - "period": xx, (numeric) the length in blocks of the BIP9 signalling period - "threshold": xx, (numeric) the number of blocks with the version bit set required to activate the feature - "elapsed": xx, (numeric) the number of blocks elapsed since the beginning of the current period - "count": xx, (numeric) the number of blocks with the version bit set in the current period - "possible": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold + { (json object) + "chain" : "str", (string) current network name (main, test, regtest) + "blocks" : n, (numeric) the height of the most-work fully-validated chain. The genesis block has height 0 + "headers" : n, (numeric) the current number of headers we have validated + "bestblockhash" : "str", (string) the hash of the currently best block + "difficulty" : n, (numeric) the current difficulty + "mediantime" : n, (numeric) median time for the current best block + "verificationprogress" : n, (numeric) estimate of verification progress [0..1] + "initialblockdownload" : true|false, (boolean) (debug information) estimate of whether this node is in Initial Block Download mode + "chainwork" : "hex", (string) total amount of work in active chain, in hexadecimal + "size_on_disk" : n, (numeric) the estimated size of the block and undo files on disk + "pruned" : true|false, (boolean) if the blocks are subject to pruning + "pruneheight" : n, (numeric) lowest-height complete block stored (only present if pruning is enabled) + "automatic_pruning" : true|false, (boolean) whether automatic pruning is enabled (only present if pruning is enabled) + "prune_target_size" : n, (numeric) the target size used by pruning (only present if automatic pruning is enabled) + "softforks" : { (json object) status of softforks + "xxxx" : { (json object) name of the softfork + "type" : "str", (string) one of "buried", "bip9" + "bip9" : { (json object) status of bip9 softforks (only for "bip9" type) + "status" : "str", (string) one of "defined", "started", "locked_in", "active", "failed" + "bit" : n, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for "started" status) + "start_time" : xxx, (numeric) the minimum median time past of a block at which the bit gains its meaning + "timeout" : xxx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in + "since" : n, (numeric) height of the first block to which the status applies + "statistics" : { (json object) numeric statistics about BIP9 signalling for a softfork (only for "started" status) + "period" : n, (numeric) the length in blocks of the BIP9 signalling period + "threshold" : n, (numeric) the number of blocks with the version bit set required to activate the feature + "elapsed" : n, (numeric) the number of blocks elapsed since the beginning of the current period + "count" : n, (numeric) the number of blocks with the version bit set in the current period + "possible" : true|false (boolean) returns false if there are not enough blocks left in this period to pass activation threshold } - } - } - "warnings" : "...", (string) any network and blockchain warnings. + }, + "height" : n, (numeric) height of the first block which the rules are or will be enforced (only for "buried" type, or "bip9" type with "active" status) + "active" : true|false (boolean) true if the rules are enforced for the mempool and the next block + }, + ... + }, + "warnings" : "str" (string) any network and blockchain warnings } Examples @@ -68,5 +65,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblockcount.rst b/reference/rpc/getblockcount.rst index 61ba39c..41446c8 100644 --- a/reference/rpc/getblockcount.rst +++ b/reference/rpc/getblockcount.rst @@ -6,7 +6,9 @@ getblockcount ``getblockcount`` -Returns the number of blocks in the longest blockchain. +Returns the height of the most-work fully-validated chain. + +The genesis block has height 0. Result ~~~~~~ @@ -33,5 +35,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblockfilter.rst b/reference/rpc/getblockfilter.rst new file mode 100644 index 0000000..f027549 --- /dev/null +++ b/reference/rpc/getblockfilter.rst @@ -0,0 +1,48 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +getblockfilter +============== + +``getblockfilter "blockhash" ( "filtertype" )`` + +Retrieve a BIP 157 content filter for a particular block. + +Argument #1 - blockhash +~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, required + +The hash of the block + +Argument #2 - filtertype +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, optional, default=basic + +The type name of the filter + +Result +~~~~~~ + +:: + + { (json object) + "filter" : "hex", (string) the hex-encoded filter data + "header" : "hex" (string) the hex-encoded filter header + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli getblockfilter "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" "basic" + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockfilter", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", "basic"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/reference/rpc/getblockhash.rst b/reference/rpc/getblockhash.rst index 826893a..caec69e 100644 --- a/reference/rpc/getblockhash.rst +++ b/reference/rpc/getblockhash.rst @@ -24,7 +24,7 @@ Result * - Name - Type - Description - * - hash + * - hex - string - The block hash @@ -40,5 +40,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockhash", "params": [1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblockheader.rst b/reference/rpc/getblockheader.rst index 2e17c3f..b15871b 100644 --- a/reference/rpc/getblockheader.rst +++ b/reference/rpc/getblockheader.rst @@ -29,22 +29,22 @@ Result (for verbose = true) :: - { - "hash" : "hash", (string) the block hash (same as provided) - "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain - "height" : n, (numeric) The block height or index - "version" : n, (numeric) The block version - "versionHex" : "00000000", (string) The block version formatted in hexadecimal - "merkleroot" : "xxxx", (string) The merkle root - "time" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) - "mediantime" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) - "nonce" : n, (numeric) The nonce - "bits" : "1d00ffff", (string) The bits - "difficulty" : x.xxx, (numeric) The difficulty - "chainwork" : "0000...1f3" (string) Expected number of hashes required to produce the current chain (in hex) - "nTx" : n, (numeric) The number of transactions in the block. - "previousblockhash" : "hash", (string) The hash of the previous block - "nextblockhash" : "hash", (string) The hash of the next block + { (json object) + "hash" : "hex", (string) the block hash (same as provided) + "confirmations" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain + "height" : n, (numeric) The block height or index + "version" : n, (numeric) The block version + "versionHex" : "hex", (string) The block version formatted in hexadecimal + "merkleroot" : "hex", (string) The merkle root + "time" : xxx, (numeric) The block time expressed in UNIX epoch time + "mediantime" : xxx, (numeric) The median block time expressed in UNIX epoch time + "nonce" : n, (numeric) The nonce + "bits" : "hex", (string) The bits + "difficulty" : n, (numeric) The difficulty + "chainwork" : "hex", (string) Expected number of hashes required to produce the current chain + "nTx" : n, (numeric) The number of transactions in the block + "previousblockhash" : "hex", (string) The hash of the previous block + "nextblockhash" : "hex" (string) The hash of the next block } Result (for verbose=false) @@ -56,9 +56,9 @@ Result (for verbose=false) * - Name - Type - Description - * - data + * - hex - string - - A string that is serialized, hex-encoded data for block 'hash'. + - A string that is serialized, hex-encoded data for block 'hash' Examples ~~~~~~~~ @@ -72,5 +72,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockheader", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockheader", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblockstats.rst b/reference/rpc/getblockstats.rst index 72a917e..9f57901 100644 --- a/reference/rpc/getblockstats.rst +++ b/reference/rpc/getblockstats.rst @@ -10,8 +10,6 @@ Compute per block statistics for a given window. All amounts are in satoshis. It won't work for some heights with pruning. -It won't work without -txindex for utxo_size_inc, \*fee or \*feerate stats. - Argument #1 - hash_or_height ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -39,42 +37,42 @@ Result :: - { (json object) - "avgfee": xxxxx, (numeric) Average fee in the block - "avgfeerate": xxxxx, (numeric) Average feerate (in satoshis per virtual byte) - "avgtxsize": xxxxx, (numeric) Average transaction size - "blockhash": xxxxx, (string) The block hash (to check for potential reorgs) - "feerate_percentiles": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte) - "10th_percentile_feerate", (numeric) The 10th percentile feerate - "25th_percentile_feerate", (numeric) The 25th percentile feerate - "50th_percentile_feerate", (numeric) The 50th percentile feerate - "75th_percentile_feerate", (numeric) The 75th percentile feerate - "90th_percentile_feerate", (numeric) The 90th percentile feerate + { (json object) + "avgfee" : n, (numeric) Average fee in the block + "avgfeerate" : n, (numeric) Average feerate (in satoshis per virtual byte) + "avgtxsize" : n, (numeric) Average transaction size + "blockhash" : "hex", (string) The block hash (to check for potential reorgs) + "feerate_percentiles" : [ (json array) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte) + n, (numeric) The 10th percentile feerate + n, (numeric) The 25th percentile feerate + n, (numeric) The 50th percentile feerate + n, (numeric) The 75th percentile feerate + n (numeric) The 90th percentile feerate ], - "height": xxxxx, (numeric) The height of the block - "ins": xxxxx, (numeric) The number of inputs (excluding coinbase) - "maxfee": xxxxx, (numeric) Maximum fee in the block - "maxfeerate": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte) - "maxtxsize": xxxxx, (numeric) Maximum transaction size - "medianfee": xxxxx, (numeric) Truncated median fee in the block - "mediantime": xxxxx, (numeric) The block median time past - "mediantxsize": xxxxx, (numeric) Truncated median transaction size - "minfee": xxxxx, (numeric) Minimum fee in the block - "minfeerate": xxxxx, (numeric) Minimum feerate (in satoshis per virtual byte) - "mintxsize": xxxxx, (numeric) Minimum transaction size - "outs": xxxxx, (numeric) The number of outputs - "subsidy": xxxxx, (numeric) The block subsidy - "swtotal_size": xxxxx, (numeric) Total size of all segwit transactions - "swtotal_weight": xxxxx, (numeric) Total weight of all segwit transactions divided by segwit scale factor (4) - "swtxs": xxxxx, (numeric) The number of segwit transactions - "time": xxxxx, (numeric) The block time - "total_out": xxxxx, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee]) - "total_size": xxxxx, (numeric) Total size of all non-coinbase transactions - "total_weight": xxxxx, (numeric) Total weight of all non-coinbase transactions divided by segwit scale factor (4) - "totalfee": xxxxx, (numeric) The fee total - "txs": xxxxx, (numeric) The number of transactions (excluding coinbase) - "utxo_increase": xxxxx, (numeric) The increase/decrease in the number of unspent outputs - "utxo_size_inc": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar) + "height" : n, (numeric) The height of the block + "ins" : n, (numeric) The number of inputs (excluding coinbase) + "maxfee" : n, (numeric) Maximum fee in the block + "maxfeerate" : n, (numeric) Maximum feerate (in satoshis per virtual byte) + "maxtxsize" : n, (numeric) Maximum transaction size + "medianfee" : n, (numeric) Truncated median fee in the block + "mediantime" : n, (numeric) The block median time past + "mediantxsize" : n, (numeric) Truncated median transaction size + "minfee" : n, (numeric) Minimum fee in the block + "minfeerate" : n, (numeric) Minimum feerate (in satoshis per virtual byte) + "mintxsize" : n, (numeric) Minimum transaction size + "outs" : n, (numeric) The number of outputs + "subsidy" : n, (numeric) The block subsidy + "swtotal_size" : n, (numeric) Total size of all segwit transactions + "swtotal_weight" : n, (numeric) Total weight of all segwit transactions + "swtxs" : n, (numeric) The number of segwit transactions + "time" : n, (numeric) The block time + "total_out" : n, (numeric) Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee]) + "total_size" : n, (numeric) Total size of all non-coinbase transactions + "total_weight" : n, (numeric) Total weight of all non-coinbase transactions + "totalfee" : n, (numeric) The fee total + "txs" : n, (numeric) The number of transactions (including coinbase) + "utxo_increase" : n, (numeric) The increase/decrease in the number of unspent outputs + "utxo_size_inc" : n (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar) } Examples @@ -83,11 +81,19 @@ Examples .. highlight:: shell +:: + + bitcoin-cli getblockstats '"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"' '["minfeerate","avgfeerate"]' + :: bitcoin-cli getblockstats 1000 '["minfeerate","avgfeerate"]' :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockstats", "params": [1000 '["minfeerate","avgfeerate"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockstats", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", ["minfeerate","avgfeerate"]]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockstats", "params": [1000, ["minfeerate","avgfeerate"]]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getblocktemplate.rst b/reference/rpc/getblocktemplate.rst index 4312cb6..14b1e6e 100644 --- a/reference/rpc/getblocktemplate.rst +++ b/reference/rpc/getblocktemplate.rst @@ -4,7 +4,7 @@ getblocktemplate ================ -``getblocktemplate "template_request"`` +``getblocktemplate ( "template_request" )`` If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. @@ -20,11 +20,12 @@ For full specification, see BIPs 22, 23, 9, and 145: Argument #1 - template_request ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**Type:** json object, required +**Type:** json object, optional, default={} -A json object in the following spec +Format of the template "rules": [ (json array, required) A list of strings - "support", (string) client side supported softfork deployment + "segwit", (string, required) (literal) indicates client side segwit support + "str", (string) other client side supported softfork deployment ... ], } @@ -34,7 +35,7 @@ A json object in the following spec { "mode": "str", (string, optional) This must be set to "template", "proposal" (see BIP 23), or omitted "capabilities": [ (json array, optional) A list of strings - "support", (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid' + "str", (string) client side supported feature, 'longpoll', 'coinbasevalue', 'proposal', 'serverlist', 'workid' ... ], @@ -43,48 +44,53 @@ Result :: - { - "version" : n, (numeric) The preferred block version - "rules" : [ "rulename", ... ], (array of strings) specific block rules that are to be enforced - "vbavailable" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments - "rulename" : bitnumber (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule - ,... + { (json object) + "version" : n, (numeric) The preferred block version + "rules" : [ (json array) specific block rules that are to be enforced + "str", (string) name of a rule the client must understand to some extent; see BIP 9 for format + ... + ], + "vbavailable" : { (json object) set of pending, supported versionbit (BIP 9) softfork deployments + "rulename" : n, (numeric) identifies the bit number as indicating acceptance and readiness for the named softfork rule + ... }, - "vbrequired" : n, (numeric) bit mask of versionbits the server requires set in submissions - "previousblockhash" : "xxxx", (string) The hash of current highest block - "transactions" : [ (array) contents of non-coinbase transactions that should be included in the next block - { - "data" : "xxxx", (string) transaction data encoded in hexadecimal (byte-for-byte) - "txid" : "xxxx", (string) transaction id encoded in little-endian hexadecimal - "hash" : "xxxx", (string) hash encoded in little-endian hexadecimal (including witness data) - "depends" : [ (array) array of numbers - n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is - ,... - ], - "fee": n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one - "sigops" : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero - "weight" : n, (numeric) total transaction weight, as counted for purposes of block limits - } - ,... + "vbrequired" : n, (numeric) bit mask of versionbits the server requires set in submissions + "previousblockhash" : "str", (string) The hash of current highest block + "transactions" : [ (json array) contents of non-coinbase transactions that should be included in the next block + { (json object) + "data" : "hex", (string) transaction data encoded in hexadecimal (byte-for-byte) + "txid" : "hex", (string) transaction id encoded in little-endian hexadecimal + "hash" : "hex", (string) hash encoded in little-endian hexadecimal (including witness data) + "depends" : [ (json array) array of numbers + n, (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is + ... + ], + "fee" : n, (numeric) difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one + "sigops" : n, (numeric) total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero + "weight" : n (numeric) total transaction weight, as counted for purposes of block limits + }, + ... ], - "coinbaseaux" : { (json object) data that should be included in the coinbase's scriptSig content - "flags" : "xx" (string) key name is to be ignored, and value included in scriptSig + "coinbaseaux" : { (json object) data that should be included in the coinbase's scriptSig content + "key" : "hex", (string) values must be in the coinbase (keys may be ignored) + ... }, - "coinbasevalue" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis) - "coinbasetxn" : { ... }, (json object) information for coinbase transaction - "target" : "xxxx", (string) The hash target - "mintime" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT) - "mutable" : [ (array of string) list of ways the block template may be changed - "value" (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock' - ,... + "coinbasevalue" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis) + "longpollid" : "str", (string) an id to include with a request to longpoll on an update to this template + "target" : "str", (string) The hash target + "mintime" : xxx, (numeric) The minimum timestamp appropriate for the next block time, expressed in UNIX epoch time + "mutable" : [ (json array) list of ways the block template may be changed + "str", (string) A way the block template may be changed, e.g. 'time', 'transactions', 'prevblock' + ... ], - "noncerange" : "00000000ffffffff",(string) A range of valid nonces - "sigoplimit" : n, (numeric) limit of sigops in blocks - "sizelimit" : n, (numeric) limit of block size - "weightlimit" : n, (numeric) limit of block weight - "curtime" : ttt, (numeric) current timestamp in seconds since epoch (Jan 1 1970 GMT) - "bits" : "xxxxxxxx", (string) compressed target of next block - "height" : n (numeric) The height of the next block + "noncerange" : "hex", (string) A range of valid nonces + "sigoplimit" : n, (numeric) limit of sigops in blocks + "sizelimit" : n, (numeric) limit of block size + "weightlimit" : n, (numeric) limit of block weight + "curtime" : xxx, (numeric) current timestamp in UNIX epoch time + "bits" : "str", (string) compressed target of next block + "height" : n, (numeric) The height of the next block + "default_witness_commitment" : "str" (string, optional) a valid witness commitment for the unmodified block template } Examples @@ -95,9 +101,9 @@ Examples :: - bitcoin-cli getblocktemplate {"rules": ["segwit"]} + bitcoin-cli getblocktemplate '{"rules": ["segwit"]}' :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblocktemplate", "params": [{"rules": ["segwit"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblocktemplate", "params": [{"rules": ["segwit"]}]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getchaintips.rst b/reference/rpc/getchaintips.rst index 5aeec3e..c6b3ecd 100644 --- a/reference/rpc/getchaintips.rst +++ b/reference/rpc/getchaintips.rst @@ -13,19 +13,20 @@ Result :: - [ - { - "height": xxxx, (numeric) height of the chain tip - "hash": "xxxx", (string) block hash of the tip - "branchlen": 0 (numeric) zero for main chain - "status": "active" (string) "active" for the main chain + [ (json array) + { (json object) + "height" : n, (numeric) height of the chain tip + "hash" : "hex", (string) block hash of the tip + "branchlen" : n, (numeric) zero for main chain, otherwise length of branch connecting the tip to the main chain + "status" : "str" (string) status of the chain, "active" for the main chain + Possible values for status: + 1. "invalid" This branch contains at least one invalid block + 2. "headers-only" Not all blocks for this branch are available, but the headers are valid + 3. "valid-headers" All blocks are available for this branch, but they were never fully validated + 4. "valid-fork" This branch is not part of the active chain, but is fully validated + 5. "active" This is the tip of the active main chain, which is certainly valid }, - { - "height": xxxx, - "hash": "xxxx", - "branchlen": 1 (numeric) length of branch connecting the tip to the main chain - "status": "xxxx" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid) - } + ... ] Examples @@ -40,5 +41,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintips", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getchaintips", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getchaintxstats.rst b/reference/rpc/getchaintxstats.rst index d284e38..a75fd59 100644 --- a/reference/rpc/getchaintxstats.rst +++ b/reference/rpc/getchaintxstats.rst @@ -27,14 +27,15 @@ Result :: - { - "time": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format. - "txcount": xxxxx, (numeric) The total number of transactions in the chain up to that point. - "window_final_block_hash": "...", (string) The hash of the final block in the window. - "window_block_count": xxxxx, (numeric) Size of the window in number of blocks. - "window_tx_count": xxxxx, (numeric) The number of transactions in the window. Only returned if "window_block_count" is > 0. - "window_interval": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if "window_block_count" is > 0. - "txrate": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if "window_interval" is > 0. + { (json object) + "time" : xxx, (numeric) The timestamp for the final block in the window, expressed in UNIX epoch time + "txcount" : n, (numeric) The total number of transactions in the chain up to that point + "window_final_block_hash" : "hex", (string) The hash of the final block in the window + "window_final_block_height" : n, (numeric) The height of the final block in the window. + "window_block_count" : n, (numeric) Size of the window in number of blocks + "window_tx_count" : n, (numeric) The number of transactions in the window. Only returned if "window_block_count" is > 0 + "window_interval" : n, (numeric) The elapsed time in the window in seconds. Only returned if "window_block_count" is > 0 + "txrate" : n (numeric) The average rate of transactions per second in the window. Only returned if "window_interval" is > 0 } Examples @@ -49,5 +50,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getchaintxstats", "params": [2016] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getchaintxstats", "params": [2016]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getconnectioncount.rst b/reference/rpc/getconnectioncount.rst index 5b6ccd3..2d89c62 100644 --- a/reference/rpc/getconnectioncount.rst +++ b/reference/rpc/getconnectioncount.rst @@ -33,5 +33,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getconnectioncount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getconnectioncount", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getdescriptorinfo.rst b/reference/rpc/getdescriptorinfo.rst index a061f47..c66918e 100644 --- a/reference/rpc/getdescriptorinfo.rst +++ b/reference/rpc/getdescriptorinfo.rst @@ -20,11 +20,12 @@ Result :: - { - "descriptor" : "desc", (string) The descriptor in canonical form, without private keys - "isrange" : true|false, (boolean) Whether the descriptor is ranged - "issolvable" : true|false, (boolean) Whether the descriptor is solvable - "hasprivatekeys" : true|false, (boolean) Whether the input descriptor contained at least one private key + { (json object) + "descriptor" : "str", (string) The descriptor in canonical form, without private keys + "checksum" : "str", (string) The checksum for the input descriptor + "isrange" : true|false, (boolean) Whether the descriptor is ranged + "issolvable" : true|false, (boolean) Whether the descriptor is solvable + "hasprivatekeys" : true|false (boolean) Whether the input descriptor contained at least one private key } Examples diff --git a/reference/rpc/getdifficulty.rst b/reference/rpc/getdifficulty.rst index c5baafd..053a0ac 100644 --- a/reference/rpc/getdifficulty.rst +++ b/reference/rpc/getdifficulty.rst @@ -17,7 +17,7 @@ Result * - Name - Type - Description - * - n.nnn + * - n - numeric - the proof-of-work difficulty as a multiple of the minimum difficulty. @@ -33,5 +33,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdifficulty", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getdifficulty", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getindexinfo.rst b/reference/rpc/getindexinfo.rst new file mode 100644 index 0000000..2c575e4 --- /dev/null +++ b/reference/rpc/getindexinfo.rst @@ -0,0 +1,51 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +getindexinfo +============ + +``getindexinfo ( "index_name" )`` + +Returns the status of one or all available indices currently running in the node. + +Argument #1 - index_name +~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, optional + +Filter results for an index with a specific name. + +Result +~~~~~~ + +:: + + { (json object) + "name" : { (json object) The name of the index + "synced" : true|false, (boolean) Whether the index is synced or not + "best_block_height" : n (numeric) The block height to which the index is synced + } + } + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli getindexinfo + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getindexinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + +:: + + bitcoin-cli getindexinfo txindex + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getindexinfo", "params": [txindex]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + diff --git a/reference/rpc/getmemoryinfo.rst b/reference/rpc/getmemoryinfo.rst index 386bbfe..202caa2 100644 --- a/reference/rpc/getmemoryinfo.rst +++ b/reference/rpc/getmemoryinfo.rst @@ -22,23 +22,29 @@ Result (mode "stats") :: - { - "locked": { (json object) Information about locked memory manager - "used": xxxxx, (numeric) Number of bytes used - "free": xxxxx, (numeric) Number of bytes available in current arenas - "total": xxxxxxx, (numeric) Total number of bytes managed - "locked": xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk. - "chunks_used": xxxxx, (numeric) Number allocated chunks - "chunks_free": xxxxx, (numeric) Number unused chunks + { (json object) + "locked" : { (json object) Information about locked memory manager + "used" : n, (numeric) Number of bytes used + "free" : n, (numeric) Number of bytes available in current arenas + "total" : n, (numeric) Total number of bytes managed + "locked" : n, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk. + "chunks_used" : n, (numeric) Number allocated chunks + "chunks_free" : n (numeric) Number unused chunks } } Result (mode "mallocinfo") ~~~~~~~~~~~~~~~~~~~~~~~~~~ -:: +.. list-table:: + :header-rows: 1 - "..." + * - Name + - Type + - Description + * - str + - string + - "..." Examples ~~~~~~~~ @@ -52,5 +58,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmemoryinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getmempoolancestors.rst b/reference/rpc/getmempoolancestors.rst index 9fc50d6..06b0e84 100644 --- a/reference/rpc/getmempoolancestors.rst +++ b/reference/rpc/getmempoolancestors.rst @@ -27,9 +27,9 @@ Result (for verbose = false) :: - [ (json array of strings) - "transactionid" (string) The transaction id of an in-mempool ancestor transaction - ,... + [ (json array) + "hex", (string) The transaction id of an in-mempool ancestor transaction + ... ] Result (for verbose = true) @@ -37,34 +37,39 @@ Result (for verbose = true) :: - { (json object) - "transactionid" : { (json object) - "size" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. - "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) - "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) - "time" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT - "height" : n, (numeric) block height when transaction entered pool - "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) - "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) - "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) - "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) - "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) - "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) - "wtxid" : hash, (string) hash of serialized transaction, including witness data - "fees" : { - "base" : n, (numeric) transaction fee in BTC - "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC - "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC - "descendant" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC - } - "depends" : [ (array) unconfirmed transactions used as inputs for this transaction - "transactionid", (string) parent transaction id - ... ] - "spentby" : [ (array) unconfirmed transactions spending outputs from this transaction - "transactionid", (string) child transaction id - ... ] - "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) - }, ... + { (json object) + "transactionid" : { (json object) + "vsize" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. + "weight" : n, (numeric) transaction weight as defined in BIP 141. + "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) + "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) + "time" : xxx, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT + "height" : n, (numeric) block height when transaction entered pool + "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) + "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) + "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) + "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) + "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) + "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) + "wtxid" : "hex", (string) hash of serialized transaction, including witness data + "fees" : { (json object) + "base" : n, (numeric) transaction fee in BTC + "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC + "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC + "descendant" : n (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC + }, + "depends" : [ (json array) unconfirmed transactions used as inputs for this transaction + "hex", (string) parent transaction id + ... + ], + "spentby" : [ (json array) unconfirmed transactions spending outputs from this transaction + "hex", (string) child transaction id + ... + ], + "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) + "unbroadcast" : true|false (boolean) Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers) + }, + ... } Examples @@ -79,5 +84,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolancestors", "params": ["mytxid"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmempoolancestors", "params": ["mytxid"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getmempooldescendants.rst b/reference/rpc/getmempooldescendants.rst index 9dc4657..6de89b9 100644 --- a/reference/rpc/getmempooldescendants.rst +++ b/reference/rpc/getmempooldescendants.rst @@ -27,9 +27,9 @@ Result (for verbose = false) :: - [ (json array of strings) - "transactionid" (string) The transaction id of an in-mempool descendant transaction - ,... + [ (json array) + "hex", (string) The transaction id of an in-mempool descendant transaction + ... ] Result (for verbose = true) @@ -37,34 +37,39 @@ Result (for verbose = true) :: - { (json object) - "transactionid" : { (json object) - "size" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. - "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) - "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) - "time" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT - "height" : n, (numeric) block height when transaction entered pool - "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) - "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) - "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) - "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) - "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) - "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) - "wtxid" : hash, (string) hash of serialized transaction, including witness data - "fees" : { - "base" : n, (numeric) transaction fee in BTC - "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC - "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC - "descendant" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC - } - "depends" : [ (array) unconfirmed transactions used as inputs for this transaction - "transactionid", (string) parent transaction id - ... ] - "spentby" : [ (array) unconfirmed transactions spending outputs from this transaction - "transactionid", (string) child transaction id - ... ] - "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) - }, ... + { (json object) + "transactionid" : { (json object) + "vsize" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. + "weight" : n, (numeric) transaction weight as defined in BIP 141. + "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) + "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) + "time" : xxx, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT + "height" : n, (numeric) block height when transaction entered pool + "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) + "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) + "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) + "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) + "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) + "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) + "wtxid" : "hex", (string) hash of serialized transaction, including witness data + "fees" : { (json object) + "base" : n, (numeric) transaction fee in BTC + "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC + "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC + "descendant" : n (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC + }, + "depends" : [ (json array) unconfirmed transactions used as inputs for this transaction + "hex", (string) parent transaction id + ... + ], + "spentby" : [ (json array) unconfirmed transactions spending outputs from this transaction + "hex", (string) child transaction id + ... + ], + "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) + "unbroadcast" : true|false (boolean) Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers) + }, + ... } Examples @@ -79,5 +84,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempooldescendants", "params": ["mytxid"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmempooldescendants", "params": ["mytxid"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getmempoolentry.rst b/reference/rpc/getmempoolentry.rst index be93f9d..e5c3582 100644 --- a/reference/rpc/getmempoolentry.rst +++ b/reference/rpc/getmempoolentry.rst @@ -20,32 +20,36 @@ Result :: - { (json object) - "size" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. - "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) - "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) - "time" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT - "height" : n, (numeric) block height when transaction entered pool - "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) - "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) - "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) - "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) - "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) - "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) - "wtxid" : hash, (string) hash of serialized transaction, including witness data - "fees" : { - "base" : n, (numeric) transaction fee in BTC - "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC - "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC - "descendant" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC - } - "depends" : [ (array) unconfirmed transactions used as inputs for this transaction - "transactionid", (string) parent transaction id - ... ] - "spentby" : [ (array) unconfirmed transactions spending outputs from this transaction - "transactionid", (string) child transaction id - ... ] - "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) + { (json object) + "vsize" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. + "weight" : n, (numeric) transaction weight as defined in BIP 141. + "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) + "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) + "time" : xxx, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT + "height" : n, (numeric) block height when transaction entered pool + "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) + "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) + "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) + "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) + "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) + "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) + "wtxid" : "hex", (string) hash of serialized transaction, including witness data + "fees" : { (json object) + "base" : n, (numeric) transaction fee in BTC + "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC + "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC + "descendant" : n (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC + }, + "depends" : [ (json array) unconfirmed transactions used as inputs for this transaction + "hex", (string) parent transaction id + ... + ], + "spentby" : [ (json array) unconfirmed transactions spending outputs from this transaction + "hex", (string) child transaction id + ... + ], + "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) + "unbroadcast" : true|false (boolean) Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers) } Examples @@ -60,5 +64,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolentry", "params": ["mytxid"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmempoolentry", "params": ["mytxid"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getmempoolinfo.rst b/reference/rpc/getmempoolinfo.rst index 4cb8c43..079233a 100644 --- a/reference/rpc/getmempoolinfo.rst +++ b/reference/rpc/getmempoolinfo.rst @@ -13,13 +13,15 @@ Result :: - { - "size": xxxxx, (numeric) Current tx count - "bytes": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted - "usage": xxxxx, (numeric) Total memory usage for the mempool - "maxmempool": xxxxx, (numeric) Maximum memory usage for the mempool - "mempoolminfee": xxxxx (numeric) Minimum fee rate in BTC/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee - "minrelaytxfee": xxxxx (numeric) Current minimum relay fee for transactions + { (json object) + "loaded" : true|false, (boolean) True if the mempool is fully loaded + "size" : n, (numeric) Current tx count + "bytes" : n, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted + "usage" : n, (numeric) Total memory usage for the mempool + "maxmempool" : n, (numeric) Maximum memory usage for the mempool + "mempoolminfee" : n, (numeric) Minimum fee rate in BTC/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee + "minrelaytxfee" : n, (numeric) Current minimum relay fee for transactions + "unbroadcastcount" : n (numeric) Current number of transactions that haven't passed initial broadcast yet } Examples @@ -34,5 +36,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmempoolinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmempoolinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getmininginfo.rst b/reference/rpc/getmininginfo.rst index 5a36f4c..dbd0060 100644 --- a/reference/rpc/getmininginfo.rst +++ b/reference/rpc/getmininginfo.rst @@ -13,15 +13,15 @@ Result :: - { - "blocks": nnn, (numeric) The current block - "currentblockweight": nnn, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled) - "currentblocktx": nnn, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled) - "difficulty": xxx.xxxxx (numeric) The current difficulty - "networkhashps": nnn, (numeric) The network hashes per second - "pooledtx": n (numeric) The size of the mempool - "chain": "xxxx", (string) current network name as defined in BIP70 (main, test, regtest) - "warnings": "..." (string) any network and blockchain warnings + { (json object) + "blocks" : n, (numeric) The current block + "currentblockweight" : n, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled) + "currentblocktx" : n, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled) + "difficulty" : n, (numeric) The current difficulty + "networkhashps" : n, (numeric) The network hashes per second + "pooledtx" : n, (numeric) The size of the mempool + "chain" : "str", (string) current network name (main, test, regtest) + "warnings" : "str" (string) any network and blockchain warnings } Examples @@ -36,5 +36,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmininginfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getnettotals.rst b/reference/rpc/getnettotals.rst index 2f4aa27..f3194ae 100644 --- a/reference/rpc/getnettotals.rst +++ b/reference/rpc/getnettotals.rst @@ -14,18 +14,17 @@ Result :: - { - "totalbytesrecv": n, (numeric) Total bytes received - "totalbytessent": n, (numeric) Total bytes sent - "timemillis": t, (numeric) Current UNIX time in milliseconds - "uploadtarget": - { - "timeframe": n, (numeric) Length of the measuring timeframe in seconds - "target": n, (numeric) Target in bytes - "target_reached": true|false, (boolean) True if target is reached - "serve_historical_blocks": true|false, (boolean) True if serving historical blocks - "bytes_left_in_cycle": t, (numeric) Bytes left in current time cycle - "time_left_in_cycle": t (numeric) Seconds left in current time cycle + { (json object) + "totalbytesrecv" : n, (numeric) Total bytes received + "totalbytessent" : n, (numeric) Total bytes sent + "timemillis" : xxx, (numeric) Current UNIX epoch time in milliseconds + "uploadtarget" : { (json object) + "timeframe" : n, (numeric) Length of the measuring timeframe in seconds + "target" : n, (numeric) Target in bytes + "target_reached" : true|false, (boolean) True if target is reached + "serve_historical_blocks" : true|false, (boolean) True if serving historical blocks + "bytes_left_in_cycle" : n, (numeric) Bytes left in current time cycle + "time_left_in_cycle" : n (numeric) Seconds left in current time cycle } } @@ -41,5 +40,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnettotals", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnettotals", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getnetworkhashps.rst b/reference/rpc/getnetworkhashps.rst index 70629e3..bab864b 100644 --- a/reference/rpc/getnetworkhashps.rst +++ b/reference/rpc/getnetworkhashps.rst @@ -35,7 +35,7 @@ Result * - Name - Type - Description - * - x + * - n - numeric - Hashes per second estimated @@ -51,5 +51,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkhashps", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnetworkhashps", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getnetworkinfo.rst b/reference/rpc/getnetworkinfo.rst index 083b1ff..6179424 100644 --- a/reference/rpc/getnetworkinfo.rst +++ b/reference/rpc/getnetworkinfo.rst @@ -13,36 +13,42 @@ Result :: - { - "version": xxxxx, (numeric) the server version - "subversion": "/Satoshi:x.x.x/", (string) the server subversion string - "protocolversion": xxxxx, (numeric) the protocol version - "localservices": "xxxxxxxxxxxxxxxx", (string) the services we offer to the network - "localrelay": true|false, (bool) true if transaction relay is requested from peers - "timeoffset": xxxxx, (numeric) the time offset - "connections": xxxxx, (numeric) the number of connections - "networkactive": true|false, (bool) whether p2p networking is enabled - "networks": [ (array) information per network - { - "name": "xxx", (string) network (ipv4, ipv6 or onion) - "limited": true|false, (boolean) is the network limited using -onlynet? - "reachable": true|false, (boolean) is the network reachable? - "proxy": "host:port" (string) the proxy that is used for this network, or empty if none - "proxy_randomize_credentials": true|false, (string) Whether randomized credentials are used - } - ,... + { (json object) + "version" : n, (numeric) the server version + "subversion" : "str", (string) the server subversion string + "protocolversion" : n, (numeric) the protocol version + "localservices" : "hex", (string) the services we offer to the network + "localservicesnames" : [ (json array) the services we offer to the network, in human-readable form + "str", (string) the service name + ... ], - "relayfee": x.xxxxxxxx, (numeric) minimum relay fee for transactions in BTC/kB - "incrementalfee": x.xxxxxxxx, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in BTC/kB - "localaddresses": [ (array) list of local addresses - { - "address": "xxxx", (string) network address - "port": xxx, (numeric) network port - "score": xxx (numeric) relative score - } - ,... - ] - "warnings": "..." (string) any network and blockchain warnings + "localrelay" : true|false, (boolean) true if transaction relay is requested from peers + "timeoffset" : n, (numeric) the time offset + "connections" : n, (numeric) the total number of connections + "connections_in" : n, (numeric) the number of inbound connections + "connections_out" : n, (numeric) the number of outbound connections + "networkactive" : true|false, (boolean) whether p2p networking is enabled + "networks" : [ (json array) information per network + { (json object) + "name" : "str", (string) network (ipv4, ipv6 or onion) + "limited" : true|false, (boolean) is the network limited using -onlynet? + "reachable" : true|false, (boolean) is the network reachable? + "proxy" : "str", (string) ("host:port") the proxy that is used for this network, or empty if none + "proxy_randomize_credentials" : true|false (boolean) Whether randomized credentials are used + }, + ... + ], + "relayfee" : n, (numeric) minimum relay fee for transactions in BTC/kB + "incrementalfee" : n, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in BTC/kB + "localaddresses" : [ (json array) list of local addresses + { (json object) + "address" : "str", (string) network address + "port" : n, (numeric) network port + "score" : n (numeric) relative score + }, + ... + ], + "warnings" : "str" (string) any network and blockchain warnings } Examples @@ -57,5 +63,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnetworkinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnetworkinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getnewaddress.rst b/reference/rpc/getnewaddress.rst index 8a0e5ae..9fdbd0f 100644 --- a/reference/rpc/getnewaddress.rst +++ b/reference/rpc/getnewaddress.rst @@ -34,7 +34,7 @@ Result * - Name - Type - Description - * - address + * - str - string - The new bitcoin address @@ -50,5 +50,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnewaddress", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getnodeaddresses.rst b/reference/rpc/getnodeaddresses.rst index 42c5402..e34ca37 100644 --- a/reference/rpc/getnodeaddresses.rst +++ b/reference/rpc/getnodeaddresses.rst @@ -13,21 +13,21 @@ Argument #1 - count **Type:** numeric, optional, default=1 -How many addresses to return. Limited to the smaller of 2500 or 23% of all known addresses. +The maximum number of addresses to return. Specify 0 to return all known addresses. Result ~~~~~~ :: - [ - { - "time": ttt, (numeric) Timestamp in seconds since epoch (Jan 1 1970 GMT) keeping track of when the node was last seen - "services": n, (numeric) The services offered - "address": "host", (string) The address of the node - "port": n (numeric) The port of the node - } - ,.... + [ (json array) + { (json object) + "time" : xxx, (numeric) The UNIX epoch time of when the node was last seen + "services" : n, (numeric) The services offered + "address" : "str", (string) The address of the node + "port" : n (numeric) The port of the node + }, + ... ] Examples @@ -42,5 +42,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnodeaddresses", "params": [8] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnodeaddresses", "params": [8]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getpeerinfo.rst b/reference/rpc/getpeerinfo.rst index ca26320..76360b4 100644 --- a/reference/rpc/getpeerinfo.rst +++ b/reference/rpc/getpeerinfo.rst @@ -13,51 +13,82 @@ Result :: - [ - { - "id": n, (numeric) Peer index - "addr":"host:port", (string) The IP address and port of the peer - "addrbind":"ip:port", (string) Bind address of the connection to the peer - "addrlocal":"ip:port", (string) Local address as reported by the peer - "services":"xxxxxxxxxxxxxxxx", (string) The services offered - "relaytxes":true|false, (boolean) Whether peer has asked us to relay transactions to it - "lastsend": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send - "lastrecv": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive - "bytessent": n, (numeric) The total bytes sent - "bytesrecv": n, (numeric) The total bytes received - "conntime": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT) - "timeoffset": ttt, (numeric) The time offset in seconds - "pingtime": n, (numeric) ping time (if available) - "minping": n, (numeric) minimum observed ping time (if any at all) - "pingwait": n, (numeric) ping wait (if non-zero) - "version": v, (numeric) The peer version, such as 70001 - "subver": "/Satoshi:0.8.5/", (string) The string version - "inbound": true|false, (boolean) Inbound (true) or Outbound (false) - "addnode": true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection - "startingheight": n, (numeric) The starting height (block) of the peer - "banscore": n, (numeric) The ban score - "synced_headers": n, (numeric) The last header we have in common with this peer - "synced_blocks": n, (numeric) The last block we have in common with this peer - "inflight": [ - n, (numeric) The heights of blocks we're currently asking from this peer - ... + [ (json array) + { (json object) + "id" : n, (numeric) Peer index + "addr" : "str", (string) (host:port) The IP address and port of the peer + "addrbind" : "str", (string) (ip:port) Bind address of the connection to the peer + "addrlocal" : "str", (string) (ip:port) Local address as reported by the peer + "network" : "str", (string) Network (ipv4, ipv6, or onion) the peer connected through + "mapped_as" : n, (numeric) The AS in the BGP route to the peer used for diversifying + peer selection (only available if the asmap config flag is set) + "services" : "hex", (string) The services offered + "servicesnames" : [ (json array) the services offered, in human-readable form + "str", (string) the service name if it is recognised + ... ], - "whitelisted": true|false, (boolean) Whether the peer is whitelisted - "minfeefilter": n, (numeric) The minimum fee rate for transactions this peer accepts - "bytessent_per_msg": { - "msg": n, (numeric) The total bytes sent aggregated by message type - When a message type is not listed in this json object, the bytes sent are 0. - Only known message types can appear as keys in the object. - ... + "relaytxes" : true|false, (boolean) Whether peer has asked us to relay transactions to it + "lastsend" : xxx, (numeric) The UNIX epoch time of the last send + "lastrecv" : xxx, (numeric) The UNIX epoch time of the last receive + "last_transaction" : xxx, (numeric) The UNIX epoch time of the last valid transaction received from this peer + "last_block" : xxx, (numeric) The UNIX epoch time of the last block received from this peer + "bytessent" : n, (numeric) The total bytes sent + "bytesrecv" : n, (numeric) The total bytes received + "conntime" : xxx, (numeric) The UNIX epoch time of the connection + "timeoffset" : n, (numeric) The time offset in seconds + "pingtime" : n, (numeric) ping time (if available) + "minping" : n, (numeric) minimum observed ping time (if any at all) + "pingwait" : n, (numeric) ping wait (if non-zero) + "version" : n, (numeric) The peer version, such as 70001 + "subver" : "str", (string) The string version + "inbound" : true|false, (boolean) Inbound (true) or Outbound (false) + "addnode" : true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection + (DEPRECATED, returned only if the config option -deprecatedrpc=getpeerinfo_addnode is passed) + "connection_type" : "str", (string) Type of connection: + outbound-full-relay (default automatic connections), + block-relay-only (does not relay transactions or addresses), + inbound (initiated by the peer), + manual (added via addnode RPC or -addnode/-connect configuration options), + addr-fetch (short-lived automatic connection for soliciting addresses), + feeler (short-lived automatic connection for testing addresses). + Please note this output is unlikely to be stable in upcoming releases as we iterate to + best capture connection behaviors. + "startingheight" : n, (numeric) The starting height (block) of the peer + "banscore" : n, (numeric) The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed) + "synced_headers" : n, (numeric) The last header we have in common with this peer + "synced_blocks" : n, (numeric) The last block we have in common with this peer + "inflight" : [ (json array) + n, (numeric) The heights of blocks we're currently asking from this peer + ... + ], + "whitelisted" : true|false, (boolean, optional) Whether the peer is whitelisted with default permissions + (DEPRECATED, returned only if config option -deprecatedrpc=whitelisted is passed) + "permissions" : [ (json array) Any special permissions that have been granted to this peer + "str", (string) bloomfilter (allow requesting BIP37 filtered blocks and transactions), + noban (do not ban for misbehavior; implies download), + forcerelay (relay transactions that are already in the mempool; implies relay), + relay (relay even in -blocksonly mode, and unlimited transaction announcements), + mempool (allow requesting BIP35 mempool contents), + download (allow getheaders during IBD, no disconnect after maxuploadtarget limit), + addr (responses to GETADDR avoid hitting the cache and contain random records with the most up-to-date info). + + ... + ], + "minfeefilter" : n, (numeric) The minimum fee rate for transactions this peer accepts + "bytessent_per_msg" : { (json object) + "msg" : n, (numeric) The total bytes sent aggregated by message type + When a message type is not listed in this json object, the bytes sent are 0. + Only known message types can appear as keys in the object. + ... }, - "bytesrecv_per_msg": { - "msg": n, (numeric) The total bytes received aggregated by message type - When a message type is not listed in this json object, the bytes received are 0. - Only known message types can appear as keys in the object and all bytes received of unknown message types are listed under '*other*'. - ... + "bytesrecv_per_msg" : { (json object) + "msg" : n (numeric) The total bytes received aggregated by message type + When a message type is not listed in this json object, the bytes received are 0. + Only known message types can appear as keys in the object and all bytes received + of unknown message types are listed under '*other*'. } - } - ,... + }, + ... ] Examples @@ -72,5 +103,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getpeerinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getrawchangeaddress.rst b/reference/rpc/getrawchangeaddress.rst index c3db397..a5fe923 100644 --- a/reference/rpc/getrawchangeaddress.rst +++ b/reference/rpc/getrawchangeaddress.rst @@ -26,7 +26,7 @@ Result * - Name - Type - Description - * - address + * - str - string - The address @@ -42,5 +42,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawchangeaddress", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getrawmempool.rst b/reference/rpc/getrawmempool.rst index d36c444..cefe7a9 100644 --- a/reference/rpc/getrawmempool.rst +++ b/reference/rpc/getrawmempool.rst @@ -4,7 +4,7 @@ getrawmempool ============= -``getrawmempool ( verbose )`` +``getrawmempool ( verbose mempool_sequence )`` Returns all transaction ids in memory pool as a json array of string transaction ids. @@ -17,14 +17,21 @@ Argument #1 - verbose True for a json object, false for array of transaction ids +Argument #2 - mempool_sequence +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=false + +If verbose=false, returns a json object with transaction list and mempool sequence number attached. + Result (for verbose = false) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: - [ (json array of string) - "transactionid" (string) The transaction id - ,... + [ (json array) + "hex", (string) The transaction id + ... ] Result (for verbose = true) @@ -32,34 +39,52 @@ Result (for verbose = true) :: - { (json object) - "transactionid" : { (json object) - "size" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. - "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) - "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) - "time" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT - "height" : n, (numeric) block height when transaction entered pool - "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) - "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) - "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) - "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) - "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) - "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) - "wtxid" : hash, (string) hash of serialized transaction, including witness data - "fees" : { - "base" : n, (numeric) transaction fee in BTC - "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC - "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC - "descendant" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC - } - "depends" : [ (array) unconfirmed transactions used as inputs for this transaction - "transactionid", (string) parent transaction id - ... ] - "spentby" : [ (array) unconfirmed transactions spending outputs from this transaction - "transactionid", (string) child transaction id - ... ] - "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) - }, ... + { (json object) + "transactionid" : { (json object) + "vsize" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted. + "weight" : n, (numeric) transaction weight as defined in BIP 141. + "fee" : n, (numeric) transaction fee in BTC (DEPRECATED) + "modifiedfee" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED) + "time" : xxx, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT + "height" : n, (numeric) block height when transaction entered pool + "descendantcount" : n, (numeric) number of in-mempool descendant transactions (including this one) + "descendantsize" : n, (numeric) virtual transaction size of in-mempool descendants (including this one) + "descendantfees" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED) + "ancestorcount" : n, (numeric) number of in-mempool ancestor transactions (including this one) + "ancestorsize" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one) + "ancestorfees" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED) + "wtxid" : "hex", (string) hash of serialized transaction, including witness data + "fees" : { (json object) + "base" : n, (numeric) transaction fee in BTC + "modified" : n, (numeric) transaction fee with fee deltas used for mining priority in BTC + "ancestor" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC + "descendant" : n (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC + }, + "depends" : [ (json array) unconfirmed transactions used as inputs for this transaction + "hex", (string) parent transaction id + ... + ], + "spentby" : [ (json array) unconfirmed transactions spending outputs from this transaction + "hex", (string) child transaction id + ... + ], + "bip125-replaceable" : true|false, (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee) + "unbroadcast" : true|false (boolean) Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers) + }, + ... + } + +Result (for verbose = false and mempool_sequence = true) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + { (json object) + "txids" : [ (json array) + "hex", (string) The transaction id + ... + ], + "mempool_sequence" : n (numeric) The mempool sequence value. } Examples @@ -74,5 +99,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawmempool", "params": [true] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawmempool", "params": [true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getrawtransaction.rst b/reference/rpc/getrawtransaction.rst index 04dbb0d..855f36e 100644 --- a/reference/rpc/getrawtransaction.rst +++ b/reference/rpc/getrawtransaction.rst @@ -50,7 +50,7 @@ Result (if verbose is not set or set to false) * - Name - Type - Description - * - data + * - str - string - The serialized, hex-encoded data for 'txid' @@ -59,50 +59,53 @@ Result (if verbose is set to true) :: - { - "in_active_chain": b, (bool) Whether specified block is in the active chain or not (only present with explicit "blockhash" argument) - "hex" : "data", (string) The serialized, hex-encoded data for 'txid' - "txid" : "id", (string) The transaction id (same as provided) - "hash" : "id", (string) The transaction hash (differs from txid for witness transactions) - "size" : n, (numeric) The serialized transaction size - "vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions) - "weight" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4) - "version" : n, (numeric) The version - "locktime" : ttt, (numeric) The lock time - "vin" : [ (array of json objects) - { - "txid": "id", (string) The transaction id - "vout": n, (numeric) - "scriptSig": { (json object) The script - "asm": "asm", (string) asm - "hex": "hex" (string) hex - }, - "sequence": n (numeric) The script sequence number - "txinwitness": ["hex", ...] (array of string) hex-encoded witness data (if any) - } - ,... + { (json object) + "in_active_chain" : true|false, (boolean) Whether specified block is in the active chain or not (only present with explicit "blockhash" argument) + "hex" : "hex", (string) The serialized, hex-encoded data for 'txid' + "txid" : "hex", (string) The transaction id (same as provided) + "hash" : "hex", (string) The transaction hash (differs from txid for witness transactions) + "size" : n, (numeric) The serialized transaction size + "vsize" : n, (numeric) The virtual transaction size (differs from size for witness transactions) + "weight" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4) + "version" : n, (numeric) The version + "locktime" : xxx, (numeric) The lock time + "vin" : [ (json array) + { (json object) + "txid" : "hex", (string) The transaction id + "vout" : n, (numeric) The output number + "scriptSig" : { (json object) The script + "asm" : "str", (string) asm + "hex" : "hex" (string) hex + }, + "sequence" : n, (numeric) The script sequence number + "txinwitness" : [ (json array) + "hex", (string) hex-encoded witness data (if any) + ... + ] + }, + ... ], - "vout" : [ (array of json objects) - { - "value" : x.xxx, (numeric) The value in BTC - "n" : n, (numeric) index - "scriptPubKey" : { (json object) - "asm" : "asm", (string) the asm - "hex" : "hex", (string) the hex - "reqSigs" : n, (numeric) The required sigs - "type" : "pubkeyhash", (string) The type, eg 'pubkeyhash' - "addresses" : [ (json array of string) - "address" (string) bitcoin address - ,... - ] - } - } - ,... + "vout" : [ (json array) + { (json object) + "value" : n, (numeric) The value in BTC + "n" : n, (numeric) index + "scriptPubKey" : { (json object) + "asm" : "str", (string) the asm + "hex" : "str", (string) the hex + "reqSigs" : n, (numeric) The required sigs + "type" : "str", (string) The type, eg 'pubkeyhash' + "addresses" : [ (json array) + "str", (string) bitcoin address + ... + ] + } + }, + ... ], - "blockhash" : "hash", (string) the block hash - "confirmations" : n, (numeric) The confirmations - "blocktime" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) - "time" : ttt, (numeric) Same as "blocktime" + "blockhash" : "hex", (string) the block hash + "confirmations" : n, (numeric) The confirmations + "blocktime" : xxx, (numeric) The block time expressed in UNIX epoch time + "time" : n (numeric) Same as "blocktime" } Examples @@ -121,7 +124,7 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawtransaction", "params": ["mytxid", true] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["mytxid", true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ :: diff --git a/reference/rpc/getreceivedbyaddress.rst b/reference/rpc/getreceivedbyaddress.rst index cb17041..9d40507 100644 --- a/reference/rpc/getreceivedbyaddress.rst +++ b/reference/rpc/getreceivedbyaddress.rst @@ -31,7 +31,7 @@ Result * - Name - Type - Description - * - amount + * - n - numeric - The total amount in BTC received at this address. @@ -43,17 +43,17 @@ Examples The amount from transactions with at least 1 confirmation:: - bitcoin-cli getreceivedbyaddress "1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX" + bitcoin-cli getreceivedbyaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" The amount including unconfirmed transactions, zero confirmations:: - bitcoin-cli getreceivedbyaddress "1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX" 0 + bitcoin-cli getreceivedbyaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0 The amount with at least 6 confirmations:: - bitcoin-cli getreceivedbyaddress "1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX" 6 + bitcoin-cli getreceivedbyaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 6 As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getreceivedbyaddress", "params": ["1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getreceivedbyaddress", "params": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", 6]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getreceivedbylabel.rst b/reference/rpc/getreceivedbylabel.rst index a83fdcf..b5612f2 100644 --- a/reference/rpc/getreceivedbylabel.rst +++ b/reference/rpc/getreceivedbylabel.rst @@ -31,7 +31,7 @@ Result * - Name - Type - Description - * - amount + * - n - numeric - The total amount in BTC received for this label. @@ -55,5 +55,5 @@ The amount with at least 6 confirmations:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getreceivedbylabel", "params": ["tabby", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getreceivedbylabel", "params": ["tabby", 6]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getrpcinfo.rst b/reference/rpc/getrpcinfo.rst index e82655a..0041dde 100644 --- a/reference/rpc/getrpcinfo.rst +++ b/reference/rpc/getrpcinfo.rst @@ -13,14 +13,15 @@ Result :: - { - "active_commands" (array) All active commands - [ - { (object) Information about an active command - "method" (string) The name of the RPC command - "duration" (numeric) The running time in microseconds - },... - ] + { (json object) + "active_commands" : [ (json array) All active commands + { (json object) Information about an active command + "method" : "str", (string) The name of the RPC command + "duration" : n (numeric) The running time in microseconds + }, + ... + ], + "logpath" : "str" (string) The complete file path to the debug log } Examples @@ -35,5 +36,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrpcinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrpcinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/gettransaction.rst b/reference/rpc/gettransaction.rst index 3cbfbf4..b7fcad0 100644 --- a/reference/rpc/gettransaction.rst +++ b/reference/rpc/gettransaction.rst @@ -4,7 +4,7 @@ gettransaction ============== -``gettransaction "txid" ( include_watchonly )`` +``gettransaction "txid" ( include_watchonly verbose )`` Get detailed information about in-wallet transaction @@ -18,48 +18,68 @@ The transaction id Argument #2 - include_watchonly ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**Type:** boolean, optional, default=false +**Type:** boolean, optional, default=true for watch-only wallets, otherwise false Whether to include watch-only addresses in balance calculation and details[] +Argument #3 - verbose +~~~~~~~~~~~~~~~~~~~~~ + +**Type:** boolean, optional, default=false + +Whether to include a `decoded` field containing the decoded transaction (equivalent to RPC decoderawtransaction) + Result ~~~~~~ :: - { - "amount" : x.xxx, (numeric) The transaction amount in BTC - "fee": x.xxx, (numeric) The amount of the fee in BTC. This is negative and only available for the - 'send' category of transactions. - "confirmations" : n, (numeric) The number of confirmations - "blockhash" : "hash", (string) The block hash - "blockindex" : xx, (numeric) The index of the transaction in the block that includes it - "blocktime" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT) - "txid" : "transactionid", (string) The transaction id. - "time" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT) - "timereceived" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT) - "bip125-replaceable": "yes|no|unknown", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee); - may be unknown for unconfirmed transactions not in the mempool - "details" : [ - { - "address" : "address", (string) The bitcoin address involved in the transaction - "category" : (string) The transaction category. - "send" Transactions sent. - "receive" Non-coinbase transactions received. - "generate" Coinbase transactions received with more than 100 confirmations. - "immature" Coinbase transactions received with 100 or fewer confirmations. - "orphan" Orphaned coinbase transactions received. - "amount" : x.xxx, (numeric) The amount in BTC - "label" : "label", (string) A comment for the address/transaction, if any - "vout" : n, (numeric) the vout value - "fee": x.xxx, (numeric) The amount of the fee in BTC. This is negative and only available for the + { (json object) + "amount" : n, (numeric) The amount in BTC + "fee" : n, (numeric) The amount of the fee in BTC. This is negative and only available for the 'send' category of transactions. - "abandoned": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the + "confirmations" : n, (numeric) The number of confirmations for the transaction. Negative confirmations means the + transaction conflicted that many blocks ago. + "generated" : true|false, (boolean) Only present if transaction only input is a coinbase one. + "trusted" : true|false, (boolean) Only present if we consider transaction to be trusted and so safe to spend from. + "blockhash" : "hex", (string) The block hash containing the transaction. + "blockheight" : n, (numeric) The block height containing the transaction. + "blockindex" : n, (numeric) The index of the transaction in the block that includes it. + "blocktime" : xxx, (numeric) The block time expressed in UNIX epoch time. + "txid" : "hex", (string) The transaction id. + "walletconflicts" : [ (json array) Conflicting transaction ids. + "hex", (string) The transaction id. + ... + ], + "time" : xxx, (numeric) The transaction time expressed in UNIX epoch time. + "timereceived" : xxx, (numeric) The time received expressed in UNIX epoch time. + "comment" : "str", (string) If a comment is associated with the transaction, only present if not empty. + "bip125-replaceable" : "str", (string) ("yes|no|unknown") Whether this transaction could be replaced due to BIP125 (replace-by-fee); + may be unknown for unconfirmed transactions not in the mempool + "details" : [ (json array) + { (json object) + "involvesWatchonly" : true|false, (boolean) Only returns true if imported addresses were involved in transaction. + "address" : "str", (string) The bitcoin address involved in the transaction. + "category" : "str", (string) The transaction category. + "send" Transactions sent. + "receive" Non-coinbase transactions received. + "generate" Coinbase transactions received with more than 100 confirmations. + "immature" Coinbase transactions received with 100 or fewer confirmations. + "orphan" Orphaned coinbase transactions received. + "amount" : n, (numeric) The amount in BTC + "label" : "str", (string) A comment for the address/transaction, if any + "vout" : n, (numeric) the vout value + "fee" : n, (numeric) The amount of the fee in BTC. This is negative and only available for the + 'send' category of transactions. + "abandoned" : true|false (boolean) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions. - } - ,... + }, + ... ], - "hex" : "data" (string) Raw data for transaction + "hex" : "hex", (string) Raw data for transaction + "decoded" : { (json object) Optional, the decoded transaction (only present when `verbose` is passed) + ... Equivalent to the RPC decoderawtransaction method, or the RPC getrawtransaction method when `verbose` is passed. + } } Examples @@ -78,5 +98,9 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettransaction", "params": ["1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + bitcoin-cli gettransaction "1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d" false true + +:: + + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "gettransaction", "params": ["1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/gettxout.rst b/reference/rpc/gettxout.rst index 9b397e9..366f511 100644 --- a/reference/rpc/gettxout.rst +++ b/reference/rpc/gettxout.rst @@ -34,21 +34,21 @@ Result :: - { - "bestblock": "hash", (string) The hash of the block at the tip of the chain - "confirmations" : n, (numeric) The number of confirmations - "value" : x.xxx, (numeric) The transaction value in BTC - "scriptPubKey" : { (json object) - "asm" : "code", (string) - "hex" : "hex", (string) - "reqSigs" : n, (numeric) Number of required signatures - "type" : "pubkeyhash", (string) The type, eg pubkeyhash - "addresses" : [ (array of string) array of bitcoin addresses - "address" (string) bitcoin address - ,... - ] + { (json object) + "bestblock" : "hex", (string) The hash of the block at the tip of the chain + "confirmations" : n, (numeric) The number of confirmations + "value" : n, (numeric) The transaction value in BTC + "scriptPubKey" : { (json object) + "asm" : "hex", (string) + "hex" : "hex", (string) + "reqSigs" : n, (numeric) Number of required signatures + "type" : "hex", (string) The type, eg pubkeyhash + "addresses" : [ (json array) array of bitcoin addresses + "str", (string) bitcoin address + ... + ] }, - "coinbase" : true|false (boolean) Coinbase or not + "coinbase" : true|false (boolean) Coinbase or not } Examples @@ -67,5 +67,5 @@ View the details:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxout", "params": ["txid", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "gettxout", "params": ["txid", 1]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/gettxoutproof.rst b/reference/rpc/gettxoutproof.rst index c5af663..ac77b36 100644 --- a/reference/rpc/gettxoutproof.rst +++ b/reference/rpc/gettxoutproof.rst @@ -18,7 +18,7 @@ Argument #1 - txids **Type:** json array, required -A json array of txids to filter +The txids to filter :: @@ -43,7 +43,7 @@ Result * - Name - Type - Description - * - data + * - str - string - A string that is a serialized, hex-encoded data for the proof. diff --git a/reference/rpc/gettxoutsetinfo.rst b/reference/rpc/gettxoutsetinfo.rst index 2e08b93..12edd32 100644 --- a/reference/rpc/gettxoutsetinfo.rst +++ b/reference/rpc/gettxoutsetinfo.rst @@ -4,26 +4,33 @@ gettxoutsetinfo =============== -``gettxoutsetinfo`` +``gettxoutsetinfo ( "hash_type" )`` Returns statistics about the unspent transaction output set. Note this call may take some time. +Argument #1 - hash_type +~~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** string, optional, default=hash_serialized_2 + +Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'none'. + Result ~~~~~~ :: - { - "height":n, (numeric) The current block height (index) - "bestblock": "hex", (string) The hash of the block at the tip of the chain - "transactions": n, (numeric) The number of transactions with unspent outputs - "txouts": n, (numeric) The number of unspent transaction outputs - "bogosize": n, (numeric) A meaningless metric for UTXO set size - "hash_serialized_2": "hash", (string) The serialized hash - "disk_size": n, (numeric) The estimated size of the chainstate on disk - "total_amount": x.xxx (numeric) The total amount + { (json object) + "height" : n, (numeric) The current block height (index) + "bestblock" : "hex", (string) The hash of the block at the tip of the chain + "transactions" : n, (numeric) The number of transactions with unspent outputs + "txouts" : n, (numeric) The number of unspent transaction outputs + "bogosize" : n, (numeric) A meaningless metric for UTXO set size + "hash_serialized_2" : "hex", (string) The serialized hash (only present if 'hash_serialized_2' hash_type is chosen) + "disk_size" : n, (numeric) The estimated size of the chainstate on disk + "total_amount" : n (numeric) The total amount } Examples @@ -38,5 +45,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "gettxoutsetinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "gettxoutsetinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/getunconfirmedbalance.rst b/reference/rpc/getunconfirmedbalance.rst index 5484257..6006988 100644 --- a/reference/rpc/getunconfirmedbalance.rst +++ b/reference/rpc/getunconfirmedbalance.rst @@ -6,5 +6,19 @@ getunconfirmedbalance ``getunconfirmedbalance`` -Returns the server's total unconfirmed balance +DEPRECATED +Identical to getbalances().mine.untrusted_pending + +Result +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Name + - Type + - Description + * - n + - numeric + - The balance diff --git a/reference/rpc/getwalletinfo.rst b/reference/rpc/getwalletinfo.rst index 076c676..384979c 100644 --- a/reference/rpc/getwalletinfo.rst +++ b/reference/rpc/getwalletinfo.rst @@ -13,20 +13,27 @@ Result :: - { - "walletname": xxxxx, (string) the wallet name - "walletversion": xxxxx, (numeric) the wallet version - "balance": xxxxxxx, (numeric) the total confirmed balance of the wallet in BTC - "unconfirmed_balance": xxx, (numeric) the total unconfirmed balance of the wallet in BTC - "immature_balance": xxxxxx, (numeric) the total immature balance of the wallet in BTC - "txcount": xxxxxxx, (numeric) the total number of transactions in the wallet - "keypoololdest": xxxxxx, (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool - "keypoolsize": xxxx, (numeric) how many new keys are pre-generated (only counts external keys) - "keypoolsize_hd_internal": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used) - "unlocked_until": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked - "paytxfee": x.xxxx, (numeric) the transaction fee configuration, set in BTC/kB - "hdseedid": "" (string, optional) the Hash160 of the HD seed (only present when HD is enabled) - "private_keys_enabled": true|false (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet) + { (json object) + "walletname" : "str", (string) the wallet name + "walletversion" : n, (numeric) the wallet version + "format" : "str", (string) the database format (bdb or sqlite) + "balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.trusted + "unconfirmed_balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.untrusted_pending + "immature_balance" : n, (numeric) DEPRECATED. Identical to getbalances().mine.immature + "txcount" : n, (numeric) the total number of transactions in the wallet + "keypoololdest" : xxx, (numeric) the UNIX epoch time of the oldest pre-generated key in the key pool. Legacy wallets only. + "keypoolsize" : n, (numeric) how many new keys are pre-generated (only counts external keys) + "keypoolsize_hd_internal" : n, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used) + "unlocked_until" : xxx, (numeric, optional) the UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets) + "paytxfee" : n, (numeric) the transaction fee configuration, set in BTC/kvB + "hdseedid" : "hex", (string, optional) the Hash160 of the HD seed (only present when HD is enabled) + "private_keys_enabled" : true|false, (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet) + "avoid_reuse" : true|false, (boolean) whether this wallet tracks clean/dirty coins in terms of reuse + "scanning" : { (json object) current scanning details, or false if no scan is in progress + "duration" : n, (numeric) elapsed seconds since scan start + "progress" : n (numeric) scanning progress percentage [0.0, 1.0] + }, + "descriptors" : true|false (boolean) whether this wallet uses descriptors for scriptPubKey management } Examples @@ -41,5 +48,5 @@ Examples :: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getwalletinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/help.rst b/reference/rpc/help.rst index f3353b9..31959e7 100644 --- a/reference/rpc/help.rst +++ b/reference/rpc/help.rst @@ -24,7 +24,7 @@ Result * - Name - Type - Description - * - text + * - str - string - The help text diff --git a/reference/rpc/importaddress.rst b/reference/rpc/importaddress.rst index 26fb8fa..8e10df7 100644 --- a/reference/rpc/importaddress.rst +++ b/reference/rpc/importaddress.rst @@ -13,9 +13,13 @@ may report that the imported address exists but related transactions are still m If you have the full public key, you should call importpubkey instead of this. +Hint: use importmulti to import more than one address. + Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated as change, and not show up in many RPCs. +Note: Use "getwalletinfo" to query the scanning progress. + Argument #1 - address ~~~~~~~~~~~~~~~~~~~~~ @@ -44,6 +48,13 @@ Argument #4 - p2sh Add the P2SH version of the script as well +Result +~~~~~~ + +:: + + null (json null) + Examples ~~~~~~~~ @@ -60,5 +71,5 @@ Import using a label without rescan:: As a JSON-RPC call:: - curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importaddress", "params": ["myaddress", "testing", false] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ + curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "importaddress", "params": ["myaddress", "testing", false]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ diff --git a/reference/rpc/importdescriptors.rst b/reference/rpc/importdescriptors.rst new file mode 100644 index 0000000..3e7ca1e --- /dev/null +++ b/reference/rpc/importdescriptors.rst @@ -0,0 +1,72 @@ +.. This file is licensed under the MIT License (MIT) available on + http://opensource.org/licenses/MIT. + +importdescriptors +================= + +``importdescriptors "requests"`` + +Import descriptors. This will trigger a rescan of the blockchain based on the earliest timestamp of all descriptors being imported. Requires a new wallet backup. + +Note: This call can take over an hour to complete if using an early timestamp; during that time, other rpc calls +may report that the imported keys, addresses or scripts exist but related transactions are still missing. + +Argument #1 - requests +~~~~~~~~~~~~~~~~~~~~~~ + +**Type:** json array, required + +Data to be imported + +:: + + [ + { (json object) + "desc": "str", (string, required) Descriptor to import. + "active": bool, (boolean, optional, default=false) Set this descriptor to be the active descriptor for the corresponding output type/externality + "range": n or [n,n], (numeric or array) If a ranged descriptor is used, this specifies the end or the range (in the form [begin,end]) to import + "next_index": n, (numeric) If a ranged descriptor is set to active, this specifies the next index to generate addresses from + "timestamp": timestamp | "now", (integer / string, required) Time from which to start rescanning the blockchain for this descriptor, in UNIX epoch time + Use the string "now" to substitute the current synced blockchain time. + "now" can be specified to bypass scanning, for outputs which are known to never have been used, and + 0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest timestamp + of all descriptors being imported will be scanned. + "internal": bool, (boolean, optional, default=false) Whether matching outputs should be treated as not incoming payments (e.g. change) + "label": "str", (string, optional, default='') Label to assign to the address, only allowed with internal=false + }, + ... + ] + +Result +~~~~~~ + +:: + + [ (json array) Response is an array with the same size as the input that has the execution result + { (json object) + "success" : true|false, (boolean) + "warnings" : [ (json array, optional) + "str", (string) + ... + ], + "error" : { (json object, optional) + ... JSONRPC error + } + }, + ... + ] + +Examples +~~~~~~~~ + + +.. highlight:: shell + +:: + + bitcoin-cli importdescriptors '[{ "desc": "", "timestamp":1455191478, "internal": true }, { "desc": "", "label": "example 2", "timestamp": 1455191480 }]' + +:: + + bitcoin-cli importdescriptors '[{ "desc": "", "timestamp":1455191478, "active": true, "range": [0,100], "label": "" }]' + diff --git a/reference/rpc/importmulti.rst b/reference/rpc/importmulti.rst index a589461..83535f3 100644 --- a/reference/rpc/importmulti.rst +++ b/reference/rpc/importmulti.rst @@ -13,7 +13,9 @@ If an address/script is imported without all of the private keys required to spe Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned. Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls -may report that the imported keys, addresses or scripts exists but related transactions are still missing. +may report that the imported keys, addresses or scripts exist but related transactions are still missing. + +Note: Use "getwalletinfo" to query the scanning progress. Argument #1 - requests ~~~~~~~~~~~~~~~~~~~~~~ @@ -36,7 +38,7 @@ Data to be imported { (json object) "desc": "str", (string) Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys "scriptPubKey": "