Expand description
Taproot functions from Orange Paper Section 11.2
Structs§
- Taproot
Control Block - Parsed control block from Taproot script-path witness.
Constants§
- TAPROOT_
LEAF_ VERSION_ TAPSCRIPT - BIP 341 default tapscript leaf version.
- TAPROOT_
SCRIPT_ PREFIX - Taproot output script: OP_1 <32-byte-hash>
Functions§
- compute_
script_ merkle_ root - Compute merkle root for script path using BIP 341 TapLeaf/TapBranch tagged hashes.
- compute_
taproot_ signature_ hash - Compute Taproot signature hash following BIP 341 specification. Uses TaggedHash(“TapSighash”, 0x00 || SigMsg(…)) per BIP 341.
- compute_
taproot_ tweak - Compute Taproot tweak using proper cryptographic operations OutputKey = InternalPubKey + TaprootTweak(MerkleRoot) × G
- compute_
tapscript_ signature_ hash - Compute Tapscript signature hash per BIP 342. Same base SigMsg as key-path, with ext = codesep_pos (4) || key_version (1) || tapleaf_hash (32).
- extract_
taproot_ output_ key - Extract Taproot output key from script
- is_
taproot_ output - Check if transaction output is Taproot
- parse_
taproot_ script_ path_ witness - Parse and validate Taproot script-path witness. Returns (tapscript, stack_items) if valid, Err otherwise. Witness format: [stack_items…, script, annex?, control_block] Annex: optional, last element before control block, must start with 0x50. Control block: leaf_version (1) + internal_pubkey (32) + merkle_proof (32*n).
- validate_
taproot_ key_ aggregation - Validate Taproot key aggregation
- validate_
taproot_ script - Validate Taproot output script
- validate_
taproot_ script_ path - Validate Taproot script path spending
- validate_
taproot_ script_ path_ with_ leaf_ version - Validate Taproot script path spending with explicit leaf version.
- validate_
taproot_ transaction - Validate Taproot transaction
Type Aliases§
- Witness
- Witness Data: 𝒲 = 𝕊* (stack of witness elements)