Skip to content

Commit

Permalink
Dev Docs: RPCs: Add New 'generate' & Note 'getgenerate' Change
Browse files Browse the repository at this point in the history
  • Loading branch information
harding committed Apr 13, 2015
1 parent a6d5b86 commit ab7ca1f
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _autocrossref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ CVE-2012-2459:
'`estimatefee` RPC': rpc estimatefee
'`estimatepriority`': rpc estimatepriority
'`estimatepriority` RPC': rpc estimatepriority
'`generate`': rpc generate
'`generate` RPC': rpc generate
'`getaccount`': rpc getaccount
'`getaccount` RPC': rpc getaccount
'`getaccountaddress`': rpc getaccountaddress
Expand Down
1 change: 1 addition & 0 deletions _includes/helpers/summaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This file is licensed under the terms of its source texts{%endcomment%}
{% assign summary_encryptWallet="encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys." %}
{% assign summary_estimateFee="estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks." %}
{% assign summary_estimatePriority="estimates the priority that a transaction needs in order to be included within a certain number of blocks as a free high-priority transaction." %}
{% assign summary_generate="nearly instantly generates blocks (in regtest mode only)" %}
{% assign summary_getAccountAddress="returns the current Bitcoin address for receiving payments to this account. If the account doesn't exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address." %}
{% assign summary_getAccount="returns the name of the account associated with the given address." %}
{% assign summary_getAddedNodeInfo="returns information about the given added node, or all added nodes (except onetry nodes). Only nodes which have been manually added using the `addnode` RPC will have their information displayed." %}
Expand Down
4 changes: 3 additions & 1 deletion _includes/ref/bitcoin-core/rpcs/quick-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Use v0.n.n in abbreviation title to prevent autocrossrefing.
{% endcomment %}

<!-- master -->
{% assign NEW_MASTER='**<abbr title="New in Bitcoin Core’s master branch (unreleased)">New in master</abbr>**' %}
{% assign UPDATED_MASTER='**<abbr title="Updated in Bitcoin Core’s master branch (unreleased)">Updated in master</abbr>**' %}

<!-- Bitcoin Core 0.10.0 expected January 2015 -->
Expand Down Expand Up @@ -76,8 +77,9 @@ Use v0.n.n in abbreviation title to prevent autocrossrefing.

{% autocrossref %}

* [Generate][rpc generate]: {{summary_generate}} {{NEW_MASTER}}
* [GetGenerate][rpc getgenerate]: {{summary_getGenerate}}
* [SetGenerate][rpc setgenerate]: {{summary_setGenerate}}
* [SetGenerate][rpc setgenerate]: {{summary_setGenerate}} {{UPDATED_MASTER}}

{% endautocrossref %}

Expand Down
64 changes: 64 additions & 0 deletions _includes/ref/bitcoin-core/rpcs/rpcs/generate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{% comment %}
This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}
{% assign filename="_includes/ref/bitcoin-core/rpcs/rpcs/generate.md" %}

##### Generate
{% include helpers/subhead-links.md %}

{% assign summary_generate="nearly instantly generates blocks (in regtest mode only)" %}

{% autocrossref %}

*Requires wallet support.*

The `generate` RPC {{summary_generate}}

*Parameter #1---the number of blocks to generate*

{% itemplate ntpd1 %}
- n: "Blocks"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "The number of blocks to generate. The RPC call will not return until all blocks have been generated"
{% enditemplate %}

*Result---the generated block header hashes*

{% itemplate ntpd1 %}
- n: "`result`"
t: "array"
p: "Required<br>(exactly 1)"
d: "An array containing the block header hashes of the generated blocks (may be empty if used with `generate 0`)"

- n: "→<br>Header Hashes"
t: "string (hex)"
p: "Required<br>(1 or more)"
d: "The hashes of the headers of the blocks generated in regtest mode, as hex in RPC byte order"
{% enditemplate %}

*Examples from Bitcoin Core master (commit c2fa0846)*

Using regtest mode, generate 2 blocks:

{% highlight bash %}
bitcoin-cli -regtest generate 2
{% endhighlight %}

Result:

{% highlight json %}
[
"36252b5852a5921bdfca8701f936b39edeb1f8c39fffe73b0d8437921401f9af",
"5f2956817db1e386759aa5794285977c70596b39ea093b9eab0aa4ba8cd50c06"
]
{% endhighlight %}

*See also*

* [SetGenerate][rpc getgenerate]: {{summary_getGenerate}}
* [GetMiningInfo][rpc getmininginfo]: {{summary_getMiningInfo}}
* [GetBlockTemplate][rpc getblocktemplate]: {{summary_getBlockTemplate}}

{% endautocrossref %}
3 changes: 3 additions & 0 deletions _includes/ref/bitcoin-core/rpcs/rpcs/setgenerate.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ The `setgenerate` RPC {{summary_setGenerate}}

*Parameter #2 (regtest)---the number of blocks to generate*

Note: setgenerate in regtest mode has been removed in Bitcoin Core
master. See the `generate` RPC for the replacement.

{% itemplate ntpd1 %}
- n: "Blocks"
t: "number (int)"
Expand Down
1 change: 1 addition & 0 deletions _includes/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ http://opensource.org/licenses/MIT.
[rpc encryptwallet]: /en/developer-reference#encryptwallet
[rpc estimatefee]: /en/developer-reference#estimatefee
[rpc estimatepriority]: /en/developer-reference#estimatepriority
[rpc generate]: /en/developer-reference#generate
[rpc getaccount]: /en/developer-reference#getaccount
[rpc getaccountaddress]: /en/developer-reference#getaccountaddress
[rpc getaddednodeinfo]: /en/developer-reference#getaddednodeinfo
Expand Down
2 changes: 2 additions & 0 deletions en/developer-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ untrusted source.

{% include ref/bitcoin-core/rpcs/rpcs/estimatepriority.md %}

{% include ref/bitcoin-core/rpcs/rpcs/generate.md %}

{% include ref/bitcoin-core/rpcs/rpcs/getaccountaddress.md %}

{% include ref/bitcoin-core/rpcs/rpcs/getaccount.md %}
Expand Down

0 comments on commit ab7ca1f

Please sign in to comment.