mirror of
https://github.com/seigler/dash-docs
synced 2025-07-28 10:16:15 +00:00
Work on updating existing Block Chain RPCs
- GetBestBlockHash, GetBlock, GetBlockChainInfo, GetBlockCount, GetBlockHash
This commit is contained in:
parent
e9ffedbb41
commit
815069243b
5 changed files with 111 additions and 116 deletions
|
@ -25,16 +25,16 @@ The `getbestblockhash` RPC {{summary_getBestBlockHash}}
|
|||
|
||||
{% enditemplate %}
|
||||
|
||||
*Example from Bitcoin Core 0.10.0*
|
||||
*Example from Dash Core 0.12.2*
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli -testnet getbestblockhash
|
||||
dash-cli -testnet getbestblockhash
|
||||
{% endhighlight %}
|
||||
|
||||
Result:
|
||||
|
||||
{% highlight text %}
|
||||
0000000000075c58ed39c3e50f99b32183d090aefa0cf8c324a82eea9b01a887
|
||||
00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c
|
||||
{% endhighlight %}
|
||||
|
||||
*See also*
|
||||
|
|
|
@ -27,9 +27,9 @@ The `getblock` RPC {{summary_getBlock}}
|
|||
|
||||
{% itemplate ntpd1 %}
|
||||
- n: "Format"
|
||||
t: "number"
|
||||
p: "Optional<br>(0, 1 or 2)"
|
||||
d: "Set to `0` to get the block in serialized block format; set to `1` (the default) to get the decoded block as a JSON object; set to `2` to get the decoded block as a JSON object with verbose transaction decoding"
|
||||
t: "boolean"
|
||||
p: "Optional<br>(true or false)"
|
||||
d: "Set to `false` to get the block in serialized block format; set to `true` (the default) to get the decoded block as a JSON object"
|
||||
|
||||
{% enditemplate %}
|
||||
|
||||
|
@ -66,16 +66,6 @@ The `getblock` RPC {{summary_getBlock}}
|
|||
p: "Required<br>(exactly 1)"
|
||||
d: "The size of this block in serialized block format, counted in bytes"
|
||||
|
||||
- n: "→<br>`strippedsize`"
|
||||
t: "number (int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.13.0*<br><br>The size of this block in serialized block format excluding witness data, counted in bytes"
|
||||
|
||||
- n: "→<br>`weight`"
|
||||
t: "number (int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.13.0*<br><br>This block's weight as defined in BIP141"
|
||||
|
||||
- n: "→<br>`height`"
|
||||
t: "number (int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
|
@ -86,11 +76,6 @@ The `getblock` RPC {{summary_getBlock}}
|
|||
p: "Required<br>(exactly 1)"
|
||||
d: "This block's version number. See [block version numbers][section block versions]"
|
||||
|
||||
- n: "→<br>`versionHex`"
|
||||
t: "string (hex)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.13.0*<br><br>This block's version formatted in hexadecimal"
|
||||
|
||||
- n: "→<br>`merkleroot`"
|
||||
t: "string (hex)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
|
@ -148,60 +133,63 @@ The `getblock` RPC {{summary_getBlock}}
|
|||
|
||||
{% enditemplate %}
|
||||
|
||||
*Example from Bitcoin Core 0.13.1*
|
||||
*Example from Dash Core 0.12.2*
|
||||
|
||||
Get a block in raw hex:
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli getblock \
|
||||
00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 \
|
||||
dash-cli -testnet getblock \
|
||||
0000000037955fcc39af8b1ae75914ffb422313c0fca7eba96a1ac99c2e57f84 \
|
||||
false
|
||||
{% endhighlight %}
|
||||
|
||||
Result (wrapped):
|
||||
|
||||
{% highlight text %}
|
||||
010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900\
|
||||
00000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e8\
|
||||
57233e0e61bc6649ffff001d01e3629901010000000100000000000000000000\
|
||||
00000000000000000000000000000000000000000000ffffffff0704ffff001d\
|
||||
0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1\
|
||||
1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781\
|
||||
e62294721166bf621e73a82cbf2342c858eeac00000000
|
||||
0100002011f5719a0a0c4881ff98b4a68c1c828dc3b10f5b51033f5f93d48dbf\
|
||||
000000004b8e38f197d6ee878e160d2bae3ce05ab898a6252458ec67ce770140\
|
||||
260397c4dd2ed659a1dd001d00636b5601010000000100000000000000000000\
|
||||
00000000000000000000000000000000000000000000ffffffff4b02041204dd\
|
||||
2ed65908fabe6d6d7445746d63506b62572d2d35584853467a765a6748696972\
|
||||
30657a3a6f6d656e010000000000000017fffff9020000000d2f6e6f64655374\
|
||||
726174756d2f00000000058028bb13010000001976a914bad55652dffb1af943\
|
||||
41015c94feea79793442fd88ac40e553b1020000001976a9142b7856de53d4c1\
|
||||
823090c98f8ad79862842c09b588ac4094dd89000000001976a914c2c29ebc78\
|
||||
7954ef99d01c5f79115abf7012fb8e88ac4094dd89000000001976a914d7b47d\
|
||||
4b40a23c389f5a17754d7f60f511c7d0ec88ac4094dd89000000001976a914dc\
|
||||
3e0793134b081145ec0c67a9c72a7b297df27c88ac00000000
|
||||
{% endhighlight %}
|
||||
|
||||
Get the same block in JSON:
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli getblock \
|
||||
00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048
|
||||
dash-cli -testnet getblock \
|
||||
0000000037955fcc39af8b1ae75914ffb422313c0fca7eba96a1ac99c2e57f84
|
||||
{% endhighlight %}
|
||||
|
||||
Result:
|
||||
|
||||
{% highlight json %}
|
||||
{
|
||||
"hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
|
||||
"confirmations": 447014,
|
||||
"strippedsize": 215,
|
||||
"size": 215,
|
||||
"weight": 860,
|
||||
"height": 1,
|
||||
"version": 1,
|
||||
"versionHex": "00000001",
|
||||
"merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
|
||||
"tx": [
|
||||
"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"
|
||||
],
|
||||
"time": 1231469665,
|
||||
"mediantime": 1231469665,
|
||||
"nonce": 2573394689,
|
||||
"bits": "1d00ffff",
|
||||
"difficulty": 1,
|
||||
"chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
|
||||
"previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
|
||||
"nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd"
|
||||
"hash": "0000000037955fcc39af8b1ae75914ffb422313c0fca7eba96a1ac99c2e57f84",
|
||||
"confirmations": 3,
|
||||
"size": 377,
|
||||
"height": 4612,
|
||||
"version": 536870913,
|
||||
"merkleroot": "c4970326400177ce67ec582425a698b85ae03cae2b0d168e87eed697f1388e4b",
|
||||
"tx": [
|
||||
"c4970326400177ce67ec582425a698b85ae03cae2b0d168e87eed697f1388e4b"
|
||||
],
|
||||
"time": 1507208925,
|
||||
"mediantime": 1507208645,
|
||||
"nonce": 1449878272,
|
||||
"bits": "1d00dda1",
|
||||
"difficulty": 1.155066358813473,
|
||||
"chainwork": "000000000000000000000000000000000000000000000000000001c3e86f0f04",
|
||||
"previousblockhash": "00000000bf8dd4935f3f03515b0fb1c38d821c8ca6b498ff81480c0a9a71f511",
|
||||
"nextblockhash": "0000000028817c7fce55d802f3647640600535a983d00e16076f284ec6cb001b"
|
||||
}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
*See also*
|
||||
|
|
|
@ -52,7 +52,7 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "number (int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.12.0*<br><br>The median time of the 11 blocks before the most recent block on the blockchain. Used for validating transaction locktime under BIP113"
|
||||
|
||||
|
||||
- n: "→<br>`verificationprogress`"
|
||||
t: "number (real)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
|
@ -67,12 +67,12 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "bool"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.11.0*<br><br>Indicates if the blocks are subject to pruning"
|
||||
|
||||
|
||||
- n: "→<br>`pruneheight`"
|
||||
t: "number (int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "*Added in Bitcoin Core 0.11.0*<br><br>The lowest-height complete block stored if prunning is activated"
|
||||
|
||||
d: "*Added in Bitcoin Core 0.11.0*<br><br>The lowest-height complete block stored if pruning is activated"
|
||||
|
||||
- n: "→<br>`softforks`"
|
||||
t: "array"
|
||||
p: "Required<br>(exactly 1)"
|
||||
|
@ -82,17 +82,17 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "object"
|
||||
p: "Required<br>(3 or more)"
|
||||
d: "A specific softfork"
|
||||
|
||||
|
||||
- n: "→ → →<br>`id`"
|
||||
t: "string"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "The name of the softfork"
|
||||
|
||||
|
||||
- n: "→ → →<br>`version`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "The block version used for the softfork"
|
||||
|
||||
|
||||
- n: "→ → →<br>`enforce`"
|
||||
t: "string : object"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
|
@ -102,12 +102,12 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "bool"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "Indicates if the threshold was reached"
|
||||
|
||||
|
||||
- n: "→ → → →<br>`found`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "Number of blocks that support the softfork"
|
||||
|
||||
|
||||
- n: "→ → → →<br>`required`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
|
@ -127,12 +127,12 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "bool"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "Indicates if the threshold was reached"
|
||||
|
||||
|
||||
- n: "→ → → →<br>`found`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "Number of blocks that support the softfork"
|
||||
|
||||
|
||||
- n: "→ → → →<br>`required`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
|
@ -142,101 +142,108 @@ The `getblockchaininfo` RPC {{summary_getBlockChainInfo}}
|
|||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "The maximum size of examined window of recent blocks"
|
||||
|
||||
|
||||
- n: "→<br>`bip9_softforks`"
|
||||
t: "object"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.12.1*<br><br>The status of BIP9 softforks in progress"
|
||||
|
||||
|
||||
- n: "→ →<br>Name"
|
||||
t: "string : object"
|
||||
p: "Required<br>(2 or more)"
|
||||
d: "A specific BIP9 softfork"
|
||||
|
||||
|
||||
- n: "→ → →<br>`status`"
|
||||
t: "string"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "Set to one of the following reasons:<br>• `defined` if voting hasn't started yet<br>• `started` if the voting has started <br>• `locked_in` if the voting was successful but the softfort hasn't been activated yet<br>• `active` if the softfork was activated<br>• `failed` if the softfork has not receieved enough votes"
|
||||
|
||||
|
||||
- n: "→ → →<br>`bit`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Optional<br>(0 or 1)"
|
||||
d: "The bit (0-28) in the block version field used to signal this softfork. Field is only shown when status is `started`"
|
||||
|
||||
- n: "→ → →<br>`startTime`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "The Unix epoch time when the softfork voting begins"
|
||||
|
||||
- n: "→ → →<br>`timeout`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "The Unix epoch time at which the deployment is considered failed if not yet locked in"
|
||||
|
||||
- n: "→ → →<br>`since`"
|
||||
t: "numeric<br>(int)"
|
||||
p: "Required<br>(exactly 1)"
|
||||
d: "*Added in Bitcoin Core 0.14.0*<br><br>The height of the first block to which the status applies"
|
||||
|
||||
|
||||
{% enditemplate %}
|
||||
|
||||
*Example from Bitcoin Core 0.14.1*
|
||||
*Example from Dash Core 0.12.2*
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli getblockchaininfo
|
||||
dash-cli -testnet getblockchaininfo
|
||||
{% endhighlight %}
|
||||
|
||||
Result:
|
||||
|
||||
{% highlight json %}
|
||||
{
|
||||
"chain": "main",
|
||||
"blocks": 464562,
|
||||
"headers": 464562,
|
||||
"bestblockhash": "00000000000000000085bd56990c579a36bade6ea427646612f13476edb30ceb",
|
||||
"difficulty": 521974519553.6282,
|
||||
"mediantime": 1493758169,
|
||||
"verificationprogress": 0.999989733170878,
|
||||
"chainwork": "00000000000000000000000000000000000000000052c26f32ffa22706efd28c",
|
||||
"chain": "test",
|
||||
"blocks": 4622,
|
||||
"headers": 4622,
|
||||
"bestblockhash": "000000007f4141e557309da09911b1c3c65b8e9eed3f5e940f7083aec8999ac7",
|
||||
"difficulty": 1.380236305048335,
|
||||
"mediantime": 1507209819,
|
||||
"verificationprogress": 0.9999053826626874,
|
||||
"chainwork": "000000000000000000000000000000000000000000000000000001d17aeaf58b",
|
||||
"pruned": false,
|
||||
"softforks": [
|
||||
{
|
||||
"id": "bip34",
|
||||
"version": 2,
|
||||
"enforce": {
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 51,
|
||||
"window": 100
|
||||
},
|
||||
"reject": {
|
||||
"status": true
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 75,
|
||||
"window": 100
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bip66",
|
||||
"version": 3,
|
||||
"enforce": {
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 51,
|
||||
"window": 100
|
||||
},
|
||||
"reject": {
|
||||
"status": true
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 75,
|
||||
"window": 100
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bip65",
|
||||
"version": 4,
|
||||
"enforce": {
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 51,
|
||||
"window": 100
|
||||
},
|
||||
"reject": {
|
||||
"status": true
|
||||
"status": true,
|
||||
"found": 100,
|
||||
"required": 75,
|
||||
"window": 100
|
||||
}
|
||||
}
|
||||
],
|
||||
"bip9_softforks": {
|
||||
"csv": {
|
||||
"status": "active",
|
||||
"startTime": 1462060800,
|
||||
"timeout": 1493596800,
|
||||
"since": 419328
|
||||
"bip9_softforks": [
|
||||
{
|
||||
"id": "csv",
|
||||
"status": "started"
|
||||
},
|
||||
"segwit": {
|
||||
"status": "started",
|
||||
"bit": 1,
|
||||
"startTime": 1479168000,
|
||||
"timeout": 1510704000,
|
||||
"since": 439488
|
||||
{
|
||||
"id": "dip0001",
|
||||
"status": "started"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{% endhighlight %}
|
||||
|
|
|
@ -25,16 +25,16 @@ The `getblockcount` RPC {{summary_getBlockCount}}
|
|||
|
||||
{% enditemplate %}
|
||||
|
||||
*Example from Bitcoin Core 0.10.0*
|
||||
*Example from Dash Core 0.12.2*
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli -testnet getblockcount
|
||||
dash-cli -testnet getblockcount
|
||||
{% endhighlight %}
|
||||
|
||||
Result:
|
||||
|
||||
{% highlight text %}
|
||||
315280
|
||||
4627
|
||||
{% endhighlight %}
|
||||
|
||||
*See also*
|
||||
|
|
|
@ -33,16 +33,16 @@ The `getblockhash` RPC {{summary_getBlockHash}}
|
|||
|
||||
{% enditemplate %}
|
||||
|
||||
*Example from Bitcoin Core 0.10.0*
|
||||
*Example from Dash Core 0.12.2*
|
||||
|
||||
{% highlight bash %}
|
||||
bitcoin-cli -testnet getblockhash 240886
|
||||
dash-cli -testnet getblockhash 4000
|
||||
{% endhighlight %}
|
||||
|
||||
Result:
|
||||
|
||||
{% highlight text %}
|
||||
00000000a0faf83ab5799354ae9c11da2a2bd6db44058e03c528851dee0a3fff
|
||||
00000ce22113f3eb8636e225d6a1691e132fdd587aed993e1bc9b07a0235eea4
|
||||
{% endhighlight %}
|
||||
|
||||
*See also*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue