From 64de2de5ac5d1c14a4ace81a35c79511581aaf4d Mon Sep 17 00:00:00 2001 From: thephez Date: Wed, 21 Aug 2019 16:10:20 -0400 Subject: [PATCH] RPC - Add new getchaintxstats RPC --- _autocrossref.yaml | 2 + _config.yml | 1 + .../devdoc/dash-core/rpcs/quick-reference.md | 1 + .../dash-core/rpcs/rpcs/getchaintxstats.md | 79 +++++++++++++++++++ _includes/helpers/summaries.md | 1 + _includes/layout/base/rpc-table.html | 6 ++ _includes/references.md | 1 + en/developer-reference.md | 2 + 8 files changed, 93 insertions(+) create mode 100644 _includes/devdoc/dash-core/rpcs/rpcs/getchaintxstats.md diff --git a/_autocrossref.yaml b/_autocrossref.yaml index 66ecd49c..52f30556 100644 --- a/_autocrossref.yaml +++ b/_autocrossref.yaml @@ -379,6 +379,8 @@ DIP8: '`getblocktemplate` RPC': rpc getblocktemplate '`getchaintips`': rpc getchaintips '`getchaintips` RPC': rpc getchaintips +'`getchaintxstats`': rpc getchaintxstats +'`getchaintxstats` RPC': rpc getchaintxstats '`getconnectioncount`': rpc getconnectioncount '`getconnectioncount` RPC': rpc getconnectioncount '`getdifficulty`': rpc getdifficulty diff --git a/_config.yml b/_config.yml index a28e448c..879e3426 100644 --- a/_config.yml +++ b/_config.yml @@ -211,6 +211,7 @@ devsearches: - 'GetBlockHeaders': "/en/developer-reference#getblockheaders" - 'GetBlockTemplate': "/en/developer-reference#getblocktemplate" - 'GetChainTips': "/en/developer-reference#getchaintips" + - 'GetChainTxStats': "/en/developer-reference#getchaintxstats" - 'GetConnectionCount': "/en/developer-reference#getconnectioncount" - 'GetDifficulty': "/en/developer-reference#getdifficulty" - 'GetGenerate': "/en/developer-reference#getgenerate" diff --git a/_includes/devdoc/dash-core/rpcs/quick-reference.md b/_includes/devdoc/dash-core/rpcs/quick-reference.md index 5abcd1c1..35c54918 100644 --- a/_includes/devdoc/dash-core/rpcs/quick-reference.md +++ b/_includes/devdoc/dash-core/rpcs/quick-reference.md @@ -125,6 +125,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core * [GetBlockHeader][rpc getblockheader]: {{summary_getBlockHeader}} {{NEW0_12_0}} * [GetBlockHeaders][rpc getblockheaders]: {{summary_getBlockHeaders}} {{DASH_NEW0_12_1}} * [GetChainTips][rpc getchaintips]: {{summary_getChainTips}} {{DASH_UPDATED0_12_3}} +* [GetChainTxStats][rpc getchaintxstats]: {{summary_getChainTxStats}} {{DASH_NEW0_14_1}} * [GetDifficulty][rpc getdifficulty]: {{summary_getDifficulty}} * [GetMemPoolAncestors][rpc getmempoolancestors]: {{summary_getMemPoolAncestors}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}} * [GetMemPoolDescendants][rpc getmempooldescendants]: {{summary_getMemPoolDescendants}} {{DASH_UPDATED0_14_0}} {{NEW0_13_0}} diff --git a/_includes/devdoc/dash-core/rpcs/rpcs/getchaintxstats.md b/_includes/devdoc/dash-core/rpcs/rpcs/getchaintxstats.md new file mode 100644 index 00000000..01e80365 --- /dev/null +++ b/_includes/devdoc/dash-core/rpcs/rpcs/getchaintxstats.md @@ -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
(exactly 1)" + d: "Object containing transaction statistics" + +- n: "→
`time`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The timestamp for the statistics in UNIX format" + +- n: "→
`txcount`" + t: "number (int)" + p: "Required
(exactly 1)" + d: "The total number of transactions in the chain up to that point" + +- n: "→
`txrate`" + t: "number (int)" + p: "Required
(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 %} diff --git a/_includes/helpers/summaries.md b/_includes/helpers/summaries.md index 9044b144..c2b735df 100644 --- a/_includes/helpers/summaries.md +++ b/_includes/helpers/summaries.md @@ -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_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_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_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." %} diff --git a/_includes/layout/base/rpc-table.html b/_includes/layout/base/rpc-table.html index d036de01..c98b3fc5 100644 --- a/_includes/layout/base/rpc-table.html +++ b/_includes/layout/base/rpc-table.html @@ -115,6 +115,12 @@ th.tg-sort-header::-moz-selection { background:transparent; }th.tg-sort-header:: Y Updated in 0.12.3.0 + + Blockchain + GetChainTxStats + Y + Added in 0.14.1 + Blockchain GetDifficulty diff --git a/_includes/references.md b/_includes/references.md index 6e8840b3..595d1684 100644 --- a/_includes/references.md +++ b/_includes/references.md @@ -114,6 +114,7 @@ http://opensource.org/licenses/MIT. [rpc getblockheaders]: /en/developer-reference#getblockheaders [rpc getblocktemplate]: /en/developer-reference#getblocktemplate [rpc getchaintips]: /en/developer-reference#getchaintips +[rpc getchaintxstats]: /en/developer-reference#getchaintxstats [rpc getconnectioncount]: /en/developer-reference#getconnectioncount [rpc getdifficulty]: /en/developer-reference#getdifficulty [rpc getgenerate]: /en/developer-reference#getgenerate diff --git a/en/developer-reference.md b/en/developer-reference.md index 954bf030..91cc076e 100644 --- a/en/developer-reference.md +++ b/en/developer-reference.md @@ -162,6 +162,8 @@ untrusted source. {% 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/getdifficulty.md %}