V0.13.0 special tx update (#101)

* Content - Fix CbTx cross reference

* Content - Highlight QcTx's lack of inputs and outputs

* Content - clarify DIP2 tx format

* Content - Add table showing implemented special txs

* Content - add JSON-RPC format info and example

* RPC - Update getrawtransaction example

Add special tx example also

* RPC - Update decoderawtransaction example

Add special tx example also
This commit is contained in:
thephez 2019-01-04 12:59:39 -05:00 committed by GitHub
parent d0756f4470
commit 9f9bc89b6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 320 additions and 68 deletions

View file

@ -22,6 +22,7 @@ bitcoinj:
'`block` messages': block message '`block` messages': block message
'`blocktxn` message': blocktxn message '`blocktxn` message': blocktxn message
'`blocktxn` messages': blocktxn message '`blocktxn` messages': blocktxn message
'CbTx': coinbase special tx
certificate chain: certificate chain:
'`cmpctblock` message': cmpctblock message '`cmpctblock` message': cmpctblock message
'`cmpctblock` messages': cmpctblock message '`cmpctblock` messages': cmpctblock message

View file

@ -39,65 +39,133 @@ The `decoderawtransaction` RPC {{summary_decodeRawTransaction}}
Decode a signed one-input, two-output transaction: Decode a signed one-input, two-output transaction:
{% highlight bash %} {% highlight bash %}
dash-cli decoderawtransaction 01000000016b490886c0198b028c6c5cb145c4eb3b10\ dash-cli decoderawtransaction 02000000015d0b26079696875e9fc3cb480420aae3c8\
55a224a7a105aadeff41b69ec91e060100000069463043022033a61c56fa0867ed67b76b02\ b1da628fbb14cc718066df7fe7c5fd010000006a47304402202cfa683981898ad9adb89534\
3204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4\ 23a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee\
182a1de0b96fc22716e0845f561d542e012102eacba539d92eb88d4e73bb32749d79f53f6e\ 27f706baaed86dabb105979c3e6f6e1cb9012103d14eb001cf0908f3a2333d171f6236497a\
8d7947ac40a71bd4b26c13b6ec29ffffffff0200205fa0120000001976a914485485425fa9\ 82318a6a6f649b4d7fd8e5c8922e08feffffff021e3f4b4c000000001976a914b02ae52066\
9504ec1638ac4213f3cfc9f32ef388acc0a8f9be010000001976a914811eacc14db8ebb5b6\ 542b4aec5cf45c7cae3183d7bd322788ac00f90295000000001976a914252c9de3a0ebd5c9\
4486dc43400c0226b428a488ac00000000 5886187b24969d4ccdb5576e88ac943d0000
{% endhighlight %} {% endhighlight %}
Result: Result:
{% highlight json %} {% highlight json %}
{ {
"txid": "2f124cb550d9967b81914b544dea3783de23e85d67a9816f9bada665ecfe1cd5", "txid": "f4de3be04efa18e203c9d0b7ad11bb2517f5889338918ed300a374f5bd736ed7",
"size": 224, "size": 225,
"version": 1, "version": 2,
"type": 0, "type": 0,
"locktime": 0, "locktime": 15764,
"vin": [ "vin": [
{ {
"txid": "061ec99eb641ffdeaa05a1a724a255103bebc445b15c6c8c028b19c08608496b", "txid": "fdc5e77fdf668071cc14bb8f62dab1c8e3aa200448cbc39f5e87969607260b5d",
"vout": 1, "vout": 1,
"scriptSig": { "scriptSig": {
"asm": "3043022033a61c56fa0867ed67b76b023204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4182a1de0b96fc22716e0845f561d542e[ALL] 02eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29", "asm": "304402202cfa683981898ad9adb8953423a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee27f706baaed86dabb105979c3e6f6e1cb9[ALL] 03d14eb001cf0908f3a2333d171f6236497a82318a6a6f649b4d7fd8e5c8922e08",
"hex": "463043022033a61c56fa0867ed67b76b023204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4182a1de0b96fc22716e0845f561d542e012102eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29" "hex": "47304402202cfa683981898ad9adb8953423a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee27f706baaed86dabb105979c3e6f6e1cb9012103d14eb001cf0908f3a2333d171f6236497a82318a6a6f649b4d7fd8e5c8922e08"
}, },
"sequence": 4294967295 "sequence": 4294967294
} }
], ],
"vout": [ "vout": [
{ {
"value": 800.00000000, "value": 12.79999774,
"valueSat": 80000000000, "valueSat": 1279999774,
"n": 0, "n": 0,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 485485425fa99504ec1638ac4213f3cfc9f32ef3 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 b02ae52066542b4aec5cf45c7cae3183d7bd3227 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914485485425fa99504ec1638ac4213f3cfc9f32ef388ac", "hex": "76a914b02ae52066542b4aec5cf45c7cae3183d7bd322788ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"ySutkc49Khpz1HQN8AfWNitVBLwqtyaxvv" "ycNwAN4DQ7Xnw5XLKg84SR4U1GE22FfLNQ"
] ]
} }
}, },
{ {
"value": 74.99000000, "value": 25.00000000,
"valueSat": 7499000000, "valueSat": 2500000000,
"n": 1, "n": 1,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 811eacc14db8ebb5b64486dc43400c0226b428a4 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 252c9de3a0ebd5c95886187b24969d4ccdb5576e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914811eacc14db8ebb5b64486dc43400c0226b428a488ac", "hex": "76a914252c9de3a0ebd5c95886187b24969d4ccdb5576e88ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"yY6AmGopsZS31wy1JLHR9P6AC6owFaXwuh" "yPi1JKw5fn8bMFsCCtnkGagogW6GXwGktZ"
] ]
} }
} }
], ],
"instantlock": true
}
{% endhighlight %}
Decode a coinbase special transaction (CbTx):
{% highlight bash %}
dash-cli decoderawtransaction 03000500010000000000000000000000000000000000\
000000000000000000000000000000ffffffff4b02953d045e572a5c08fabe6d6d66663734\
36333636333230616162346432366264616530386339366263623534010000000000000010\
00000eaf0000000d2f6e6f64655374726174756d2f0000000002b4e32237010000001976a9\
14cb594917ad4e5849688ec63f29a0f7f3badb5da688acaae32237010000001976a914a3c5\
284d3cd896815ac815f2dd76a3a71cb3d8e688ac00000000260100953d00007b8577a1c051\
bcab40e08c72209f3eddc476d859c8054c57a7287700b2de2db4
{% endhighlight %}
Result:
{% highlight json %}
{
"txid": "414a3911a274053beb867c79ad9a19bf508041554f147a1a2c73f8f9bc029717",
"size": 233,
"version": 3,
"type": 5,
"locktime": 0,
"vin": [
{
"coinbase": "02953d045e572a5c08fabe6d6d666637343633363633323061616234643236626461653038633936626362353401000000000000001000000eaf0000000d2f6e6f64655374726174756d2f",
"sequence": 0
}
],
"vout": [
{
"value": 52.20000692,
"valueSat": 5220000692,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 cb594917ad4e5849688ec63f29a0f7f3badb5da6 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914cb594917ad4e5849688ec63f29a0f7f3badb5da688ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"yereyozxENB9jbhqpbg1coE5c39ExqLSaG"
]
}
},
{
"value": 52.20000682,
"valueSat": 5220000682,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 a3c5284d3cd896815ac815f2dd76a3a71cb3d8e6 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914a3c5284d3cd896815ac815f2dd76a3a71cb3d8e688ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"ybFPBD7hm9KVd2Dubj97K5mw2ymR8gWJre"
]
}
}
],
"extraPayloadSize": 38,
"extraPayload": "0100953d00007b8577a1c051bcab40e08c72209f3eddc476d859c8054c57a7287700b2de2db4",
"cbTx": {
"version": 1,
"height": 15765,
"merkleRootMNList": "b42ddeb2007728a7574c05c859d876c4dd3e9f20728ce040abbc51c0a177857b"
},
"instantlock": false "instantlock": false
} }
{% endhighlight %} {% endhighlight %}

View file

@ -104,30 +104,30 @@ deprecated.
*Examples from Dash Core 0.13.0* *Examples from Dash Core 0.13.0*
A transaction in serialized transaction format: A classical transaction in serialized transaction format:
{% highlight bash %} {% highlight bash %}
dash-cli getrawtransaction \ dash-cli getrawtransaction \
83f94090899fa63ea6ef913fe13cba851fd07c801bea7eedf73958c58936c19c f4de3be04efa18e203c9d0b7ad11bb2517f5889338918ed300a374f5bd736ed7
{% endhighlight %} {% endhighlight %}
Result (wrapped): Result (wrapped):
{% highlight text %} {% highlight text %}
01000000016b490886c0198b028c6c5cb145c4eb3b1055a224a7a105aadeff41\ 02000000015d0b26079696875e9fc3cb480420aae3c8b1da628fbb14cc718066\
b69ec91e060100000069463043022033a61c56fa0867ed67b76b023204a9dc0e\ df7fe7c5fd010000006a47304402202cfa683981898ad9adb8953423a38f7185\
e6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4\ ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee\
182a1de0b96fc22716e0845f561d542e012102eacba539d92eb88d4e73bb3274\ 27f706baaed86dabb105979c3e6f6e1cb9012103d14eb001cf0908f3a2333d17\
9d79f53f6e8d7947ac40a71bd4b26c13b6ec29ffffffff0200205fa012000000\ 1f6236497a82318a6a6f649b4d7fd8e5c8922e08feffffff021e3f4b4c000000\
1976a914485485425fa99504ec1638ac4213f3cfc9f32ef388acc0a8f9be0100\ 001976a914b02ae52066542b4aec5cf45c7cae3183d7bd322788ac00f9029500\
00001976a914811eacc14db8ebb5b64486dc43400c0226b428a488ac00000000 0000001976a914252c9de3a0ebd5c95886187b24969d4ccdb5576e88ac943d0000
{% endhighlight %} {% endhighlight %}
Get the same transaction in JSON: Get the same transaction in JSON:
{% highlight bash %} {% highlight bash %}
dash-cli getrawtransaction \ dash-cli getrawtransaction \
2f124cb550d9967b81914b544dea3783de23e85d67a9816f9bada665ecfe1cd5 \ f4de3be04efa18e203c9d0b7ad11bb2517f5889338918ed300a374f5bd736ed7 \
1 1
{% endhighlight %} {% endhighlight %}
@ -135,58 +135,149 @@ Result:
{% highlight json %} {% highlight json %}
{ {
"hex": "01000000016b490886c0198b028c6c5cb145c4eb3b1055a224a7a105aadeff41b69ec91e060100000069463043022033a61c56fa0867ed67b76b023204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4182a1de0b96fc22716e0845f561d542e012102eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29ffffffff0200205fa0120000001976a914485485425fa99504ec1638ac4213f3cfc9f32ef388acc0a8f9be010000001976a914811eacc14db8ebb5b64486dc43400c0226b428a488ac00000000", "hex": "02000000015d0b26079696875e9fc3cb480420aae3c8b1da628fbb14cc718066df7fe7c5fd010000006a47304402202cfa683981898ad9adb8953423a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee27f706baaed86dabb105979c3e6f6e1cb9012103d14eb001cf0908f3a2333d171f6236497a82318a6a6f649b4d7fd8e5c8922e08feffffff021e3f4b4c000000001976a914b02ae52066542b4aec5cf45c7cae3183d7bd322788ac00f90295000000001976a914252c9de3a0ebd5c95886187b24969d4ccdb5576e88ac943d0000",
"txid": "2f124cb550d9967b81914b544dea3783de23e85d67a9816f9bada665ecfe1cd5", "txid": "f4de3be04efa18e203c9d0b7ad11bb2517f5889338918ed300a374f5bd736ed7",
"size": 224, "size": 225,
"version": 1, "version": 2,
"type": 0, "type": 0,
"locktime": 0, "locktime": 15764,
"vin": [ "vin": [
{ {
"txid": "061ec99eb641ffdeaa05a1a724a255103bebc445b15c6c8c028b19c08608496b", "txid": "fdc5e77fdf668071cc14bb8f62dab1c8e3aa200448cbc39f5e87969607260b5d",
"vout": 1, "vout": 1,
"scriptSig": { "scriptSig": {
"asm": "3043022033a61c56fa0867ed67b76b023204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4182a1de0b96fc22716e0845f561d542e[ALL] 02eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29", "asm": "304402202cfa683981898ad9adb8953423a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee27f706baaed86dabb105979c3e6f6e1cb9[ALL] 03d14eb001cf0908f3a2333d171f6236497a82318a6a6f649b4d7fd8e5c8922e08",
"hex": "463043022033a61c56fa0867ed67b76b023204a9dc0ee6b0d63305dc5f65fe94335445ff2f021f712f55399d5238fc7146497c431fc4182a1de0b96fc22716e0845f561d542e012102eacba539d92eb88d4e73bb32749d79f53f6e8d7947ac40a71bd4b26c13b6ec29" "hex": "47304402202cfa683981898ad9adb8953423a38f7185ed41e163aa195d608fbe5bc3034910022034e2376aaed1c6576c0dad79d626ee27f706baaed86dabb105979c3e6f6e1cb9012103d14eb001cf0908f3a2333d171f6236497a82318a6a6f649b4d7fd8e5c8922e08"
}, },
"sequence": 4294967295 "sequence": 4294967294
} }
], ],
"vout": [ "vout": [
{ {
"value": 800.00000000, "value": 12.79999774,
"valueSat": 80000000000, "valueSat": 1279999774,
"n": 0, "n": 0,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 485485425fa99504ec1638ac4213f3cfc9f32ef3 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 b02ae52066542b4aec5cf45c7cae3183d7bd3227 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914485485425fa99504ec1638ac4213f3cfc9f32ef388ac", "hex": "76a914b02ae52066542b4aec5cf45c7cae3183d7bd322788ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"ySutkc49Khpz1HQN8AfWNitVBLwqtyaxvv" "ycNwAN4DQ7Xnw5XLKg84SR4U1GE22FfLNQ"
] ]
} }
}, },
{ {
"value": 74.99000000, "value": 25.00000000,
"valueSat": 7499000000, "valueSat": 2500000000,
"n": 1, "n": 1,
"scriptPubKey": { "scriptPubKey": {
"asm": "OP_DUP OP_HASH160 811eacc14db8ebb5b64486dc43400c0226b428a4 OP_EQUALVERIFY OP_CHECKSIG", "asm": "OP_DUP OP_HASH160 252c9de3a0ebd5c95886187b24969d4ccdb5576e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914811eacc14db8ebb5b64486dc43400c0226b428a488ac", "hex": "76a914252c9de3a0ebd5c95886187b24969d4ccdb5576e88ac",
"reqSigs": 1, "reqSigs": 1,
"type": "pubkeyhash", "type": "pubkeyhash",
"addresses": [ "addresses": [
"yY6AmGopsZS31wy1JLHR9P6AC6owFaXwuh" "yPi1JKw5fn8bMFsCCtnkGagogW6GXwGktZ"
] ]
} }
} }
], ],
"blockhash": "00000000e679e76eabc913b15c7f202e7ea831b8fb07beb28ca2a047b03ff3cc", "blockhash": "0000000005f395d62a40ef9f2a13000bd4076e2131c8671db8333a5b31e4403f",
"height": 19560, "height": 15765,
"confirmations": 230837, "confirmations": 1,
"time": 1509568811, "time": 1546278750,
"blocktime": 1509568811, "blocktime": 1546278750,
"instantlock": true
}
{% endhighlight %}
A special transaction (CbTx) in serialized transaction format:
{% highlight bash %}
dash-cli getrawtransaction \
414a3911a274053beb867c79ad9a19bf508041554f147a1a2c73f8f9bc029717
{% endhighlight %}
Result (wrapped):
{% highlight text %}
0300050001000000000000000000000000000000000000000000000000000000\
0000000000ffffffff4b02953d045e572a5c08fabe6d6d666637343633363633\
3230616162346432366264616530386339366263623534010000000000000010\
00000eaf0000000d2f6e6f64655374726174756d2f0000000002b4e322370100\
00001976a914cb594917ad4e5849688ec63f29a0f7f3badb5da688acaae32237\
010000001976a914a3c5284d3cd896815ac815f2dd76a3a71cb3d8e688ac0000\
0000260100953d00007b8577a1c051bcab40e08c72209f3eddc476d859c8054c\
57a7287700b2de2db4
{% endhighlight %}
Get the same transaction in JSON:
{% highlight bash %}
dash-cli getrawtransaction \
414a3911a274053beb867c79ad9a19bf508041554f147a1a2c73f8f9bc029717 \
1
{% endhighlight %}
Result:
{% highlight json %}
{
"hex": "03000500010000000000000000000000000000000000000000000000000000000000000000ffffffff4b02953d045e572a5c08fabe6d6d666637343633363633323061616234643236626461653038633936626362353401000000000000001000000eaf0000000d2f6e6f64655374726174756d2f0000000002b4e32237010000001976a914cb594917ad4e5849688ec63f29a0f7f3badb5da688acaae32237010000001976a914a3c5284d3cd896815ac815f2dd76a3a71cb3d8e688ac00000000260100953d00007b8577a1c051bcab40e08c72209f3eddc476d859c8054c57a7287700b2de2db4",
"txid": "414a3911a274053beb867c79ad9a19bf508041554f147a1a2c73f8f9bc029717",
"size": 233,
"version": 3,
"type": 5,
"locktime": 0,
"vin": [
{
"coinbase": "02953d045e572a5c08fabe6d6d666637343633363633323061616234643236626461653038633936626362353401000000000000001000000eaf0000000d2f6e6f64655374726174756d2f",
"sequence": 0
}
],
"vout": [
{
"value": 52.20000692,
"valueSat": 5220000692,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 cb594917ad4e5849688ec63f29a0f7f3badb5da6 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914cb594917ad4e5849688ec63f29a0f7f3badb5da688ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"yereyozxENB9jbhqpbg1coE5c39ExqLSaG"
]
}
},
{
"value": 52.20000682,
"valueSat": 5220000682,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 a3c5284d3cd896815ac815f2dd76a3a71cb3d8e6 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914a3c5284d3cd896815ac815f2dd76a3a71cb3d8e688ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"ybFPBD7hm9KVd2Dubj97K5mw2ymR8gWJre"
]
}
}
],
"extraPayloadSize": 38,
"extraPayload": "0100953d00007b8577a1c051bcab40e08c72209f3eddc476d859c8054c57a7287700b2de2db4",
"cbTx": {
"version": 1,
"height": 15765,
"merkleRootMNList": "b42ddeb2007728a7574c05c859d876c4dd3e9f20728ce040abbc51c0a177857b"
},
"blockhash": "0000000005f395d62a40ef9f2a13000bd4076e2131c8671db8333a5b31e4403f",
"height": 15765,
"confirmations": 5,
"time": 1546278750,
"blocktime": 1546278750,
"instantlock": false "instantlock": false
} }
{% endhighlight %} {% endhighlight %}

View file

@ -213,32 +213,108 @@ Dash Core and many other tools print and accept raw transactions
encoded as hex. encoded as hex.
Transactions prior to protocol version 70209 defaulted to version 1. Transaction Transactions prior to protocol version 70209 defaulted to version 1. Transaction
version 2 became the default in protocol version 70209. Version 2 transactions version 2 was the default in protocol versions => 70209 and < 70213. Version 2
have the same format, but the `lock_time` parameter was redefined by BIP68 transactions have the same format, but the `lock_time` parameter was redefined
to enable relative lock-times. by BIP68 to enable relative lock-times.
(Note: transactions in the block chain are allowed to list a higher version (Note: transactions in the block chain are allowed to list a higher version
number to permit soft forks, but they are treated as version 2 transactions number to permit soft forks, but they are treated as version 2 transactions
by current software.) by current software.)
Dash Core 0.13.0 (protocol version 70213) introduced transaction version 3 as
part of the [DIP2 - Special Transactions](https://github.com/dashpay/dips/blob/master/dip-0002.md)
implementation. Details of the changes introduced by
this feature and currently implemented special transactions can be found in the
[Special Transactions section](#special-transactions) below as well as in the
[DIP](https://github.com/dashpay/dips/blob/master/dip-0002.md).
A raw transaction has the following top-level format: A raw transaction has the following top-level format:
| Bytes | Name | Data Type | Description | Bytes | Name | Data Type | Description
|----------|--------------|---------------------|------------- |----------|--------------|---------------------|-------------
| 2 | version | uint16_t | Transaction version number; currently version 3. Programs creating transactions using newer consensus rules may use higher version numbers. | 2 | version | uint16_t | *Converted from 4 bytes to 2 bytes by DIP2 in v0.13.0*<br><br>Transaction version number; currently version 3. Programs creating transactions using newer consensus rules may use higher version numbers.
| 2 | type | uint16_t | Transaction type number; 0 for classical transactions; Non-zero for DIP2 special transactions. | 2 | type | uint16_t | *Added by DIP2 in v0.13.0. Uses 2 bytes that were previously part of `version`*<br><br>Transaction type number; 0 for classical transactions; Non-zero for DIP2 special transactions.
| *Varies* | tx_in count | compactSize uint | Number of inputs in this transaction. | *Varies* | tx_in count | compactSize uint | Number of inputs in this transaction.
| *Varies* | tx_in | txIn | Transaction inputs. See description of txIn below. | *Varies* | tx_in | txIn | Transaction inputs. See description of txIn below.
| *Varies* | tx_out count | compactSize uint | Number of outputs in this transaction. | *Varies* | tx_out count | compactSize uint | Number of outputs in this transaction.
| *Varies* | tx_out | txOut | Transaction outputs. See description of txOut below. | *Varies* | tx_out | txOut | Transaction outputs. See description of txOut below.
| 4 | lock_time | uint32_t | A time (Unix epoch time) or block number. See the [locktime parsing rules][]. | 4 | lock_time | uint32_t | A time (Unix epoch time) or block number. See the [locktime parsing rules][].
| *Varies* | extra_payload size | compactSize uint | *Added by DIP2*<br><br>Variable number of bytes of extra payload for DIP2-based special transactions | *Varies* | extra_payload size | compactSize uint | *Added by DIP2 in v0.13.0*<br><br>Variable number of bytes of extra payload for DIP2-based special transactions
| *Varies* | extra_payload | blob | *Added by DIP2*<br><br>Special transaction payload. | *Varies* | extra_payload | blob | *Added by DIP2 in v0.13.0*<br><br>Special transaction payload.
A transaction may have multiple inputs and outputs, so the txIn and A transaction may have multiple inputs and outputs, so the txIn and
txOut structures may recur within a transaction. CompactSize unsigned txOut structures may recur within a transaction. CompactSize unsigned
integers are a form of variable-length integers; they are described in integers are a form of variable-length integers; they are described in
the [CompactSize section][section CompactSize unsigned integer]. the [CompactSize section][section CompactSize unsigned integer].
##### JSON-RPC<!--noref--> Responses
{% include helpers/subhead-links.md %}
When retrieving transaction data via Dash Core RPCs (e.g. the `getrawtransaction` RPC),
the transaction data is returned in the following format.
Version 1 and 2 Transaction Structure (prior to DIP2 activation in Dash Core v0.13.0):
{% highlight json %}
{
"txid": <string>,
"size": <int>,
"version": 2,
"locktime": 0,
"vin": [ ],
"vout": [ ]
}
{% endhighlight %}
Version 3 Transaction Structure (Dash Core v0.13.0+ and activated DIP2):
{% highlight json %}
{
"txid": <string>,
"size": <int>,
"version": 3,
"type": <int>,
"locktime": 0,
"vin": [ ],
"vout": [ ],
"extraPayloadSize": <variable int>,
"extraPayload": …
}
{% endhighlight %}
For special transactions (those using the extraPayload fields), JSON-RPC
responses contain a parsed JSON representation of the Transaction Payload.
The sample transaction below shows the response for a quorum commitment special
transaction:
{% highlight json %}
{
"txid": "592a09d08348d970b4d9ba216246a23dac866717b460d3f369a86293b9839eea",
"size": 342,
"version": 3,
"type": 6,
"locktime": 0,
"vin": [
],
"vout": [
],
"extraPayloadSize": 329,
"extraPayload": "0100841b0000010001211cd3e4230b2bc47530e200447e998a38e960d4ed5f5251e26892130c000000320000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"qcTx": {
"version": 1,
"height": 7044,
"commitment": {
"version": 1,
"llmqType": 1,
"quorumHash": "0000000c139268e251525fedd460e9388a997e4400e23075c42b0b23e4d31c21",
"signersCount": 0,
"validMembersCount": 0,
"quorumPublicKey": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"instantlock": false
}
{% endhighlight %}
{% endautocrossref %} {% endautocrossref %}
##### TxIn: A Transaction Input (Non-Coinbase) {#txin} ##### TxIn: A Transaction Input (Non-Coinbase) {#txin}
@ -422,6 +498,19 @@ Classical (financial) transactions have a `type` of 0 while special transactions
have a `type` defined in the DIP describing them. A list of current special have a `type` defined in the DIP describing them. A list of current special
transaction types is maintained in the [DIP repository](https://github.com/dashpay/dips/blob/master/dip-0002-special-transactions.md). transaction types is maintained in the [DIP repository](https://github.com/dashpay/dips/blob/master/dip-0002-special-transactions.md).
**Implemented Special Transactions**
| Release | Tx Version | Tx Type | Payload Size | Payload | Payload JSON | Tx Purpose
| - | - | - | - | - | - |
| v0.12.3 | 2 | - | n/a | n/a | n/a |
| v0.13.0 | 3 | 0 | n/a | n/a | n/a | Standard (Classical) Transaction
| v0.13.0 | 3 | 1 | compactSize uint | hex | ProRegTx | Masternode Registration
| v0.13.0 | 3 | 2 | compactSize uint | hex | ProUpServTx | Update Masternode Service
| v0.13.0 | 3 | 3 | compactSize uint | hex | ProUpRegTx| Update Masternode Operator
| v0.13.0 | 3 | 4 | compactSize uint | hex | ProUpRevTx| Masternode Operator Revocation
| v0.13.0 | 3 | 5 | compactSize uint | hex | CbTx| Masternode List Merkle Proof
| v0.13.0 | 3 | 6 | compactSize uint | hex | QcTx| Long-Living Masternode Quorum Commitment
{% endautocrossref %} {% endautocrossref %}
#### ProRegTx #### ProRegTx
@ -876,10 +965,12 @@ Coinbase Transaction Payload
*Added in protocol version 70213 of Dash Core as described by DIP6* *Added in protocol version 70213 of Dash Core as described by DIP6*
**NOTE: This special transaction has no inputs and no outputs and thus also
pays no fee.**
The Quorum Commitment (QcTx) special transaction adds the best final commitment from a The Quorum Commitment (QcTx) special transaction adds the best final commitment from a
Long-Living Masternode Quorum (LLMQ) Distributed Key Generation (DKG) session to Long-Living Masternode Quorum (LLMQ) Distributed Key Generation (DKG) session to
the chain. This special transaction has no inputs and no outputs and thus also the chain.
pays no fee.
Since this special transaction pays no fees, it is mandatory by consensus rules Since this special transaction pays no fees, it is mandatory by consensus rules
to ensure that miners include it. Exactly one quorum commitment transaction MUST to ensure that miners include it. Exactly one quorum commitment transaction MUST

View file

@ -397,6 +397,7 @@ http://opensource.org/licenses/MIT.
[bitcoinj micropayment tutorial]: https://bitcoinj.github.io/working-with-micropayments [bitcoinj micropayment tutorial]: https://bitcoinj.github.io/working-with-micropayments
[block170]: https://www.biteasy.com/block/00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee [block170]: https://www.biteasy.com/block/00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee
[casascius address utility]: https://github.com/casascius/Bitcoin-Address-Utility [casascius address utility]: https://github.com/casascius/Bitcoin-Address-Utility
[coinbase special tx]: /en/developer-reference#cbtx
[core alert.cpp]: https://github.com/dashpay/dash/blob/master/src/alert.cpp [core alert.cpp]: https://github.com/dashpay/dash/blob/master/src/alert.cpp
[core base58.h]: https://github.com/dashpay/dash/blob/master/src/base58.h [core base58.h]: https://github.com/dashpay/dash/blob/master/src/base58.h
[core chainparams.cpp]: https://github.com/dashpay/dash/blob/master/src/chainparams.cpp [core chainparams.cpp]: https://github.com/dashpay/dash/blob/master/src/chainparams.cpp