Continue updating existing Block Chain RPCs

- GetTxOut, GetTxOutProof, GetTxOutSetInfo, VerifyChain,
VerifyTxOutProof
Update previous block hash type to indicate X11 instead of double SHA256
This commit is contained in:
thephez 2017-10-05 16:33:18 -04:00
parent d93da23e46
commit 8a0e561d93
7 changed files with 55 additions and 76 deletions

View file

@ -57,12 +57,12 @@ The `getrawmempool` RPC {{summary_getRawMemPool}}
d: "The size of the serialized transaction in bytes" d: "The size of the serialized transaction in bytes"
- n: "→ →<br>`fee`" - n: "→ →<br>`fee`"
t: "number (bitcoins)" t: "amount (Dash)"
p: "Required<br>(exactly 1)" p: "Required<br>(exactly 1)"
d: "The transaction fee paid by the transaction in decimal Dash" d: "The transaction fee paid by the transaction in decimal Dash"
- n: "→ →<br>`modifiedfee`" - n: "→ →<br>`modifiedfee`"
t: "number (bitcoins)" t: "amount (Dash)"
p: "Required<br>(exactly 1)" 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 Dash" d: "*Added in Bitcoin Core 0.12.0*<br><br>The transaction fee with fee deltas used for mining priority in decimal Dash"

View file

@ -63,9 +63,9 @@ The `gettxout` RPC {{summary_getTxOut}}
d: "The number of confirmations received for the transaction containing this output or `0` if the transaction hasn't been confirmed yet" d: "The number of confirmations received for the transaction containing this output or `0` if the transaction hasn't been confirmed yet"
- n: "→<br>`value`" - n: "→<br>`value`"
t: "number (bitcoins)" t: "number (Dash)"
p: "Required<br>(exactly 1)" p: "Required<br>(exactly 1)"
d: "The amount of bitcoins spent to this output. May be `0`" d: "The amount of Dash spent to this output. May be `0`"
- n: "→<br>`scriptPubKey`" - n: "→<br>`scriptPubKey`"
t: "string : object" t: "string : object"
@ -114,15 +114,15 @@ The `gettxout` RPC {{summary_getTxOut}}
{% enditemplate %} {% enditemplate %}
*Example from Bitcoin Core 0.10.0* *Example from Dash Core 0.12.2*
Get the UTXO from the following transaction from the first output index ("0"), Get the UTXO from the following transaction from the first output index ("0"),
searching the memory pool if necessary. searching the memory pool if necessary.
{% highlight bash %} {% highlight bash %}
bitcoin-cli -testnet gettxout \ dash-cli -testnet gettxout \
d77aee99e8bdc11f40b8a9354956f0346fec5535b82c77c8b5c06047e3bca86a \ e0a06b47f0de6f3851a228d5ac377ac38b495adf04298c43e951e679c5b0aa8f \
0 true 0 true
{% endhighlight %} {% endhighlight %}
@ -130,20 +130,20 @@ Result:
{% highlight json %} {% highlight json %}
{ {
"bestblock" : "00000000c92356f7030b1deeab54b3b02885711320b4c48523be9daa3e0ace5d", "bestblock": "000000005651f6d7859793dee07d476a2f2a7338e66bbb41caf4b544c5b0318d",
"confirmations" : 0, "confirmations": 2,
"value" : 0.00100000, "value": 25.00000000,
"scriptPubKey" : { "scriptPubKey": {
"asm" : "OP_DUP OP_HASH160 a11418d3c144876258ba02909514d90e71ad8443 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 b66266c5017a759817f3bb99e8d9124bf5bb2e74 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a914a11418d3c144876258ba02909514d90e71ad844388ac", "hex": "76a914b66266c5017a759817f3bb99e8d9124bf5bb2e7488ac",
"reqSigs" : 1, "reqSigs": 1,
"type" : "pubkeyhash", "type": "pubkeyhash",
"addresses" : [ "addresses": [
"mvCfAJSKaoFXoJEvv8ssW7wxaqRPphQuSv" "ycwoiAibTjpwnoCZSX7S4kiB2H8wULw9qo"
] ]
}, },
"version" : 1, "version": 1,
"coinbase" : false "coinbase": false
} }
{% endhighlight %} {% endhighlight %}

View file

@ -53,38 +53,28 @@ specify the block in which the transaction is included in manually (by block hea
{% enditemplate %} {% enditemplate %}
*Example from Bitcoin Core 0.11.0* *Example from Dash Core 0.12.2*
Get the hex-encoded proof that "txid" was included in block 0000000000000000140e84bf183d8d5207d65fbfae596bdf48f684d13d951847: Get the hex-encoded proof that "txid" was included in block 000000012d774f3c7668f32bc448efeb93b317f312dd863679de3a007d47817f:
{% highlight bash %} {% highlight bash %}
bitcoin-cli gettxoutproof \ dash-cli gettxoutproof \
''' '''
[ [
"f20e44c818ec332d95119507fbe36f1b8b735e2c387db62adbe28e50f7904683" "e0a06b47f0de6f3851a228d5ac377ac38b495adf04298c43e951e679c5b0aa8f"
] ]
''' \ ''' \
'0000000000000000140e84bf183d8d5207d65fbfae596bdf48f684d13d951847' '000000012d774f3c7668f32bc448efeb93b317f312dd863679de3a007d47817f'
{% endhighlight %} {% endhighlight %}
Result (wrapped): Result (wrapped):
{% highlight text %} {% highlight text %}
03000000394ab3f08f712aa0f1d26c5daa4040b50e96d31d4e8e3c130000000000000000\ 01000020ed72cc6a7294782a7711d8fa7ef74716ef062dc50bb0820f7eec923801000000\
ca89aaa0bbbfcd5d1210c7888501431256135736817100d8c2cf7e4ab9c02b168115d455\ aa5d17c5128043803b67c7ab03e4d3ffbc9604b54f877f1c5cf9ed3adeaa19b2cd7ed659\
04dd1418836b20a6cb0800000d3a61beb3859abf1b773d54796c83b0b937968cc4ce3c0f\ f838011d10a70a480200000002033c89c2baecba9fc983c85dcf365c2d9cc93aca1dee2e\
71f981b2407a3241cb8908f2a88ac90a2844596e6019450f507e7efb8542cbe54ea55634\ 5ac18124464056542e8faab0c579e651e9438c2904df5a498bc37a37acd528a251386fde\
c87bee474ee48aced68179564290d476e16cff01b483edcd2004d555c617dfc08200c083\ f0476ba0e00105
08ba511250e459b49d6a465e1ab1d5d8005e0778359c2993236c85ec66bac4bfd974131a\
dc1ee0ad8b645f459164eb38325ac88f98c9607752bc1b637e16814f0d9d8c2775ac3f20\
f85260947929ceef16ead56fcbfd77d9dc6126cce1b5aacd9f834690f7508ee2db2ab67d\
382c5e738b1b6fe3fb079511952d33ec18c8440ef291eb8d3546a971ee4aa5e574b7be7f\
5aff0b1c989b2059ae5a611c8ce5c58e8e8476246c5e7c6b70e0065f2a6654e2e6cf4efb\
6ae19bf2548a7d9febf5b0aceaff28610922e1b9e23e52f650a4a11d2986c9c2b09bb168\
a70a7d4ac16e4d389bc2868ee91da1837d2cd79288bdc680e9c35ebb3ddfd045d69d767b\
164ec69d5db9f995c045d10af5bd90cd9d1116c3732e14796ef9d1a57fa7bb718c07989e\
d06ff359bf2009eaf1b9e000c054b87230567991b447757bc6ca8e1bb6e9816ad604dbd6\
0600
{% endhighlight %} {% endhighlight %}
*See also* *See also*

View file

@ -54,29 +54,29 @@ The `gettxoutsetinfo` RPC {{summary_getTxOutSetInfo}}
d: "A SHA256(SHA256()) hash of the serialized UTXO set; useful for comparing two nodes to see if they have the same set (they should, if they always used the same serialization format and currently have the same best block). The hash is encoded as hex in RPC byte order" d: "A SHA256(SHA256()) hash of the serialized UTXO set; useful for comparing two nodes to see if they have the same set (they should, if they always used the same serialization format and currently have the same best block). The hash is encoded as hex in RPC byte order"
- n: "→<br>`total_amount`" - n: "→<br>`total_amount`"
t: "number (bitcoins)" t: "number (Dash)"
p: "Required<br>(exactly 1)" p: "Required<br>(exactly 1)"
d: "The total number of bitcoins in the UTXO set" d: "The total amount of Dash in the UTXO set"
{% enditemplate %} {% enditemplate %}
*Example from Bitcoin Core 0.10.0* *Example from Dash Core 0.12.2*
{% highlight bash %} {% highlight bash %}
bitcoin-cli -testnet gettxoutsetinfo dash-cli -testnet gettxoutsetinfo
{% endhighlight %} {% endhighlight %}
Result: Result:
{% highlight json %} {% highlight json %}
{ {
"height" : 315293, "height": 4755,
"bestblock" : "00000000c92356f7030b1deeab54b3b02885711320b4c48523be9daa3e0ace5d", "bestblock": "0000000025da0abc9e9937f1c65b3f544a57bb7e8817422f7ff2a89ff32696f4",
"transactions" : 771920, "transactions": 4748,
"txouts" : 2734587, "txouts": 10602,
"bytes_serialized" : 102629817, "bytes_serialized": 463925,
"hash_serialized" : "4753470fda0145760109e79b8c218a1331e84bb4269d116857b8a4597f109905", "hash_serialized": "fce0776d7961b409c4d8a46363c8d049879321861f7f40db97b0432e59532320",
"total_amount" : 13131746.33839451 "total_amount": 2243585.70000000
} }
{% endhighlight %} {% endhighlight %}

View file

@ -43,16 +43,15 @@ The `verifychain` RPC {{summary_verifyChain}}
{% enditemplate %} {% enditemplate %}
*Example from Bitcoin Core 0.10.0* *Example from Dash Core 0.12.2*
Verify the most recent 10,000 blocks in the most through way: Verify the most recent 400 blocks in the most through way:
{% highlight bash %} {% highlight bash %}
bitcoin-cli -testnet verifychain 4 10000 dash-cli -testnet verifychain 4 400
{% endhighlight %} {% endhighlight %}
Result (took 4 minutes and 25 seconds on a generic PC laptop; it Result (took < 1 second on a mobile workstation; it would've taken much longer on mainnet):
would've taken much longer on mainnet):
{% highlight json %} {% highlight json %}
true true

View file

@ -33,34 +33,24 @@ The `verifytxoutproof` RPC {{summary_verifyTxOutProof}}
{% enditemplate %} {% enditemplate %}
*Example from Bitcoin Core 0.11.0* *Example from Dash Core 0.12.2*
Verify a proof: Verify a proof:
{% highlight bash %} {% highlight bash %}
bitcoin-cli verifytxoutproof \ dash-cli verifytxoutproof \
03000000394ab3f08f712aa0f1d26c5daa4040b50e96d31d4e8e3c130000000000000000\ 01000020ed72cc6a7294782a7711d8fa7ef74716ef062dc50bb0820f7eec923801000000\
ca89aaa0bbbfcd5d1210c7888501431256135736817100d8c2cf7e4ab9c02b168115d455\ aa5d17c5128043803b67c7ab03e4d3ffbc9604b54f877f1c5cf9ed3adeaa19b2cd7ed659\
04dd1418836b20a6cb0800000d3a61beb3859abf1b773d54796c83b0b937968cc4ce3c0f\ f838011d10a70a480200000002033c89c2baecba9fc983c85dcf365c2d9cc93aca1dee2e\
71f981b2407a3241cb8908f2a88ac90a2844596e6019450f507e7efb8542cbe54ea55634\ 5ac18124464056542e8faab0c579e651e9438c2904df5a498bc37a37acd528a251386fde\
c87bee474ee48aced68179564290d476e16cff01b483edcd2004d555c617dfc08200c083\ f0476ba0e00105
08ba511250e459b49d6a465e1ab1d5d8005e0778359c2993236c85ec66bac4bfd974131a\
dc1ee0ad8b645f459164eb38325ac88f98c9607752bc1b637e16814f0d9d8c2775ac3f20\
f85260947929ceef16ead56fcbfd77d9dc6126cce1b5aacd9f834690f7508ee2db2ab67d\
382c5e738b1b6fe3fb079511952d33ec18c8440ef291eb8d3546a971ee4aa5e574b7be7f\
5aff0b1c989b2059ae5a611c8ce5c58e8e8476246c5e7c6b70e0065f2a6654e2e6cf4efb\
6ae19bf2548a7d9febf5b0aceaff28610922e1b9e23e52f650a4a11d2986c9c2b09bb168\
a70a7d4ac16e4d389bc2868ee91da1837d2cd79288bdc680e9c35ebb3ddfd045d69d767b\
164ec69d5db9f995c045d10af5bd90cd9d1116c3732e14796ef9d1a57fa7bb718c07989e\
d06ff359bf2009eaf1b9e000c054b87230567991b447757bc6ca8e1bb6e9816ad604dbd6\
0600
{% endhighlight %} {% endhighlight %}
Result: Result:
{% highlight json %} {% highlight json %}
[ [
"f20e44c818ec332d95119507fbe36f1b8b735e2c387db62adbe28e50f7904683" "e0a06b47f0de6f3851a228d5ac377ac38b495adf04298c43e951e679c5b0aa8f"
] ]
{% endhighlight %} {% endhighlight %}

View file

@ -21,7 +21,7 @@ serialized header format part of the consensus rules.
| Bytes | Name | Data Type | Description | Bytes | Name | Data Type | Description
|-------|---------------------|-----------|---------------- |-------|---------------------|-----------|----------------
| 4 | version | int32_t | The [block version][/en/glossary/block]{:#term-block-version}{:.term} number indicates which set of block validation rules to follow. See the list of block versions below. | 4 | version | int32_t | The [block version][/en/glossary/block]{:#term-block-version}{:.term} number indicates which set of block validation rules to follow. See the list of block versions below.
| 32 | [previous block header hash][]{:#term-previous-block-header-hash}{:.term} | char[32] | A SHA256(SHA256()) hash in internal byte order of the previous block's header. This ensures no previous block can be changed without also changing this block's header. | 32 | [previous block header hash][]{:#term-previous-block-header-hash}{:.term} | char[32] | An X11() hash in internal byte order of the previous block's header. This ensures no previous block can be changed without also changing this block's header.
| 32 | merkle root hash | char[32] | A SHA256(SHA256()) hash in internal byte order. The merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header. See the [merkle trees section][section merkle trees] below. | 32 | merkle root hash | char[32] | A SHA256(SHA256()) hash in internal byte order. The merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header. See the [merkle trees section][section merkle trees] below.
| 4 | time | uint32_t | The block time is a Unix epoch time when the miner started hashing the header (according to the miner). Must be strictly greater than the median time of the previous 11 blocks. Full nodes will not accept blocks with headers more than two hours in the future according to their clock. | 4 | time | uint32_t | The block time is a Unix epoch time when the miner started hashing the header (according to the miner). Must be strictly greater than the median time of the previous 11 blocks. Full nodes will not accept blocks with headers more than two hours in the future according to their clock.
| 4 | nBits | uint32_t | An encoded version of the target threshold this block's header hash must be less than or equal to. See the nBits format described below. | 4 | nBits | uint32_t | An encoded version of the target threshold this block's header hash must be less than or equal to. See the nBits format described below.