TeachMeBitcoin

The Witness Overview

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

The Witness (Segregated Witness)

The Witness is a separate data structure in a Bitcoin transaction introduced by the SegWit upgrade in 2017. It contains the cryptographic proofs (signatures and public keys) required to spend an input, but it is stored outside the main part of the transaction.

1. Why "Segregated"?

The word "Segregated" means "set apart." In legacy transactions, the signature is stored in the ScriptSig, which is part of the data hashed to create the TXID.

2. Segregation Benefits

By separating the witness data:

  1. Fixes Malleability: Changing the signature in the witness does not change the TXID.

  2. Increased Capacity: Witness data is "weighted" differently, effectively allowing for blocks up to 4MB in size.

  3. Future Upgrades: It is easier to introduce new signature types (like Schnorr) into the witness than into the legacy ScriptSig.

3. The Witness Stack

Unlike ScriptSig, which is a single script, the Witness is a stack of items.

4. Relationship with Inputs

Every input in a SegWit transaction has its own corresponding witness. Even if an input doesn't need a signature (like a certain smart contract), it still has a "Witness" area that can be empty.

Property Value
Role Segregated Proof of Ownership
Location End of the Transaction
Impact on TXID None
Nickname The Witness

In the next section, we will look at how the Witness is Serialized into raw bytes.

☕ 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!