RPC - Add chainlock param to getblock

This commit is contained in:
thephez 2019-03-28 15:26:58 -04:00
parent c04234f337
commit 8dad4f164e
No known key found for this signature in database
GPG key ID: BBC8A06DBE236099
3 changed files with 85 additions and 84 deletions

View file

@ -113,7 +113,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
{% autocrossref %} {% autocrossref %}
* [GetBestBlockHash][rpc getbestblockhash]: {{summary_getBestBlockHash}} * [GetBestBlockHash][rpc getbestblockhash]: {{summary_getBestBlockHash}}
* [GetBlock][rpc getblock]: {{summary_getBlock}} {{DASH_UPDATED0_13_0}} * [GetBlock][rpc getblock]: {{summary_getBlock}} {{DASH_UPDATED0_14_0}}
* [GetBlockChainInfo][rpc getblockchaininfo]: {{summary_getBlockChainInfo}} {{DASH_UPDATED0_13_0}} {{UPDATED0_12_1}} * [GetBlockChainInfo][rpc getblockchaininfo]: {{summary_getBlockChainInfo}} {{DASH_UPDATED0_13_0}} {{UPDATED0_12_1}}
* [GetBlockCount][rpc getblockcount]: {{summary_getBlockCount}} * [GetBlockCount][rpc getblockcount]: {{summary_getBlockCount}}
* [GetBlockHash][rpc getblockhash]: {{summary_getBlockHash}} * [GetBlockHash][rpc getblockhash]: {{summary_getBlockHash}}

View file

@ -231,61 +231,72 @@ The `getblock` RPC {{summary_getBlock}}
p: "Optional<br>(0 or 1)" p: "Optional<br>(0 or 1)"
d: "The hash of the next block on the best block chain, if known, encoded as hex in RPC byte order" d: "The hash of the next block on the best block chain, if known, encoded as hex in RPC byte order"
- n: "<br>`chainlock`"
t: "bool"
p: "Required<br>(exactly 1)"
d: "*Added in Dash Core 0.14.0*<br><br>If set to `true`, this transaction is in a block that is locked (not susceptible to a chain re-org)"
{% enditemplate %} {% enditemplate %}
*Example from Dash Core 0.13.0* *Example from Dash Core 0.14.0*
Get a block in raw hex: Get a block in raw hex:
{% highlight bash %} {% highlight bash %}
dash-cli -testnet getblock \ dash-cli -testnet getblock \
00000012e877c56af0b33d79aae888b5cb40b47809b4bee764e8fea7a9033994 \ 0000000005fdd3a647d4048f183e639310885fab7983b8e7b5079729e065d91f \
0 0
{% endhighlight %} {% endhighlight %}
Result (wrapped): Result (wrapped):
{% highlight text %} {% highlight text %}
01000020d2fb795188566bd52deaa8e62de6f59c2833e842f9f6a48cea026689\ 00000020354559625d75e59743370290291a5c7df72d1af739c3e2ecf7483314\
04000000c7274c45e043e5953f2d62a1938818b513d8fd4c9f99c2c1541d1449\ 000000002ba12397f0ae5884e623004a5e790d7c608fa013630656e61057c0e4\
7f368602c2d8175c417b4d1d0007a96501010000000100000000000000000000\ fc67a656031f9d5c3e6f221c890a5ec001030005000100000000000000000000\
00000000000000000000000000000000000000000000ffffffff1202a91a0e2f\ 00000000000000000000000000000000000000000000ffffffff4c03bc0d0104\
5032506f6f6c2d74444153482fffffffff0404e65a96010000001976a9144f79\ 031f9d5c08fabe6d6d736170747365743a7265737574736574000c870f000008\
c383bc5d3e9d4d81b98f87337cedfa78953688ac40c3609a010000001976a914\ 308d3b4900000019730100000000000000580000004f0000000d2f6e6f646553\
f627e64c0453f74d879f6e6a37709189af0298da88ac3cdd0504000000001976\ 74726174756d2f000000000240230e43000000001976a914cb594917ad4e5849\
a914badadfdebaa6d015a0299f23fbc1fcbdd72ba96f88ac0000000000000000\ 688ec63f29a0f7f3badb5da688ac40230e43000000001976a914477a52436b94\
2a6a285fb560df18bc5145faa0860841df9daf30dc544c7b0cdb52ff28c06fa3\ 4f3e9223ac8404a7717d4176fa5388ac00000000260100bc0d01001dd9fb7d61\
b33924000000000100000000000000 1bfd2c05c7a508085d2b35053a45fe67c40c0e43be7cd87a7c9b83
{% endhighlight %} {% endhighlight %}
Get the same block in JSON: Get the same block in JSON:
{% highlight bash %} {% highlight bash %}
dash-cli -testnet getblock \ dash-cli -testnet getblock \
00000012e877c56af0b33d79aae888b5cb40b47809b4bee764e8fea7a9033994 0000000005fdd3a647d4048f183e639310885fab7983b8e7b5079729e065d91f
{% endhighlight %} {% endhighlight %}
Result: Result:
{% highlight json %} {% highlight json %}
{ {
"hash": "00000012e877c56af0b33d79aae888b5cb40b47809b4bee764e8fea7a9033994", "hash": "0000000005fdd3a647d4048f183e639310885fab7983b8e7b5079729e065d91f",
"confirmations": 1, "confirmations": 1,
"size": 303, "size": 315,
"height": 6825, "height": 69052,
"version": 536870913, "version": 536870912,
"versionHex": "20000001", "versionHex": "20000000",
"merkleroot": "0286367f49141d54c1c2999f4cfdd813b5188893a1622d3f95e543e0454c27c7", "merkleroot": "56a667fce4c05710e656066313a08f607c0d795e4a0023e68458aef09723a12b",
"tx": [ "tx": [
"0286367f49141d54c1c2999f4cfdd813b5188893a1622d3f95e543e0454c27c7" "56a667fce4c05710e656066313a08f607c0d795e4a0023e68458aef09723a12b"
], ],
"time": 1545066690, "cbTx": {
"mediantime": 1545065992, "version": 1,
"nonce": 1705576192, "height": 69052,
"bits": "1d4d7b41", "merkleRootMNList": "839b7c7ad87cbe430e0cc467fe453a05352b5d0808a5c7052cfd1b617dfbd91d"
"difficulty": 0.01290611629979371, },
"chainwork": "00000000000000000000000000000000000000000000000000000647104aa574", "time": 1553800963,
"previousblockhash": "00000004896602ea8ca4f6f942e833289cf5e62de6a8ea2dd56b56885179fbd2" "mediantime": 1553800156,
"nonce": 3227388553,
"bits": "1c226f3e",
"difficulty": 7.434282417439254,
"chainwork": "000000000000000000000000000000000000000000000000003dfe3d34685d0a",
"previousblockhash": "00000000143348f7ece2c339f71a2df77d5c1a299002374397e5755d62594535",
"chainlock": false
} }
{% endhighlight %} {% endhighlight %}
@ -293,97 +304,87 @@ Get the same block in JSON with transaction details:
{% highlight bash %} {% highlight bash %}
dash-cli -testnet getblock \ dash-cli -testnet getblock \
00000012e877c56af0b33d79aae888b5cb40b47809b4bee764e8fea7a9033994 2 0000000005fdd3a647d4048f183e639310885fab7983b8e7b5079729e065d91f 2
{% endhighlight %} {% endhighlight %}
Result: Result:
{% highlight json %} {% highlight json %}
{ {
"hash": "00000012e877c56af0b33d79aae888b5cb40b47809b4bee764e8fea7a9033994", "hash": "0000000005fdd3a647d4048f183e639310885fab7983b8e7b5079729e065d91f",
"confirmations": 1, "confirmations": 1,
"size": 303, "size": 315,
"height": 6825, "height": 69052,
"version": 536870913, "version": 536870912,
"versionHex": "20000001", "versionHex": "20000000",
"merkleroot": "0286367f49141d54c1c2999f4cfdd813b5188893a1622d3f95e543e0454c27c7", "merkleroot": "56a667fce4c05710e656066313a08f607c0d795e4a0023e68458aef09723a12b",
"tx": [ "tx": [
{ {
"txid": "0286367f49141d54c1c2999f4cfdd813b5188893a1622d3f95e543e0454c27c7", "txid": "56a667fce4c05710e656066313a08f607c0d795e4a0023e68458aef09723a12b",
"size": 222, "size": 234,
"version": 1, "version": 3,
"type": 0, "type": 5,
"locktime": 0, "locktime": 0,
"vin": [ "vin": [
{ {
"coinbase": "02a91a0e2f5032506f6f6c2d74444153482f", "coinbase": "03bc0d0104031f9d5c08fabe6d6d736170747365743a7265737574736574000c870f000008308d3b4900000019730100000000000000580000004f0000000d2f6e6f64655374726174756d2f",
"sequence": 4294967295 "sequence": 0
} }
], ],
"vout": [ "vout": [
{ {
"value": 68.17506820, "value": 11.25000000,
"valueSat": 6817506820, "valueSat": 1125000000,
"n": 0, "n": 0,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 4f79c383bc5d3e9d4d81b98f87337cedfa789536 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 cb594917ad4e5849688ec63f29a0f7f3badb5da6 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9144f79c383bc5d3e9d4d81b98f87337cedfa78953688ac", "hex": "76a914cb594917ad4e5849688ec63f29a0f7f3badb5da688ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"yTZg6eePKxbJZyoaC93bVrTUq5vjhFrbst" "yereyozxENB9jbhqpbg1coE5c39ExqLSaG"
] ]
} }
}, },
{ {
"value": 68.85000000, "value": 11.25000000,
"valueSat": 6885000000, "valueSat": 1125000000,
"n": 1, "n": 1,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 f627e64c0453f74d879f6e6a37709189af0298da OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 477a52436b944f3e9223ac8404a7717d4176fa53 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914f627e64c0453f74d879f6e6a37709189af0298da88ac", "hex": "76a914477a52436b944f3e9223ac8404a7717d4176fa5388ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"yikzsfaaQ2eZ1RpVUpf1EvedzgGdJD17dC" "ySqPMrmGiB5zu7TYqgdaviEsqixPJc9hNQ"
] ]
} }
},
{
"value": 0.67493180,
"valueSat": 67493180,
"n": 2,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 badadfdebaa6d015a0299f23fbc1fcbdd72ba96f OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914badadfdebaa6d015a0299f23fbc1fcbdd72ba96f88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"ydMSjYqwv4xTossPJ1xndTxwS1Hho9DmuM"
]
}
},
{
"value": 0.00000000,
"valueSat": 0,
"n": 3,
"scriptPubKey": {
"asm": "OP_RETURN 5fb560df18bc5145faa0860841df9daf30dc544c7b0cdb52ff28c06fa3b339240000000001000000",
"hex": "6a285fb560df18bc5145faa0860841df9daf30dc544c7b0cdb52ff28c06fa3b339240000000001000000",
"type": "nulldata"
}
} }
], ],
"instantlock": false "extraPayloadSize": 38,
"extraPayload": "0100bc0d01001dd9fb7d611bfd2c05c7a508085d2b35053a45fe67c40c0e43be7cd87a7c9b83",
"cbTx": {
"version": 1,
"height": 69052,
"merkleRootMNList": "839b7c7ad87cbe430e0cc467fe453a05352b5d0808a5c7052cfd1b617dfbd91d"
},
"instantlock": false,
"chainlock": false
} }
], ],
"time": 1545066690, "cbTx": {
"mediantime": 1545065992, "version": 1,
"nonce": 1705576192, "height": 69052,
"bits": "1d4d7b41", "merkleRootMNList": "839b7c7ad87cbe430e0cc467fe453a05352b5d0808a5c7052cfd1b617dfbd91d"
"difficulty": 0.01290611629979371, },
"chainwork": "00000000000000000000000000000000000000000000000000000647104aa574", "time": 1553800963,
"previousblockhash": "00000004896602ea8ca4f6f942e833289cf5e62de6a8ea2dd56b56885179fbd2" "mediantime": 1553800156,
"nonce": 3227388553,
"bits": "1c226f3e",
"difficulty": 7.434282417439254,
"chainwork": "000000000000000000000000000000000000000000000000003dfe3d34685d0a",
"previousblockhash": "00000000143348f7ece2c339f71a2df77d5c1a299002374397e5755d62594535",
"chainlock": false
} }
{% endhighlight %} {% endhighlight %}

View file

@ -71,7 +71,7 @@ th.tg-sort-header::-moz-selection { background:transparent; }th.tg-sort-header::
<td class="tg-b7b8">Blockchain</td> <td class="tg-b7b8">Blockchain</td>
<td class="tg-b7b8"><a href="#getblock">GetBlock</a></td> <td class="tg-b7b8"><a href="#getblock">GetBlock</a></td>
<td class="tg-dzk6">Y</td> <td class="tg-dzk6">Y</td>
<td class="tg-dzk6">Updated in 0.13.0.0</td> <td class="tg-dzk6">Updated in 0.14.0.0</td>
</tr> </tr>
<tr> <tr>
<td class="tg-yw4l">Blockchain</td> <td class="tg-yw4l">Blockchain</td>