BIP-340 tagged hash verification. Computes SHA256(SHA256(tag) || SHA256(tag) || preimage) and compares to an expected hash. The tag_hash field IS SHA256(tag) already.
Hash Invertible| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| tag_hash | HASH256 | 32 B | Conditions | SHA-256 of the tag string (pre-hashed for efficiency) |
| expected_hash | HASH256 | 32 B | Conditions | Expected tagged hash result |
| witness_tag_hash | HASH256 | 32 B | Witness | Copy of tag_hash, echoed in the witness for implicit layout matching |
| witness_expected_hash | HASH256 | 32 B | Witness | Copy of expected_hash, echoed in the witness for implicit layout matching |
| preimage | PREIMAGE | 32 B | Witness | Data to hash with the tag |
Conditions side (in scriptPubKey):
Witness side (in input witness):
Two condition HASH256 fields: one for the tag hash, one for the expected result.
| Condition | Result |
|---|---|
| Missing HASH256 fields (need 2) | ERROR |
| Missing PREIMAGE field | ERROR |
| Tagged hash does not match expected_hash | UNSATISFIED |
| Tagged hash matches expected_hash | SATISFIED |
{
"type": "TAGGED_HASH",
"inverted": false,
"fields": [
{ "type": "HASH256", "hex": "a1b2c3...32 bytes (tag_hash)" },
{ "type": "HASH256", "hex": "d4e5f6...32 bytes (expected)" }
]
}{
"type": "TAGGED_HASH",
"inverted": false,
"fields": [
{ "type": "HASH256", "hex": "a1b2c3...32 bytes (tag_hash)" },
{ "type": "HASH256", "hex": "d4e5f6...32 bytes (expected)" },
{ "type": "PREIMAGE", "hex": "deadbeef...exactly 32 bytes" }
]
}