Free lessonHow Blockchain Works · 1/42 min read

Blocks and hashes: the building blocks of a blockchain

What a block is, what a hash is, and how chaining blocks together with hashes makes past records very hard to change.

A blockchain is a list of records grouped into batches called blocks. Each new block is attached to the one before it, forming a chain that goes all the way back to the very first block. To understand why this chain is hard to tamper with, you need to know what a hash is.

What is a hash?

A hash is a short digital fingerprint of any piece of data. A hash function takes an input, such as a sentence or a whole file, and turns it into a fixed-length string of letters and numbers. Three properties matter:

  • The same input always gives the same hash.
  • Changing even one character of the input gives a completely different hash.
  • You cannot work backward from the hash to recover the input.
Example

Using the SHA-256 hash function (the one Bitcoin uses), the text "hello" always produces a hash starting with 2cf24dba. Change it to "Hello" with a capital H and the hash starts with 185f8db3. One small change, and the fingerprint looks totally unrelated. That makes any edit instantly visible.

What is inside a block?

A block typically contains:

  • A list of transactions, such as "address A sends 0.5 coins to address B."
  • A timestamp showing roughly when the block was made.
  • The hash of the previous block.
  • Some extra data the network needs, depending on the blockchain.

Why chaining matters

Because each block includes the previous block's hash, the blocks are linked like a chain. Suppose someone tries to secretly edit a transaction in an old block. That block's hash changes. Now the next block points to a hash that no longer matches, so the next block would also need to be rebuilt, and the one after it, and so on up to the newest block.

On a large network, redoing all that work, and convincing everyone else to accept it, is extremely expensive. That is why records deep in a blockchain are treated as practically permanent. People call this property immutability, meaning "cannot be changed."

The genesis block

The first block in any chain has no previous block to point to. It is called the genesis block. Every later block can be traced back to it.

Immutability cuts both ways. If you send coins to the wrong address, there is usually no "undo" button. Always double-check addresses before sending.
Save your progress — free

A free account tracks lessons, unlocks the quizzes and gives you 10,000 virtual USD (no real value) to practise with.

Create free account

Education, not investment advice. Crypto prices can fall sharply and most retail traders lose money. Practice in DUKOIN uses virtual USD with no real value.