BeginnerBlockchain · Lesson 6 of 13

Blocks and Hashing, Explained Simply

The short codes that hold the chain together, what a block really contains, and why mining is a giant guessing game

7 min read6 quiz questionsProgress
In one sentence

A hash is a short code calculated from any piece of data. Change the data even slightly and the code changes completely. Each block stores the hash of the block before it, so editing old history breaks every link that follows.

Watch the video

A short visual tour of this lesson.

A short code that stands for any data

In Lesson 3 we said that each record in a chain carries a digital fingerprint of the one before it. That fingerprint has a proper name: a hash.

A hash function is a calculation that takes any data, a word, a contract or an entire block of transactions, and turns it into a short code of fixed length. Bitcoin's hash function is called SHA-256. Its result is always 64 characters made of the digits 0 to 9 and the letters a to f. It does not matter whether the input is one word or a whole library. The result is always 64 characters.

Any computer can calculate a hash in a fraction of a second, and everyone who hashes the same data gets exactly the same result. That makes a hash a quick way to check whether two copies of something are identical without comparing them line by line.

Four things a good hash function guarantees

  • Same input, same output. The same data always produces the same hash, on any computer, anywhere in the world.
  • Tiny change, totally different output. Changing a single character scrambles the whole result, as the example above shows. This is called the avalanche effect.
  • One-way only. Going from data to hash is easy. Going from a hash back to the original data is practically impossible. The only way to find an input that matches a hash is to guess again and again.
  • No two alike in practice. In theory two different inputs could share a hash, but with SHA-256 nobody has ever found such a pair. The number of possible results has 78 digits, roughly as many as the estimated number of atoms in the observable universe.

Together, these four rules mean a hash can act as a seal on data. If the hash still matches, the data has not changed. If it does not match, something was altered, even if it was a single comma.

What a block holds

A Bitcoin block has two parts. The larger part is the body: a list of transactions, usually a few thousand of them. The smaller part is the header, a short summary that includes:

  • The previous block's hash. This is the link that makes it a chain.
  • A summary of all its transactions. The transactions are hashed together into a single code, so changing any one of them changes the summary. The Intermediate level shows exactly how this summary is built.
  • A timestamp showing roughly when the block was created.
  • The difficulty target, which sets how hard the mining puzzle is at the time.
  • A nonce, a number miners change again and again while they search for a valid block. More on this below.

The block's own hash is calculated from its header. Because the header contains both the summary of transactions and the previous block's hash, that one code depends on everything in the block and everything before it.

How hashes lock the chain

Now the pieces fit together. Block 102 stores the hash of block 101. Block 103 stores the hash of block 102. And so on, all the way back to the genesis block.

Suppose someone edits a single transaction in block 101. Its transaction summary changes, so its hash changes. But block 102 still stores the old hash, so the link between them no longer matches, and every node can see it immediately.

To hide the edit, the attacker would have to recalculate block 101, then block 102, then every block after it. And as the next section shows, producing each of those blocks requires an enormous amount of guessing. Meanwhile, the honest network keeps adding new blocks on top. This is why a payment becomes safer with every block added after it.

The original chainBlock 101Previous hash0000b7e4…TransactionsThis block's hash0000c81e…Block 102Previous hash0000c81e…TransactionsThis block's hash00009d5a…Block 103Previous hash00009d5a…TransactionsThis block's hash0000e3a7…After someone edits block 101Block 101Previous hash0000b7e4…Transactions (edited)This block's hash7b2e91d4…Block 102Previous hash0000c81e…TransactionsThis block's hash00009d5a…Block 103Previous hash00009d5a…TransactionsThis block's hash0000e3a7…
The original chainBlock 101Previous hash0000b7e4…TransactionsThis block's hash0000c81e…Block 102Previous hash0000c81e…TransactionsThis block's hash00009d5a…After someone edits block 101Block 101Previous hash0000b7e4…Transactions (edited)This block's hash7b2e91d4…Block 102Previous hash0000c81e…TransactionsThis block's hash00009d5a…
Figure 1. Each block stores the hash of the block before it. Editing block 101 changes its hash, so the link to block 102 no longer matches, and everyone can see the chain was tampered with.

Mining: a giant guessing game

Lesson 4 said miners race to solve a puzzle. Here is what that puzzle actually is. For a block to be valid, its hash must be below a target number set by the network, which in simple terms means the hash must start with a certain number of zeros.

Because hashes are one-way, there is no clever way to produce a hash with many zeros. Miners change the nonce, hash the header, check the result, and try again, billions of times per second. Each extra zero required makes the search about 16 times harder.

We ran this experiment ourselves, hashing Market Talks followed by a counting number until the result started with enough zeros:

Zeros requiredGuesses it took usAverage guesses expected
11516
2262256
35,9314,096
4120,53965,536
5129,9961,048,576
613,591,13016,777,216

Notice the five-zero row: we got lucky. Mining is a lottery, and any single guess can win. But on average, the work grows fast. Bitcoin's very first block needed a hash starting with 10 zeros. Blocks today need about 19 or 20, which is why the whole network now makes around a billion trillion guesses every second.

Why this matters for traders Trader's angle

  • Every transaction has a hash too. It is called the transaction ID, or TXID. When an exchange or a counterparty says a payment has been sent, ask for the TXID and look it up on a block explorer. It shows whether the transaction exists, how much was sent and how many new blocks now sit on top of it.
  • Hashrate is a health signal. Hashrate is the total number of guesses the network makes per second. Bitcoin's hashrate first passed one zettahash per second, a 1 followed by 21 zeros, in April 2025. A rising hashrate means miners are investing in the network. A sudden drop, like when a US winter storm forced miners to switch off a large share of machines in January 2026, can put miners under pressure.
  • Stressed miners can become sellers. Miners pay for electricity and machines, often by selling the bitcoin they earn. When their income falls, some sell more or shut down. That is why some traders follow hashrate-based indicators alongside price charts.

Key terms

Hash
A short, fixed-length code calculated from any data. The same data always gives the same hash.
SHA-256
The hash function Bitcoin uses. Its results are always 64 characters long.
Avalanche effect
The property that a tiny change in the input produces a completely different hash.
Block header
The short summary at the top of a block. It holds the previous block's hash, a summary of transactions, a timestamp and the nonce.
Nonce
A number miners change repeatedly while searching for a block hash that meets the target.
Hashrate
The total number of hash guesses the network makes per second. A common measure of mining power.

Key takeaways

  1. A hash is a short, fixed-length code calculated from any data. Bitcoin relies on SHA-256, whose results are 64 characters long.
  2. Good hashes are consistent, change completely with any edit, cannot be reversed and do not repeat in practice.
  3. A block has a body of transactions and a header that includes the previous block's hash and a summary of its transactions.
  4. Because each block stores the hash of the one before, editing an old block breaks every link after it.
  5. Mining means guessing nonces until the block hash starts with enough zeros, and each extra zero makes the search about 16 times harder.

Test yourself

Choose an answer for each question. You will see the correct answer and a short explanation right away.

Question 1 of 6
What does a hash function do?
Question 2 of 6
You change one letter in a document and hash it again. What happens to the hash?
Question 3 of 6
Why can't someone work backwards from a hash to the original data?
Question 4 of 6
What links one block to the block before it?
Question 5 of 6
What is the nonce?
Question 6 of 6
What happens to the mining search each time one more leading zero is required?

For education only. Nothing on this page is financial advice.