TeachMeBitcoin

P2TR ScriptPubKey Structure

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

P2TR ScriptPubKey Structure

The Taproot locking script is the pinnacle of minimalist design. It doesn't contain hashes or complex opcodes; it simply presents a single public key and tells the validator which version of the rules to apply.

1. The Locking Script (ScriptPubKey)

A P2TR script is exactly 34 bytes long: 51 20 [32-Byte Tweaked Public Key]

2. Why 32 bytes instead of 33?

Legacy and SegWit public keys are 33 bytes (1 byte prefix + 32 byte X-coordinate).

3. The "Tweaked" Key

The 32-byte key in the script is not just a standard public key. It is a Tweaked Key (Q). Q = P + h(P, m)G

4. No Hashing

Notice that unlike P2WPKH or P2WSH, Taproot does not store a hash of the key. It stores the Public Key itself.

Attribute P2WSH (V0) P2TR (V1)
Witness Version 0x00 0x51 (OP_1)
Data Length 32 Bytes 32 Bytes
Data Type Hash of Script The Tweaked Public Key
Key Type ECDSA (33b) Schnorr (32b)

In the next section, we will explore the Key Path vs. Script Path spending mechanisms.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!