TeachMeBitcoin

Hash Verification & PoW

From TeachMeBitcoin, the free encyclopedia ⏱️ 3 min read

Hash Verification: Mathematically Proving a Valid Proof of Work

When a miner successfully solves a block, they broadcast only the 80-byte block header and the transaction lists to the network. Every full node receiving this data executes a raw, mathematical Hash Verification audit. If the calculation fails even slightly, the block is instantly discarded, protecting nodes against false chain state announcements.

This guide details the fields in the 80-byte block header, the double-SHA256 execution pipeline, and the mathematical asymmetry of Proof of Work verification.


📐 1. The 80-Byte Block Header Structure

The 80-byte block header represents the metadata footprint of the block. It consists of six serialized fields:

Offset (Bytes) Field Name Data Type Endianness Size (Bytes) Description
0 - 3 Version int32_t Little Endian 4 Block version number (BIP 9 signaling details).
4 - 35 Prev Block Hash uint8_t[32] Little Endian 32 S256 hash of the immediate previous block header.
36 - 67 Merkle Root uint8_t[32] Little Endian 32 Cryptographic root binding all transactions.
68 - 71 Timestamp uint32_t Little Endian 4 Current Unix epoch system time in seconds.
72 - 75 Bits uint32_t Little Endian 4 Compact target representation (bits).
76 - 79 Nonce uint32_t Little Endian 4 Dynamic variable incremented during hashing.

Total Block Header Size = 80 Bytes.


🔒 2. The Verification Pipeline

To mathematically prove a block is valid, a verifying node executes this simple pipeline:

                          BLOCK HEADER VERIFICATION FLOW

    [ 80-Byte Raw Header Bytes ]
                 │
                 ▼  [1st SHA-256 Hash]
          [ 32-Byte Hash ]
                 │
                 ▼  [2nd SHA-256 Hash]
    [ Final 32-Byte Block Hash ]
                 │
                 ▼  [Decompress Header 'bits' field]
          [ 256-Bit Target ]
                 │
                 ▼  [Perform Inequality Check]
     Is Block Hash < Target ? ───► YES ──► Block VALID! Accept & Gossip
                             └───► NO  ──► Block INVALID! Drop Peer

The Formula:

The final validation hash $H$ is calculated by taking the double-SHA256 of the serialized 80-byte header $B$:

$$H = \text{SHA256}\Big(\text{SHA256}\big(B\big)\Big)$$

This resulting 32-byte hash is interpreted in little-endian format (which reverse-orders the bytes, showing leading zeroes at the most significant end) and checked against the decompressed target integer $T$:

$$\text{If } H < T \quad \Longrightarrow \quad \text{Block is VALID}$$


⚖️ 3. Verification Asymmetry: The PoW Cornerstone

The entire security of the Bitcoin blockchain relies on a mathematical concept called Validation Asymmetry: * Searching for the Hash (Extremely Hard): To find a valid hash, miners must run trillions of ASIC computations, expending immense electrical power. It is a brute-force search with no shortcuts. * Verifying the Hash (Extremely Easy): Once a miner finds a valid hash and broadcasts the 80-byte header, a validating node (even a low-power raspberry pi) can verify its mathematical validity with exactly two SHA256 computations.

$$\text{Verification Cost: } \mathcal{O}(1) \quad \lll \quad \text{Mining Cost: } \mathcal{O}(2^{32})$$

This asymmetry ensures that any node can validate the entire ledger history in a matter of hours, maintaining a decentralized, trustless consensus model without relying on central authorities.

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