Hashtag Web3 Logo

How Blockchains Work

12 min
beginner

What problem does a blockchain solve?

A blockchain lets participants verify a shared transaction history under a common set of rules.

Nodes check proposed transactions and blocks. A consensus mechanism determines which valid history the network follows when participants see competing blocks.

For a payment, the record identifies the transfer and the resulting balances. Verification depends on the chain's software, consensus rules, and security assumptions rather than only one account provider's database.

Blocks: bundles of transactions

A blockchain is, quite literally, a chain of blocks.

Each block is a container. It holds a list of recent transactions - "Alice sent 2 ETH to Bob," "Charlie sent 0.5 ETH to Diana," and so on. A typical Ethereum block holds a few hundred transactions.

Block #1 Prev hash: 0000... Timestamp: Jan 2015 Alice → Bob: 2 ETH Eve → Frank: 1 ETH Grace → Hank: 5 ETH Hash: a3f8... Block #2 Prev hash: a3f8... Timestamp: Jan 2015 Bob → Carol: 1 ETH Dana → Eve: 3 ETH Frank → Grace: 2 ETH Hash: 7b2c... Block #3 Prev hash: 7b2c... Timestamp: Jan 2015 Hank → Alice: 4 ETH Bob → Dana: 1 ETH Carol → Eve: 2 ETH Hash: d91e...

Notice the blue text: each block's "Previous hash" matches the hash of the block before it. This is what creates the chain. If you change even one character in Block #1, its hash changes completely, and Block #2's "Previous hash" would no longer match. The chain breaks.

Hashes: digital fingerprints

A hash is a fingerprint for data. You feed any amount of data into a hash function, and it spits out a fixed-length string of characters. The same input always gives the same output. But change even one letter, and the output is completely different.

"Hello World" SHA-256 a591a6d40bf420404a011733cfb7b190... "Hello World!" SHA-256 7f83b1657ff1fc53b92dc18148a1d65d... Adding one character ("!") completely changes the output. This is called the "avalanche effect."

Hash links make changes detectable. Replacing an accepted history also requires overcoming the network's consensus rules; recalculating hashes alone is not enough. The cost and conditions differ between proof-of-work and proof-of-stake systems.

Nodes: thousands of copies

A blockchain does not live on one computer. It lives on thousands of computers called nodes. Each node keeps a complete copy of the entire blockchain.

New Transaction Alice → Bob: 2 ETH 💻 Node 1 ✓ Valid 💻 Node 2 ✓ Valid 💻 Node 3 ✓ Valid 💻 Node 4 ✓ Valid 🏴☠️ Attacker ✗ Rejected

Nodes receiving a transaction check its signature and relevant execution rules. A block producer chooses transactions for a proposed block, and other nodes validate the block. Inclusion is not decided by a simple majority vote of all nodes.

Validating nodes reject transactions that break protocol rules. Consensus attacks can affect ordering, censorship, and finality, but do not automatically let an attacker forge another user's signature.

Consensus: how nodes agree

With thousands of independent computers, how do they agree on which transactions are valid and in what order? This is called consensus, and it is the hardest problem in blockchain design.

There are two main approaches:

Proof of Work Used by: Bitcoin How it works: 1. Miners race to solve a math puzzle 2. First to solve it gets to add the block 3. Winner earns a reward (new coins) Security model: Cheating requires more computing power than the entire network. ⚡ Downside: Uses a lot of energy Proof of Stake Used by: Ethereum How it works: 1. Validators lock up tokens as collateral 2. Network picks a validator randomly 3. Validator proposes the next block Security model: Cheating means losing your staked tokens (called "slashing"). ✓ Uses 99.95% less energy

Proof of Work is like a lottery where buying a ticket requires solving a hard math problem. The more computing power you have, the more tickets you buy. Bitcoin uses this method.

Proof of Stake is like a security deposit. Validators put up their own money (ETH) as collateral. If they act honestly, they earn a small reward. If they try to cheat, their deposit gets taken away. Ethereum switched to Proof of Stake in September 2022 and now uses 99.95% less energy than before.

How a transaction actually works

When you send ETH to someone, here is what happens step by step:

1. You sign Your wallet signs the transaction with your key 2. Broadcast Transaction sent to the network (mempool) 3. Validate Nodes check: do you have enough ETH? 4. Included Added to a block. Finality comes later. Wallet signature Network propagation Validity checks Block inclusion

Ethereum assigns a block-proposal slot every 12 seconds, though a slot can be missed. A transaction's first inclusion is not the same as finality: a recent block can be replaced in a reorganization. Wallets and applications use confirmation or finality requirements appropriate to the transfer.

Why this matters

Blockchains are slow (12 seconds per block) and expensive (you pay gas fees for every transaction) compared to a regular database. So why use one?

Use a blockchain when independently verifiable state and shared transaction rules are needed. A conventional database is usually simpler when one operator is responsible for the records. Applications can combine both.

Feature Regular database Blockchain
Speed Milliseconds 12+ seconds
Cost Hosting, operations, and maintenance Network fees plus application costs
Who controls it The company that owns it No single entity
Can be edited According to administrator permissions According to execution and consensus rules
Needs trust Operator and access controls Protocol, consensus, and application dependencies
Best for Speed-sensitive apps Money, ownership, voting

The right question is not "blockchain or database?" It is "which parts of my app need trust guarantees, and which parts need speed?" Most Web3 apps use both.

Key takeaways

  • A block is a bundle of transactions. A chain is blocks linked by hashes.
  • A hash is a digital fingerprint. Change one bit of input, and the entire hash changes.
  • Nodes are computers that each hold a copy of the blockchain and verify transactions independently.
  • Consensus is how nodes agree. Proof of Work uses computing power. Proof of Stake uses staked tokens.
  • Blockchains are slow and expensive, but they remove the need to trust a middleman.

Quiz: How Blockchains Work

1 / 5

What is a block in a blockchain?