BitcoinMachine
TECHNICAL_DOC // GENERAL / BYTES
BYTES
A byte is 8 bits — the fundamental unit of Bitcoin's data structures. Every field in a transaction, block-header/">block header, script, or key is measured and specified in bytes. Understanding byte sizes is essential for parsing raw Bitcoin data, calculating transaction weight, and verifying protocol compliance.
COMMON BITCOIN DATA SIZES
1 byte = 8 bits = 2 hex characters = values 0x00–0xFF Block header fields: version: 4 bytes (uint32) prev_blockhash: 32 bytes (SHA256d hash) merkle_root: 32 bytes (SHA256d hash) time: 4 bytes (uint32 unix timestamp) bits: 4 bytes (compact difficulty target) nonce: 4 bytes (uint32) Total header: 80 bytes Transaction fields: version: 4 bytes input count: 1–9 bytes (compact size) txid ref: 32 bytes (per input) vout index: 4 bytes (per input) sequence: 4 bytes (per input) value: 8 bytes (per output, satoshis) locktime: 4 bytes Keys and hashes: private key: 32 bytes public key: 33 bytes (compressed) SHA256 hash: 32 bytes RIPEMD160 hash: 20 bytes Schnorr sig: 64 bytes ECDSA sig: 71–72 bytes (DER encoded)
SegWit introduced weight units (WU) to discount witness-data/">witness data. Fee calculations use virtual bytes (vbytes) rather than raw bytes.
Weight unit rules (BIP 141): Non-witness bytes: weight = bytes × 4 Witness bytes: weight = bytes × 1 Virtual bytes: vbytes = ceil(weight / 4) Example — P2WPKH input: 41 non-witness bytes × 4 = 164 WU 107 witness bytes × 1 = 107 WU Total input: 271 WU = ~68 vbytes Max block: 4,000,000 WU = 1,000,000 vbytes (1 MB vbyte limit) Typical block: ~1.5–2 MB actual bytes, ~1 MB vbytes
TERMINOLOGY_INDEX
Byte
8 bits. Represented as 2 hex digits (00–FF). The base unit of all Bitcoin data structures.
Weight Unit (WU)
SegWit's measurement: non-witness bytes count 4×, witness bytes count 1×. Block limit: 4,000,000 WU.
Virtual Byte (vbyte)
weight / 4. The unit used for fee rate calculation (sat/vbyte). 1 vbyte = 4 WU.
Octet
Formal synonym for byte (8 bits). Used in RFCs and protocol specifications.