Continue updating existing Block Chain RPCs

- GetBlockHeader, GetChainTips, GetDifficulty, GetMemPoolInfo,
GetRawMemPool
This commit is contained in:
thephez 2017-10-05 13:05:24 -04:00
parent 815069243b
commit 4b356105b0
5 changed files with 95 additions and 107 deletions

View file

@ -73,11 +73,6 @@ The `getblockheader` RPC {{summary_getBlockHeader}}
p: "Required<br>(exactly 1)"
d: "This block's version number. See [block version numbers][section block versions]"
- n: "→<br>`versionHex`"
t: "number (hex)"
p: "Required<br>(exactly 1)"
d: "This block's hex version number. See [block version numbers][section block versions]"
- n: "→<br>`merkleroot`"
t: "string (hex)"
p: "Required<br>(exactly 1)"
@ -120,30 +115,41 @@ The `getblockheader` RPC {{summary_getBlockHeader}}
{% enditemplate %}
*Example from Bitcoin Core 0.12.1*
*Changes from Bitcoin - Following items not present in Dash result*
{% itemplate ntpd1 %}
- n: "→<br>`versionHex`"
t: "number (hex)"
p: "Required<br>(exactly 1)"
d: "This block's hex version number. See [block version numbers][section block versions]"
{% enditemplate %}
*Example from Dash Core 0.12.2*
Get a block header in raw hex:
{% highlight bash %}
bitcoin-cli -testnet getblockheader \
00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 \
dash-cli -testnet getblockheader \
00000000eb0af5aec7b673975a22593dc0cc763f71ba8de26292410273437078 \
false
{% endhighlight %}
Result (wrapped):
{% highlight text %}
010000007de867cc8adc5cc8fb6b898ca4462cf9fd667d7830a275277447e608\
00000000338f121232e169d3100edd82004dc2a1f0e1f030c6c488fa61eafa93\
0b0528fe021f7449ffff001d36b4af9a
01000020f61396cfd2747e94cfa088fe1f7875d8171accc22d6e5616edca0cb8\
00000000c31eb96ee1d9e78d61a601371a348c19e4e59698d0ff7869334b72cb\
7ffb76893b41d6593016011d09b2aa3c
{% endhighlight %}
Get the same block in JSON:
{% highlight bash %}
bitcoin-cli -testnet getblockheader \
00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09
dash-cli -testnet getblockheader \
00000000eb0af5aec7b673975a22593dc0cc763f71ba8de26292410273437078
{% endhighlight %}
Result:
@ -151,20 +157,19 @@ Result:
{% highlight json %}
{
"hash": "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
"confirmations": 437926,
"height": 1000,
"version": 1,
"versionHex": "00000001",
"merkleroot": "fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33",
"time": 1232346882,
"mediantime": 1232344831,
"nonce": 2595206198,
"bits": "1d00ffff",
"difficulty": 1,
"chainwork": "000000000000000000000000000000000000000000000000000003e903e903e9",
"previousblockhash": "0000000008e647742775a230787d66fdf92c46a48c896bfbc85cdc8acc67e87d",
"nextblockhash": "00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6"
"hash": "00000000eb0af5aec7b673975a22593dc0cc763f71ba8de26292410273437078",
"confirmations": 7,
"height": 4635,
"version": 536870913,
"merkleroot": "8976fb7fcb724b336978ffd09896e5e4198c341a3701a6618de7d9e16eb91ec3",
"time": 1507213627,
"mediantime": 1507213022,
"nonce": 1017819657,
"bits": "1d011630",
"difficulty": 0.920228600314536,
"chainwork": "000000000000000000000000000000000000000000000000000001e06428c09a",
"previousblockhash": "00000000b80ccaed16566e2dc2cc1a17d875781ffe88a0cf947e74d2cf9613f6",
"nextblockhash": "000000003b1aa290db62ae7cfb4dbb67c8e1402a40ef387587f930b8ec3b45db"
}
{% endhighlight %}

View file

@ -38,6 +38,16 @@ The `getchaintips` RPC {{summary_getChainTips}}
p: "Required<br>(exactly 1)"
d: "The hash of the highest block in the chain, encoded as hex in RPC byte order"
- n: "→<br>`difficulty`"
t: "number (real)"
p: "Required<br>(exactly 1)"
d: "The difficulty of the highest-height block in the best block chain (Added in Dash Core 0.12.1)"
- n: "→<br>`chainwork`"
t: "string (hex)"
p: "Required<br>(exactly 1)"
d: "The estimated number of block header hashes checked from the genesis block to this block, encoded as big-endian hex (Added in Dash Core 0.12.1)"
- n: "→ →<br>`branchlen`"
t: "number (int)"
p: "Required<br>(exactly 1)"
@ -50,32 +60,22 @@ The `getchaintips` RPC {{summary_getChainTips}}
{% enditemplate %}
*Example from Bitcoin Core 0.10.0*
*Example from Dash Core 0.12.2*
{% highlight bash %}
bitcoin-cli -testnet getchaintips
dash-cli -testnet getchaintips
{% endhighlight %}
{% highlight json %}
[
{
"height" : 312647,
"hash" : "000000000b1be96f87b31485f62c1361193304a5ad78acf47f9164ea4773a843",
"branchlen" : 0,
"status" : "active"
},
{
"height" : 282072,
"hash" : "00000000712340a499b185080f94b28c365d8adb9fc95bca541ea5e708f31028",
"branchlen" : 5,
"status" : "valid-fork"
},
{
"height" : 281721,
"hash" : "000000006e1f2a32199629c6c1fbd37766f5ce7e8c42bab0c6e1ae42b88ffe12",
"branchlen" : 1,
"status" : "valid-headers"
},
"height": 4655,
"hash": "00000000629c276241d9526d85297f2675d6edebcc7fd0c39e8f4263d729b8c1",
"difficulty": 0.9622782802772231,
"chainwork": "000000000000000000000000000000000000000000000000000001f1e286e12a",
"branchlen": 0,
"status": "active"
}
]
{% endhighlight %}

View file

@ -25,16 +25,16 @@ The `getdifficulty` RPC {{summary_getDifficulty}}
{% enditemplate %}
*Example from Bitcoin Core 0.10.0*
*Example from Dash Core 0.12.2*
{% highlight bash %}
bitcoin-cli -testnet getdifficulty
dash-cli -testnet getdifficulty
{% endhighlight %}
Result:
{% highlight text %}
1.00000000
1.069156225528583
{% endhighlight %}
*See also*

View file

@ -50,19 +50,19 @@ The `getmempoolinfo` RPC {{summary_getMemPoolInfo}}
{% enditemplate %}
*Example from Bitcoin Core 0.14.1*
*Example from Dash Core 0.12.2*
{% highlight bash %}
bitcoin-cli -testnet getmempoolinfo
dash-cli -testnet getmempoolinfo
{% endhighlight %}
Result:
{% highlight json %}
{
"size": 1237,
"bytes": 591126,
"usage": 1900416,
"size": 1,
"bytes": 3471,
"usage": 8544,
"maxmempool": 300000000,
"mempoolminfee": 0.00000000
}

View file

@ -59,12 +59,12 @@ The `getrawmempool` RPC {{summary_getRawMemPool}}
- n: "→ →<br>`fee`"
t: "number (bitcoins)"
p: "Required<br>(exactly 1)"
d: "The transaction fee paid by the transaction in decimal bitcoins"
d: "The transaction fee paid by the transaction in decimal Dash"
- n: "→ →<br>`modifiedfee`"
t: "number (bitcoins)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.12.0*<br><br>The transaction fee with fee deltas used for mining priority in decimal bitcoins"
d: "*Added in Bitcoin Core 0.12.0*<br><br>The transaction fee with fee deltas used for mining priority in decimal Dash"
- n: "→ →<br>`time`"
t: "number (int)"
@ -101,21 +101,6 @@ The `getrawmempool` RPC {{summary_getRawMemPool}}
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.12.0*<br><br>The modified fees (see `modifiedfee` above) of in-mempool descendants (including this one)"
- n: "→ →<br>`ancestorcount`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The number of in-mempool ancestor transactions (including this one)"
- n: "→ →<br>`ancestorsize`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The size of in-mempool ancestors (including this one)"
- n: "→ →<br>`ancestorfees`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The modified fees (see `modifiedfee` above) of in-mempool ancestors (including this one)"
- n: "→ →<br>`depends`"
t: "array"
p: "Required<br>(exactly 1)"
@ -128,7 +113,26 @@ The `getrawmempool` RPC {{summary_getRawMemPool}}
{% enditemplate %}
*Examples from Bitcoin Core 0.13.1*
*Changes from Bitcoin - Following items not present in Dash result*
{% itemplate ntpd1 %}
- n: "→ TXID→<br>`ancestorcount`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The number of in-mempool ancestor transactions (including this one)"
- n: "→ TXID→<br>`ancestorsize`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The size of in-mempool ancestors (including this one)"
- n: "→ TXID→<br>`ancestorfees`"
t: "number (int)"
p: "Required<br>(exactly 1)"
d: "*Added in Bitcoin Core 0.13.0*<br><br>The modified fees (see `modifiedfee` above) of in-mempool ancestors (including this one)"
{% enditemplate %}
*Examples from Dash Core 0.12.2*
The default (`false`):
@ -140,52 +144,31 @@ Result:
{% highlight json %}
[
"b104586f229e330caf42c475fd52684e9eb5e2d02f0fcd216d9554c5347b0873",
"094f7dcbc7494510d4daeceb2941ed73b1bd011bf527f6c3b7c897fee85c11d4"
"9dc994e03e387ff2d2709fbe86edede9f3d7aaddea7f75694495e415561b22fe"
]
{% endhighlight %}
Verbose output (`true`):
{% highlight bash %}
bitcoin-cli getrawmempool true
dash-cli getrawmempool true
{% endhighlight %}
Result:
{% highlight json %}
{
"b104586f229e330caf42c475fd52684e9eb5e2d02f0fcd216d9554c5347b0873": {
"size": 485,
"fee": 0.00009700,
"modifiedfee": 0.00009700,
"time": 1479423635,
"height": 439431,
"startingpriority": 15327081.81818182,
"currentpriority": 21536936.36363636,
"9dc994e03e387ff2d2709fbe86edede9f3d7aaddea7f75694495e415561b22fe": {
"size": 3471,
"fee": 0.00080520,
"modifiedfee": 0.00080520,
"time": 1507217951,
"height": 4660,
"startingpriority": 553299903846.1538,
"currentpriority": 553299903846.1538,
"descendantcount": 1,
"descendantsize": 485,
"descendantfees": 9700,
"ancestorcount": 1,
"ancestorsize": 485,
"ancestorfees": 9700,
"depends": [
]
},
"094f7dcbc7494510d4daeceb2941ed73b1bd011bf527f6c3b7c897fee85c11d4": {
"size": 554,
"fee": 0.00005540,
"modifiedfee": 0.00005540,
"time": 1479423327,
"height": 439430,
"startingpriority": 85074.91071428571,
"currentpriority": 3497174.4375,
"descendantcount": 1,
"descendantsize": 554,
"descendantfees": 5540,
"ancestorcount": 1,
"ancestorsize": 554,
"ancestorfees": 5540,
"descendantsize": 3471,
"descendantfees": 80520,
"depends": [
]
}