2

I'm reading the Protocol Documentation page for the 'tx' data structure and cannot find a completely clear definition of the 'tx_witness' data structure.

After the 'tx_out' table, there is short comment stating that "The TxWitness structure consists of a var_int count of witness data components, followed by (for each witness data component) a var_int length of the component and the raw component data itself."

Could someone post a table, similar to others on the Protocol Documentation page, defining clearly how a 'tx_witness' data structure should be formed?

1 Answer 1

2

In Bitcoin Core, the scriptWitness property (for the CTxIn class) is serialized from a CTransaction as a std::vector<std::vector<unsigned char> >, so I would imagine the serialized version would look something like:

TxWitness:

+------------+-------------------------+------------------------+
| Field Size |        Description      |       Data Type        |
+------------+-------------------------+------------------------+
| 0+         | witness_component count | var_int                |
| ?          | witness_components      | witness_component[]    |
+------------+-------------------------+------------------------+

WitnessComponent:

+------------+------------------+-----------+
| Field Size |   Description    | Data Type |
+------------+------------------+-----------+
| 0+         | component length | var_int   |
| ?          | component        | uchar[]   |
+------------+------------------+-----------+

References:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.