Bits vs. Bytes vs. Words
Bits vs. Bytes vs. Words
To build a blockchain, you need more than just individual bytes. You need to combine them into larger structures called Words. Bitcoin uses specific word lengths to represent different types of data efficiently.
1. The Hierarchy of Data
| Term | Size (Bytes) | Bitcoin Usage |
|---|---|---|
| Byte | 1 | OP_Codes, Small Constants |
| Word (Short) | 2 | Port Numbers (e.g., 8333) |
| DWord (Double) | 4 | Block Height, Version, Time |
| QWord (Quad) | 8 | Transaction Amount (Sats) |
| Hash256 | 32 | TXIDs, Public Keys, Merkle Roots |
2. 32-bit Words (Uint32)
Most of the "Metadata" in Bitcoin is stored in 4-byte (32-bit) words.
-
nVersion: 4 bytes.
-
nLockTime: 4 bytes.
-
nBits (Difficulty): 4 bytes. This allows Bitcoin to represent numbers up to ~4.2 billion, which is more than enough for a timestamp that lasts for 100+ years.
3. 64-bit Words (Uint64)
Because there will eventually be 2.1 quadrillion Satoshis in existence, a 32-bit word isn't large enough to store a Bitcoin balance.
-
Bitcoin uses 8-byte (64-bit) words for transaction output amounts.
-
Max value: 18,446,744,073,709,551,615 (Plenty of room for all Satoshis).
4. The 256-bit Standard
Bitcoin is built on the 256-bit security level.
-
Almost all identifiers (TXIDs, Block Hashes) are 32 bytes (256 bits).
-
This is the "Sweet Spot" of modern cryptography—large enough to be impossible to brute-force, but small enough to be processed quickly by modern CPUs.
5. Signed vs. Unsigned Words
-
Unsigned: All bits represent a positive number. (Bitcoin mostly uses this).
-
Signed: The first bit indicates if the number is negative. (Used occasionally in Bitcoin Script math).
Understanding these units allows you to see the "Grid" that Bitcoin data fits into. If a field is supposed to be a Uint32 and you find 5 bytes, you know the data is corrupted.
In the next section, we will discuss Data Capacity & vBytes.
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: