Astra Trainer
Business & Finance

How Does Blockchain Work? Blocks, Hashes, Consensus

11 min read

How does blockchain work? A blockchain is a shared record of transactions that many computers keep copies of at once. New entries are grouped into blocks, each block carries a unique fingerprint of the block before it, and the network follows a set of rules for agreeing which new block comes next. The result is a record that is very hard to rewrite after the fact, and that no single party controls.

This article explains each of those pieces, where the idea came from, how different blockchains reach agreement, and, just as importantly, what a blockchain does not do. It explains the technology and gives no view on buying or holding any cryptocurrency.

How does blockchain work?

Start with a ledger: a list of who sent what to whom. A bank keeps a ledger of its customers' accounts, and everyone trusts the bank's copy because the bank is in charge of it.

A blockchain replaces that single trusted ledger with many copies held by many independent computers, called nodes. To keep all those copies identical, the ledger is built in a particular way.

  • Transactions are grouped into blocks. Rather than adding entries one at a time, the network collects recent transactions and packages them together.
  • Each block is linked to the one before. Every block contains a hash of the previous block, a kind of digital fingerprint explained below.
  • The network agrees on each new block. A set of rules, called a consensus mechanism, decides which block is added next, so every node ends up with the same chain.

Those three ideas together are what make a blockchain different from an ordinary database.

A blockchain does not make records true. It makes them very hard to change once everyone has agreed on them.

Check yourselfSuppose someone changes one digit in a transaction inside a block from last year. Which blocks would stop matching, and what would they have to do to make the change stick?Show the answer

The edited block's hash changes completely. The next block recorded the old hash, so it no longer matches, and neither does any block after it. To make the change stick, they would have to redo every block since and persuade the rest of the network to accept that version. That is what tamper-evident means: changes are not impossible, but they are obvious and, on a large network, extremely expensive.

A hash function takes any piece of data and produces a short, fixed-length string of characters from it. Two properties matter. The same input always gives the same hash. And changing the input even slightly, a single digit in a single transaction, produces a completely different hash.

Because each block contains the hash of the previous block, the blocks form a chain. If someone tried to alter a transaction in an old block, that block's hash would change. The next block, which recorded the old hash, would no longer match, and neither would any block after it. To change one old entry, an attacker would have to redo every block since, and persuade the rest of the network to accept the altered version.

That is what people mean when they say a blockchain is tamper-evident. Changes are not impossible, but they are obvious, and on a large network they are extremely expensive to force through.

Start the Crypto course
Short lessons with quizzes. Free to begin.
Start the Crypto course →

Where the idea came from

The chaining idea is older than cryptocurrency. In 1991 the researchers Stuart Haber and W. Scott Stornetta published a paper called "How to Time-Stamp a Digital Document", describing how to link records with hashes so that no one could back-date or alter them without detection. Their work is often described as the first blockchain design.

On 31 October 2008, a person or group using the name Satoshi Nakamoto published the Bitcoin white paper, which combined that chaining with a way for strangers on the internet to agree on the ledger without trusting any central party. Haber and Stornetta are the most cited authors in it. The first Bitcoin block was created on 3 January 2009, carrying a newspaper headline about bank bailouts from that day's edition of The Times.

Ethereum, launched in 2015, extended the idea from recording payments to running small programs, called smart contracts, directly on the blockchain.

Consensus: agreeing without a referee

The genuinely hard problem a public blockchain solves is not storage. It is agreement. If thousands of computers each hold a copy, and anyone can join, how do they agree on which new block is valid, without a central authority, and without someone cheating by spending the same coin twice?

Consensus mechanisms are the answer. The two most widely used are proof of work and proof of stake.

MechanismHow a block gets addedWhat makes cheating costly
Proof of workComputers compete to solve a difficult puzzle; the winner adds the blockRewriting history would need more computing power than the rest of the network
Proof of stakeValidators lock up coins as a stake and are chosen to propose and confirm blocksValidators who cheat can lose their stake

Bitcoin uses proof of work, with a new block added roughly every ten minutes. Proof of work is secure but uses a great deal of electricity, because the puzzle-solving is deliberately expensive.

How this is taught inside Astra Trainer

The Crypto direction in the Business & Finance world runs to eleven courses on telling a real project from a hollow one, reading tokenomics, and understanding a wallet before funding it, starting with courses such as Basics of Blockchain, Decentralization and Coins vs Tokens.

Starting with the mechanism is deliberate. Most confusion about crypto comes from skipping straight to prices without understanding what the underlying system does and does not guarantee. Lessons take about five minutes and a guide walks you through anything strange.

From proof of work to proof of stake

The energy cost of proof of work became one of the strongest criticisms of blockchain technology. Ethereum responded by changing its consensus mechanism. On 15 September 2022, in an upgrade known as the Merge, it switched from proof of work to proof of stake. The Ethereum Foundation estimates that this reduced the network's energy consumption by about 99.95 percent.

The switch showed that consensus is a design choice, not a fixed feature of blockchains. Different systems make different trade-offs between security, speed, energy use and how decentralised they are in practice.

See the Take Control of My Money path
A goal-built path: courses chained in the order they pay off.
See the Take Control of My Money path →

Public and private blockchains

Not every blockchain is open to everyone. Public blockchains, such as Bitcoin and Ethereum, let anyone read the ledger and take part. Private or permissioned blockchains limit participation to approved members, such as a group of companies sharing a supply chain record.

Private blockchains are faster and use less energy, but they give up much of what makes public blockchains distinctive. If a small group controls who can write to the ledger, it is closer to a shared database with extra safeguards than to a system that works without trusted parties.

What a blockchain does not do

The technology is often described as if it solved problems it does not.

It does not make records true. A blockchain records what was entered, consistently and permanently. If false information is entered, it is recorded falsely, forever. This is sometimes called the oracle problem: the chain cannot check facts about the outside world.

It does not give a token value. Recording that someone holds a token says nothing about whether the token is worth anything. The article on tokenomics covers how to read what a token actually promises.

It does not make you anonymous. Most public blockchains are pseudonymous: addresses are not names, but every transaction is visible to everyone, permanently, and can often be traced.

It does not protect you from losing access. If you control a wallet directly and lose the private key, there is usually no one who can restore it.

General information, not investment advice. This article explains how blockchain technology works. It is not investment advice and takes no position on whether anyone should buy, hold or sell any cryptocurrency or token. Crypto assets are highly volatile, can lose all their value, are often less protected than traditional investments, and are regulated differently from country to country. Consider speaking to a qualified, regulated adviser before making any decision.

Why understanding comes before anything else

Blockchain is surrounded by more confident claims than almost any other technology, in both directions. Understanding the mechanism, what hashing and consensus guarantee and what they do not, is the best protection against both hype and dismissal.

Astra Trainer is built to make that understanding stick. Quizzes follow each topic and each course ends with a ten-question final exam, while daily quests, points and a streak keep five-minute lessons going. A Circle gives you a small group with a shared weekly goal and live sessions, which helps with a subject where much of what people hear is noise.

What to take from this

A blockchain is a shared ledger held by many computers, with transactions grouped into blocks that are linked by hashes, so changing old records is obvious and costly.

The chaining idea came from Haber and Stornetta in 1991; Bitcoin in 2008 added a way for strangers to agree on the ledger without a central authority.

Consensus mechanisms such as proof of work and proof of stake make that agreement possible. Ethereum's 2022 switch to proof of stake cut its energy use by about 99.95 percent.

Which is why the most useful answer to how does blockchain work comes with a limit attached: it keeps records consistent and hard to change, and says nothing about whether those records, or the tokens they describe, are worth trusting.

Test yourself

Question 1 of 3

On a proof of stake blockchain, what makes it costly for a validator to approve a fraudulent block?

Frequently asked questions
How does blockchain work in simple terms?

Transactions are grouped into blocks, and each block contains a digital fingerprint, called a hash, of the block before it, forming a chain. Many computers hold copies and follow rules to agree on each new block, so the record is shared and very hard to alter.

Who invented blockchain?

The idea of linking records with hashes was described by Stuart Haber and W. Scott Stornetta in a 1991 paper on time-stamping documents. The first working public blockchain was Bitcoin, described in a white paper by the pseudonymous Satoshi Nakamoto in 2008 and launched in January 2009.

What is the difference between proof of work and proof of stake?

In proof of work, computers compete to solve costly puzzles to add blocks, which uses a lot of energy. In proof of stake, validators lock up coins and are chosen to confirm blocks, and can lose their stake if they cheat. Ethereum switched to proof of stake in 2022.

Is blockchain the same as Bitcoin?

No. Bitcoin is one application of blockchain technology, a digital currency. Blockchain is the underlying method of keeping a shared, tamper-evident ledger, and it is used by many other systems, including Ethereum and private business networks.

Where can I learn about blockchain and crypto in short lessons?

The Crypto direction inside the Business & Finance world of Astra Trainer runs to eleven courses on blockchains, wallets, coins and tokens and reading tokenomics, in five-minute lessons with quizzes. The first lesson needs no card.

Where this leads. How to Get Better With Money: The Order to Learn It explains where crypto fits among the money topics worth understanding, and why it comes after the basics.

Understand crypto before you trust it
Crypto is one of five directions in the Business & Finance world, alongside Money Systems, Structures, Markets and Trusts. Ninety-five courses in total, included in one pass that also opens the other six worlds. Pass the final exam and claim a verified certificate with your name on it.
Written by Aleksandr Steinwand
Founder, Astra Trainer · Published · Updated

From the Astra Trainer library

All 131 books
Continue reading

In the app

Crypto

See the courses