Skip to content

Commit 4f2eb73

Browse files
committed
Mention every byte sequence only once in disection
1 parent b9d4493 commit 4f2eb73

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

bip-tx-terminology.mediawiki

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -200,57 +200,56 @@ Likewise, the _input script_ is a transaction field, but the length indicator of
200200

201201
In this section we dissect a serialized transaction. Each sub-level in the list repeats a subset of the transaction's serialization to label the included parts. The goal is to provide a map from a serialized transaction back to our definitions above. We use the first ever P2TR transaction with a keypath and a scriptpath input <code>37777defed8717c581b4c0509329550e344bdc14ac38f71fc050096887e535c8</code>.
202202

203-
TODO: Only present every byte sequence once instead of at every level?
204203
* Raw '''Transaction''' <code>020000000001027bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e70000000000feffffff7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e70100000000feffffff01b4ba0e0000000000160014173fd310e9db2c7e9550ce0f03f1e6c01d833aa90140134896c42cd95680b048845847c8054756861ffab7d4abab72f6508d67d1ec0c590287ec2161dd7884983286e1cd56ce65c08a24ee0476ede92678a93b1b180c03407b5d614a4610bf9196775791fcc589597ca066dcd10048e004cd4c7341bb4bb90cee4705192f3f7db524e8067a5222c7f09baf29ef6b805b8327ecd1e5ab83ca2220f5b059b9a72298ccbefff59d9b943f7e0fc91d8a3b944a95e7b6390cc99eb5f4ac41c0d9dfdf0fe3c83e9870095d67fff59a8056dad28c6dfb944bb71cf64b90ace9a7776b22a1185fb2dc9524f6b178e2693189bf01655d7f38f043923668dc5af45bffd30a00</code>
205-
** First part of '''Transaction Header''' <code>020000000001[…02…01…ffd30a00]</code>: (remainder is split across Transaction)
204+
** First part of '''Transaction Header'''
206205
*** '''Transaction Version''' <code>02000000</code>: integer field, here indicating version 2
207206
*** '''Marker''' <code>00</code>: serialization artifact indicating extended serialization
208207
*** '''Flag''' <code>01</code>: serialization artifact indicating presence of a Witness Structure
209-
** '''Transaction Input List''' <code>027bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e70000000000feffffff7bc0bba407bc67178f100e352bf6e047 fae4cbf960d783586cb5e430b3b700e70100000000feffffff</code>
208+
** '''Transaction Input List'''
210209
*** Length of '''Transaction Input List''' <code>02</code>: serialization artifact, varInt here indicating 2 inputs, considered part of the Transaction Header
211-
*** First '''Input''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e70000000000feffffff</code>
212-
**** '''Outpoint''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e700000000</code>
210+
*** First '''Input'''
211+
**** '''Outpoint'''
213212
***** '''txid''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e7</code>: little endian txhash indicating that the spent UTXO was created by the transaction e700b7b330e4b56c5883d760f9cbe4fa47e0f62b350e108f1767bc07a4bbc07b.
214213
***** '''Output Index''' <code>00000000</code>: position of the UTXO on transaction output list of e700b7b33…a4bbc07b
215-
**** '''Input Script''' <code>00</code>
214+
**** '''Input Script'''
216215
***** Length of '''Input Script''' <code>00</code>: serialization artifact indicating the length of the input script. Since this input spends a native segwit output, the input script is empty (length 0).
217216
**** '''Sequence''' <code>feffffff</code>: transaction field encoding MAX-1, which indicates that the transaction uses locktime but is not replaceable
218-
*** Second '''Input''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e70100000000feffffff</code>
219-
**** '''Outpoint''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e701000000</code>
217+
*** Second '''Input'''
218+
**** '''Outpoint'''
220219
***** '''txid''' <code>7bc0bba407bc67178f100e352bf6e047fae4cbf960d783586cb5e430b3b700e7</code>: indicating the spent transaction output was created by the transaction e700b7b33…a4bbc07b
221220
***** '''Output Index''' <code>01000000</code>: the output position, the UTXO was the second position on the transaction output list of e700…c07b
222-
**** '''Input Script''' <code>00</code>
221+
**** '''Input Script'''
223222
***** Length of '''Input Script''' <code>00</code>: serialization artifact indicating the length of the input script. Since this input spends a native segwit output, the input script is empty (length 0).
224223
**** '''Sequence''' <code>feffffff</code>: transaction field encoding MAX-1, which indicates that the transaction uses locktime but is not replaceable
225-
** '''Transaction Output List''' <code>01b4ba0e0000000000160014173fd310e9db2c7e9550ce0f03f1e6c01d833aa9</code>
224+
** '''Transaction Output List'''
226225
*** Length of '''Transaction Output List''' <code>01</code>: serialization artifact, varInt here indicating 1 output, considered part of the Transaction Header
227-
*** First '''Output''' <code>b4ba0e0000000000160014173fd310e9db2c7e9550ce0f03f1e6c01d833aa9</code>
228-
**** '''Value''' <code>b4ba0e0000000000</code>: field defining that 965300 satoshi are assigned to this output
229-
**** '''Output Script (scriptPubKey)''' <code>160014173fd310e9db2c7e9550ce0f03f1e6c01d833aa9</code>
226+
*** First '''Output'''
227+
**** '''Amount''' <code>b4ba0e0000000000</code>: field defining that 965300 satoshi are assigned to this output
228+
**** '''Output Script (scriptPubKey)'''
230229
***** Length of the '''scriptPubKey''' <code>16</code>: serialization artifact, here instructing the interpreter to read 22 bytes
231230
***** '''Witness Version''' <code>00</code>: indicates a native segwit v0 output
232231
***** Length of the '''Witness Program''' <code>14</code>: serialization artifact indicating a 20-byte Witness Program
233232
***** '''Witness Program''' <code>173fd310e9db2c7e9550ce0f03f1e6c01d833aa9</code>: a public key hash since a 20-byte v0 Witness Program indicates a P2WPKH output)
234-
** '''Witness Structure''' <code>0140134896c42cd95680b048845847c8054756861ffab7d4abab72f6508d67d1ec0c590287ec2161dd7884983286e1cd56ce65c08a24ee0476ede92678a93b1b180c03407b5d614a4610bf9196775791fcc589597ca066dcd10048e004cd4c7341bb4bb90cee4705192f3f7db524e8067a5222c7f09baf29ef6b805b8327ecd1e5ab83ca2220f5b059b9a72298ccbefff59d9b943f7e0fc91d8a3b944a95e7b6390cc99eb5f4ac41c0d9dfdf0fe3c83e9870095d67fff59a8056dad28c6dfb944bb71cf64b90ace9a7776b22a1185fb2dc9524f6b178e2693189bf01655d7f38f043923668dc5af45b</code>
235-
*** First '''Witness Stack''' <code>0140134896c42cd95680b048845847c8054756861ffab7d4abab72f6508d67d1ec0c590287ec2161dd7884983286e1cd56ce65c08a24ee0476ede92678a93b1b180c</code>: The Witness data corresponding to the first input. (Note that the count of witness stacks is implicitly provided by the input counter, since each input must have a Witness Stack.)
233+
** '''Witness Structure'''
234+
*** First '''Witness Stack''': The Witness data corresponding to the first input. (Note that the count of witness stacks is implicitly provided by the input counter, since each input must have a Witness Stack.)
236235
**** Item count for the first '''Witness Stack''' <code>01</code>: serialization artifact. A single Witness Item indicates a keypath spend.
237-
**** First '''Witness Item''' <code>40134896c42cd95680b048845847c8054756861ffab7d4abab72f6508d67d1ec0c590287ec2161dd7884983286e1cd56ce65c08a24ee0476ede92678a93b1180c</code>
236+
**** First '''Witness Item'''
238237
***** Length of the first '''Witness Item''' <code>40</code>: serialization artifact, 64 bytes indicate a signature
239238
***** '''Signature''' <code>134896c42cd95680b048845847c8054756861ffab7d4abab72f6508d67d1ec0c590287ec2161dd7884983286e1cd56ce65c08a24ee0476ede92678a93b1180c</code>: The first Witness Item here is a Script Argument for the corresponding Condition Script. In this case, we see the signature corresponding to the P2TR keypath spend.
240-
*** Second '''Witness Stack''' <code>03407b5d614a4610bf9196775791fcc589597ca066dcd10048e004cd4c7341bb4bb90cee4705192f3f7db524e8067a5222c7f09baf29ef6b805b8327ecd1e5ab83ca2220f5b059b9a72298ccbefff59d9b943f7e0fc91d8a3b944a95e7b6390cc99eb5f4ac41c0d9dfdf0fe3c83e9870095d67fff59a8056dad28c6dfb944bb71cf64b90ace9a7776b22a1185fb2dc9524f6b178e2693189bf01655d7f38f043923668dc5af45b</code>: The Witness data corresponding to the second input.
239+
*** Second '''Witness Stack''': The Witness data corresponding to the second input.
241240
**** Item count for the second '''Witness Stack''' <code>03</code>: serialization artifact, two or more Witness Items indicate a scriptpath spend.
242-
**** First '''Witness Item''' <code>407b5d614a4610bf9196775791fcc589597ca066dcd10048e004cd4c7341bb4bb90cee4705192f3f7db524e8067a5222c7f09baf29ef6b805b8327ecd1e5ab83ca</code>
241+
**** First '''Witness Item'''
243242
***** '''Length of the first Witness Item''' <code>40</code>: 64 bytes indicate a signature
244243
***** '''Signature''' <code>7b5d614a4610bf9196775791fcc589597ca066dcd10048e004cd4c7341bb4bb90cee4705192f3f7db524e8067a5222c7f09baf29ef6b805b8327ecd1e5ab83ca</code>: script argument used as an input to the condition script
245-
**** '''Second Witness Item''' <code>2220f5b059b9a72298ccbefff59d9b943f7e0fc91d8a3b944a95e7b6390cc99eb5f4ac</code>
244+
**** '''Second Witness Item'''
246245
***** Length of the second '''Witness Item''' <code>22</code>: serialization artifact instructing to read 34 bytes
247246
***** '''Leaf Script''' <code>20f5b059b9a72298ccbefff59d9b943f7e0fc91d8a3b944a95e7b6390cc99eb5f4ac</code>: the condition scripts for the P2TR scriptpath spend
248-
**** Third '''Witness Item''' <code>41c0d9dfdf0fe3c83e9870095d67fff59a8056dad28c6dfb944bb71cf64b90ace9a7776b22a1185fb2dc9524f6b178e2693189bf01655d7f38f043923668dc5af45b</code>
247+
**** Third '''Witness Item'''
249248
***** Length of the third '''Witness Item''' <code>41</code>: serialization artifact, the length indicates the depth of the Control Block and how many hashing partners are necessary to prove the membership of the Leaf Script
250249
***** '''Leaf Version''' <code>c0</code>: indicates the version of Tapscript used in the Leaf Script
251250
***** '''Inner key''' <code>d9dfdf0fe3c83e9870095d67fff59a8056dad28c6dfb944bb71cf64b90ace9a7</code>: The Taproot Internal Key which was tweaked with the Merkle root of the Script Tree to result in the Public Key committed to in the UTXO's Witness Program being spent
252251
***** '''Tap Branch''' <code>776b22a1185fb2dc9524f6b178e2693189bf01655d7f38f043923668dc5af45b</code>: The hashing partners necessary to connect the Leaf Script to the Merkle root of the Script Tree.
253-
** '''Transaction Header (cont)''' <code>[020000000001…02…01…]ffd30a00</code>: A collective term to refer to the meta information of a transaction, split across the transaction.
252+
** '''Transaction Header (cont)''': A collective term to refer to the meta information of a transaction, split across the transaction.
254253
*** '''Locktime''' <code>ffd30a00</code>: the 4-byte locktime field, little endian for 709631
255254
256255
==Rationale==

0 commit comments

Comments
 (0)