THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

How Does SegWit Store Witness Data and Calculate Block Weight?

permalink THAMER
#block-weight#segwit#virtual-bytes#witness-data

Short answer

SegWit introduced an extended transaction serialization format that places witness information, such as signatures and certain scripts, in a separate witness section. Upgraded nodes receive and validate that data. Older nodes can still interpret the compatible base transaction structure, which helped SegWit activate as a soft fork.

Explanation

Instead of measuring block capacity solely in raw bytes, Bitcoin uses block weight. Stripped transaction data counts four weight units per byte, while witness data counts one weight unit per byte. A block may contain at most 4,000,000 weight units. Transaction virtual size (vsize) is weight divided by four, rounded up to a whole virtual byte.

For example, an illustrative transaction with 200 bytes of stripped data and 100 bytes of witness data has weight 200 × 4 + 100 = 900 weight units, or 225 vbytes. Its serialized byte count is 300, but its fee-relevant virtual size is 225 vbytes.

Witness data is not discarded or stored off-chain. Full validating nodes still need it to validate relevant signatures. The discount changes capacity and fee accounting, not the need to verify authorization.

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects