RPC - Add new getchaintxstats RPC

This commit is contained in:
thephez 2019-08-21 16:10:20 -04:00
parent 1de2b924a9
commit 64de2de5ac
8 changed files with 93 additions and 0 deletions

View file

@ -379,6 +379,8 @@ DIP8:
'`getblocktemplate` RPC': rpc getblocktemplate '`getblocktemplate` RPC': rpc getblocktemplate
'`getchaintips`': rpc getchaintips '`getchaintips`': rpc getchaintips
'`getchaintips` RPC': rpc getchaintips '`getchaintips` RPC': rpc getchaintips
'`getchaintxstats`': rpc getchaintxstats
'`getchaintxstats` RPC': rpc getchaintxstats
'`getconnectioncount`': rpc getconnectioncount '`getconnectioncount`': rpc getconnectioncount
'`getconnectioncount` RPC': rpc getconnectioncount '`getconnectioncount` RPC': rpc getconnectioncount
'`getdifficulty`': rpc getdifficulty '`getdifficulty`': rpc getdifficulty

View file

@ -211,6 +211,7 @@ devsearches:
- 'GetBlockHeaders': "/en/developer-reference#getblockheaders" - 'GetBlockHeaders': "/en/developer-reference#getblockheaders"
- 'GetBlockTemplate': "/en/developer-reference#getblocktemplate" - 'GetBlockTemplate': "/en/developer-reference#getblocktemplate"
- 'GetChainTips': "/en/developer-reference#getchaintips" - 'GetChainTips': "/en/developer-reference#getchaintips"
- 'GetChainTxStats': "/en/developer-reference#getchaintxstats"
- 'GetConnectionCount': "/en/developer-reference#getconnectioncount" - 'GetConnectionCount': "/en/developer-reference#getconnectioncount"
- 'GetDifficulty': "/en/developer-reference#getdifficulty" - 'GetDifficulty': "/en/developer-reference#getdifficulty"
- 'GetGenerate': "/en/developer-reference#getgenerate" - 'GetGenerate': "/en/developer-reference#getgenerate"

View file

@ -125,6 +125,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
* [GetBlockHeader][rpc getblockheader]: {{summary_getBlockHeader}} {{NEW0_12_0}} * [GetBlockHeader][rpc getblockheader]: {{summary_getBlockHeader}} {{NEW0_12_0}}
* [GetBlockHeaders][rpc getblockheaders]: {{summary_getBlockHeaders}} {{DASH_NEW0_12_1}} * [GetBlockHeaders][rpc getblockheaders]: {{summary_getBlockHeaders}} {{DASH_NEW0_12_1}}
* [GetChainTips][rpc getchaintips]: {{summary_getChainTips}} {{DASH_UPDATED0_12_3}} * [GetChainTips][rpc getchaintips]: {{summary_getChainTips}} {{DASH_UPDATED0_12_3}}
* [GetChainTxStats][rpc getchaintxstats]: {{summary_getChainTxStats}} {{DASH_NEW0_14_1}}
* [GetDifficulty][rpc getdifficulty]: {{summary_getDifficulty}} * [GetDifficulty][rpc getdifficulty]: {{summary_getDifficulty}}
* [GetMemPoolAncestors][rpc getmempoolancestors]: {{summary_getMemPoolAncestors}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}} * [GetMemPoolAncestors][rpc getmempoolancestors]: {{summary_getMemPoolAncestors}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}}
* [GetMemPoolDescendants][rpc getmempooldescendants]: {{summary_getMemPoolDescendants}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}} * [GetMemPoolDescendants][rpc getmempooldescendants]: {{summary_getMemPoolDescendants}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}}

View file

@ -0,0 +1,79 @@
{% comment %}
This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}
{% assign filename="_includes/devdoc/dash-core/rpcs/rpcs/getchaintxstats.md" %}
<!--__-->
##### GetChainTxStats
{% include helpers/subhead-links.md %}
{% assign summary_getChainTxStats="compute statistics about the total number and rate of transactions in the chain." %}
{% autocrossref %}
The `getchaintxstats` RPC {{summary_getChainTxStats}}
*Parameter #1---nblocks*
{% itemplate ntpd1 %}
- n: "nblocks"
t: "number (int)"
p: "Optional"
d: "Size of the window in number of blocks (default: one month)."
{% enditemplate %}
*Parameter #2---blockhash*
{% itemplate ntpd1 %}
- n: "blockhash"
t: "string"
p: "Optional"
d: "The hash of the block that ends the window."
{% enditemplate %}
*Result--statistics about transactions*
{% itemplate ntpd1 %}
- n: "`result`"
t: "object"
p: "Required<br>(exactly 1)"
d: "Object containing transaction statistics"
- n: "→<br>`time`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "The timestamp for the statistics in UNIX format"
- n: "→<br>`txcount`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "The total number of transactions in the chain up to that point"
- n: "→<br>`txrate`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "The average rate of transactions per second in the window"
{% enditemplate %}
*Example from Dash Core 0.14.1*
{% highlight bash %}
dash-cli -testnet getchaintxstats
{% endhighlight %}
Result:
{% highlight json %}
{
"time": 1566416832,
"txcount": 1353139,
"txrate": 0.04107376448354556
}
{% endhighlight %}
*See also: none*
{% endautocrossref %}

View file

@ -47,6 +47,7 @@ This file is licensed under the terms of its source texts{%endcomment%}
{% assign summary_getBlockHeaders="returns an array of items with information about the requested number of blockheaders starting from the requested hash." %} {% assign summary_getBlockHeaders="returns an array of items with information about the requested number of blockheaders starting from the requested hash." %}
{% assign summary_getBlockTemplate="gets a block template or proposal for use with mining software." %} {% assign summary_getBlockTemplate="gets a block template or proposal for use with mining software." %}
{% assign summary_getChainTips="returns information about the highest-height block (tip) of each local block chain." %} {% assign summary_getChainTips="returns information about the highest-height block (tip) of each local block chain." %}
{% assign summary_getChainTxStats="compute statistics about the total number and rate of transactions in the chain." %}
{% assign summary_getConnectionCount="returns the number of connections to other nodes." %} {% assign summary_getConnectionCount="returns the number of connections to other nodes." %}
{% assign summary_getDifficulty="returns the proof-of-work difficulty as a multiple of the minimum difficulty." %} {% assign summary_getDifficulty="returns the proof-of-work difficulty as a multiple of the minimum difficulty." %}
{% assign summary_getGenerate="was removed in Dash Core 0.12.3." %} {% assign summary_getGenerate="was removed in Dash Core 0.12.3." %}

View file

@ -115,6 +115,12 @@ th.tg-sort-header::-moz-selection { background:transparent; }th.tg-sort-header::
<td class="tg-baqh">Y</td> <td class="tg-baqh">Y</td>
<td class="tg-baqh">Updated in 0.12.3.0</td> <td class="tg-baqh">Updated in 0.12.3.0</td>
</tr> </tr>
<tr>
<td class="tg-yw4l">Blockchain</td>
<td class="tg-yw4l"><a href="#getchaintxstats">GetChainTxStats</a></td>
<td class="tg-baqh">Y</td>
<td class="tg-baqh">Added in 0.14.1</td>
</tr>
<tr> <tr>
<td class="tg-b7b8">Blockchain</td> <td class="tg-b7b8">Blockchain</td>
<td class="tg-b7b8"><a href="#getdifficulty">GetDifficulty</a></td> <td class="tg-b7b8"><a href="#getdifficulty">GetDifficulty</a></td>

View file

@ -114,6 +114,7 @@ http://opensource.org/licenses/MIT.
[rpc getblockheaders]: /en/developer-reference#getblockheaders [rpc getblockheaders]: /en/developer-reference#getblockheaders
[rpc getblocktemplate]: /en/developer-reference#getblocktemplate [rpc getblocktemplate]: /en/developer-reference#getblocktemplate
[rpc getchaintips]: /en/developer-reference#getchaintips [rpc getchaintips]: /en/developer-reference#getchaintips
[rpc getchaintxstats]: /en/developer-reference#getchaintxstats
[rpc getconnectioncount]: /en/developer-reference#getconnectioncount [rpc getconnectioncount]: /en/developer-reference#getconnectioncount
[rpc getdifficulty]: /en/developer-reference#getdifficulty [rpc getdifficulty]: /en/developer-reference#getdifficulty
[rpc getgenerate]: /en/developer-reference#getgenerate [rpc getgenerate]: /en/developer-reference#getgenerate

View file

@ -162,6 +162,8 @@ untrusted source.
{% include devdoc/dash-core/rpcs/rpcs/getchaintips.md %} {% include devdoc/dash-core/rpcs/rpcs/getchaintips.md %}
{% include devdoc/dash-core/rpcs/rpcs/getchaintxstats.md %}
{% include devdoc/dash-core/rpcs/rpcs/getconnectioncount.md %} {% include devdoc/dash-core/rpcs/rpcs/getconnectioncount.md %}
{% include devdoc/dash-core/rpcs/rpcs/getdifficulty.md %} {% include devdoc/dash-core/rpcs/rpcs/getdifficulty.md %}