bips/bip-0446
Gregory Sanders 2778442c21
Add BIP446: OP_TEMPLATEHASH, BIP448: Taproot-native (Re)bindable Transactions (#1974)
Co-authored-by: Antoine Poinsot <darosior@protonmail.com>
2026-03-17 13:01:23 -07:00
..
basics.json Add BIP446: OP_TEMPLATEHASH, BIP448: Taproot-native (Re)bindable Transactions (#1974) 2026-03-17 13:01:23 -07:00
README.md Add BIP446: OP_TEMPLATEHASH, BIP448: Taproot-native (Re)bindable Transactions (#1974) 2026-03-17 13:01:23 -07:00
script_assets_test.json Add BIP446: OP_TEMPLATEHASH, BIP448: Taproot-native (Re)bindable Transactions (#1974) 2026-03-17 13:01:23 -07:00

OP_TEMPLATEHASH test vectors

The test vectors are split into basic sanity checks and more extensive coverage. Both are JSON files containing a JSON array of JSON objects. Each JSON object in the array represents a Script validation test case.

For basics.json, each object contains the following fields:

  • spending_tx: a hexadecimal string representing a serialized Bitcoin transaction. This is the transaction to be validated.
  • input_index: a JSON integer representing the index of the transaction input for which to perform Script validation.
  • spent_outputs: a JSON array of hexadecimal strings representing serialized Bitcoin transaction outputs. This is the list of outputs pointed to by the inputs of the transaction to be validated.
  • valid: a JSON boolean. Whether script validation should succeed.
  • comment: a JSON string. Reason why script validation should succeed or fail.

For script_assets_test.json, each object contains the following fields:

  • tx: a hexadecimal string representing a serialized Bitcoin transaction. This is the transaction to be validated.
  • index: a JSON integer representing the index of the transaction input for which to perform Script validation.
  • prevouts: a JSON array of hexadecimal strings representing serialized Bitcoin transaction outputs. This is the list of outputs pointed to by the inputs of the transaction to be validated.
  • flags: a JSON array of strings representing the script validation flags to enable for this test case.
  • success: an optional JSON object representing the transaction input fields to set such as script validation succeeds. The subfields are the following:
    • scriptSig: a JSON hexadecimal string representing the serialized input script.
    • witness: a JSON array of hexadecimal strings representing the witness stack for this input.
  • final: an optional JSON boolean which, if true, indicates script validation should always succeed with more validation flags than specified in flags.
  • failure: an optional JSON object representing the transaction input fields to set such as script validation fails. The subfields are the following:
    • scriptSig: a JSON hexadecimal string representing the serialized input script.
    • witness: a JSON array of hexadecimal strings representing the witness stack for this input.

Location of code that generated the test basics.json here. Example usage of script_assets_test.json here.