‹ CHAPTER 8, ALL LESSONS

PATHFINDER · CHAPTER 8 · LESSON 1 OF 5

Transactions & UTXO

Hashing, the fingerprint of data

How can a few dozen characters stand for a whole block? 5 min

A hash function takes any data, a word or a whole block, and returns a short fixed size result. Bitcoin uses SHA-256, whose result is 256 bits, usually written as 64 hexadecimal characters.

Four properties that matter

  • Same input, same output: anyone can recompute it and check.
  • Change one character and the result changes completely.
  • One way: you cannot work back from the hash to the data.
  • No known way to find two different inputs with the same hash.

These properties turn a hash into a fingerprint. If a block's hash matches, the block is exactly the one expected, down to the last bit. If anything was altered, the fingerprint no longer fits.

Where Bitcoin uses it

Block hashes chain the blocks together. Transaction ids are hashes of the transactions. Addresses are built from hashes of public keys. Mining itself is a search for a block hash below a target. Bitcoin mostly hashes twice in a row, SHA-256 of SHA-256, as an extra safety margin.

▶ SEE IT IN THE MACHINE

BLOCK HASH, the press, is where the block's fingerprint is struck once the miner has found it.

What to remember

  • Bitcoin uses SHA-256, a 256 bit fingerprint of any data.
  • One changed bit gives a completely different hash.
  • Hashes chain blocks, identify transactions and drive mining.

Quick check

What happens to a SHA-256 hash if you change one letter of the input?

Can you rebuild the original data from its hash?