Talk to an engineer →

How blockchains work: blocks, gossip and Proof of Work

Charles-Edouard Ladari
Charles-Edouard Ladari
Massive Sombrero · Published · Updated
SHORT ANSWER

A blockchain is a shared ledger of blocks, each linked to the previous one by a cryptographic hash and copied by many independent nodes. In Proof of Work, miners spend computation to find a valid block, and every node follows the chain with the most accumulated work. Nodes pass new transactions and blocks to their peers (gossip), so the whole network agrees on one history without a central party.

What is a blockchain?

A blockchain is a shared ledger: an ordered chain of blocks, each holding transactions and the cryptographic hash of the block before it.

A hash works like a fingerprint of data. Any change to the data, even a tiny one, produces a completely different fingerprint.

Because each block contains the fingerprint of the previous block, changing an old block breaks every link after it. To rewrite history, someone would have to rebuild every later block and convince the rest of the network to accept the new version.

No single company keeps this ledger. Many independent computers, called nodes, each keep their own full copy, and a copy that someone changed no longer matches the others, so the network rejects it.

The diagram below shows a transaction changed in one block: its fingerprint changes, and the next block no longer points to it.

WHAT IS A BLOCKCHAIN · STEP 1/4
Blocks are linked in order. Each block holds transactions and the fingerprint (hash) of the block before it.
THE CHAIN
BLOCK 1
prevnone
Ana → Ben
Cy → Dee
hash7f3a…
BLOCK 2
prev7f3a…
Ben → Eva
Eva → Finn
hashc91e…
BLOCK 3
prevc91e…
Dee → Ana
Finn → Cy
hash5b07…
BLOCK 4
prev5b07…
Max → Ben
Ana → Eva
hashe2d4…
COPIES HELD BY INDEPENDENT NODES
A blockchain: change one block and its link to the next block breaks.

What is Proof of Work?

In Proof of Work, miners compete to find a value that makes the block's hash meet a difficulty target.

There is no shortcut to finding that value, so miners try one guess after another, and the guessing costs computation. Checking a guess, on the other hand, is cheap: any node can confirm a valid block almost instantly.

Sometimes two miners find a valid block almost at the same time, and the chain forks: some nodes follow one block, others follow the other. Mining continues on both branches until one of them gets the next block first.

Nodes always follow the longest chain, meaning the one with the most accumulated work, so nodes on the shorter branch drop their block and switch. The dropped block is orphaned, and its transactions go back to the pool of pending transactions (the mempool) for a later block.

The same rule protects old blocks. Rewriting history would mean redoing that work faster than the rest of the network combined.

Bitcoin uses Proof of Work, as set out in the Bitcoin whitepaper. The Ethereum documentation on Proof of Work explains the same mechanism step by step.

PROOF OF WORK · STEP 1/5
Miners race: each one hashes block data with random numbers until one finds a hash below the target.
CHAIN
#100
#101
miner 1 ·
8f2c91…
a91e07…
3b7d4c…
e05a19…
71c8f2…
c4290b…
5d1ee8…
9a6f30…
8f2c91…
miner 2 ·
e05a19…
71c8f2…
c4290b…
5d1ee8…
9a6f30…
8f2c91…
a91e07…
3b7d4c…
e05a19…
miner 3 ·
5d1ee8…
9a6f30…
8f2c91…
a91e07…
3b7d4c…
e05a19…
71c8f2…
c4290b…
5d1ee8…
NETWORK · 8 NODES
node
node
node
node
node
node
node
node
follows A follows B
Proof of Work: a fork is resolved when every node follows the longest chain.
Proof of Work, step by step
StepWhat happensWhy it matters
CollectMiners gather pending transactions from the mempool into a candidate blockOnly transactions in a block become part of the ledger
SearchMiners try value after value until the block's hash meets the difficulty targetFinding a valid block costs computation, which makes blocks expensive to fake
BroadcastThe winning miner sends the block to its peers, who gossip it across the networkEvery node receives the new block without a central server
CheckEach node verifies the hash and the transactions before accepting the blockChecking is cheap, so every node can verify every block
Resolve forksIf two valid blocks compete, nodes follow the chain with the most accumulated workThe network converges on one history; the losing block is orphaned

How do nodes share transactions and blocks?

Each node passes new transactions and blocks to its peers, who pass them on, until the whole network has them. This is called gossip.

There is no central server sending updates to everyone. A new payment reaches a few nodes first, then spreads from peer to peer, and a block found by a miner travels the same way.

Gossip keeps the network running when some nodes go offline, because messages still travel through the others. It also means nodes receive messages at slightly different moments, which is one reason forks happen.

The diagram below shows one node receiving a new transaction and forwarding it to its peers, which forward it in turn until every node has it.

tx 0x3fa1… · new
Gossip · each node forwards to its peers, no central server
has the tx
Gossip: each node forwards a new transaction to its peers until the whole network has it.

How do nodes agree on one history?

Consensus is how independent nodes agree on one order of blocks without a central party.

Because messages spread by gossip, two nodes can hear about two different valid blocks at the same moment. Consensus decides which one becomes part of the shared history, so every node ends up with the same ledger.

In Proof of Work, that rule is the longest chain described above. Other networks use other consensus designs; Stellar, for example, uses the Stellar Consensus Protocol, described in the Stellar developer documentation.

What does this mean for a product built on a blockchain?

For most products, the consensus design matters less than what the chain offers: its standards, its tooling, and the stablecoins and partners available on it.

Consensus still shapes how the network is secured and when a payment can be treated as settled. On a Proof of Work chain, a payment becomes harder to reverse as more blocks are added after it, so products wait for several blocks before treating a large payment as final.

Choosing a chain for a payment product is covered in Stellar vs EVM vs Polkadot for stablecoin payments, which compares the options side by side. The chains and services Massive Sombrero supports are listed under Services, and the production projects in Selected work.

Frequently asked questions

What is Proof of Work in simple terms?

Proof of Work is a way for a blockchain network to agree on new blocks without a central party. Miners compete to find a value that makes a block's hash meet a difficulty target, which costs computation, and every node follows the chain with the most accumulated work.

What is mining in a blockchain?

Mining is the Proof of Work process of collecting pending transactions into a block and searching for a value that makes the block's hash meet the difficulty target. The miner that finds it first broadcasts the block to the network.

Why does Proof of Work use so much computation?

The computation is what secures the network. Finding a valid block takes many attempts, so rewriting history would mean redoing that work faster than the rest of the network, while checking a block stays cheap for every node.

What happens when two miners find a block at the same time?

The chain forks for a short time, with some nodes following each block. Mining continues until one branch gets the next block first; every node then follows that longest chain, and the other block is orphaned, with its transactions returning to the mempool.

Can a blockchain be changed after the fact?

Not without breaking every later link. Each block contains the hash of the previous block, so changing an old block means rebuilding every block after it and getting the network to accept the new version.

What is gossip in a blockchain network?

Gossip is how nodes share new transactions and blocks: each node forwards them to its peers, which forward them in turn, until the whole network has them. There is no central server.

Which blockchains use Proof of Work?

Bitcoin uses Proof of Work, as described in the Bitcoin whitepaper. Other networks use other consensus designs; Stellar, for example, uses the Stellar Consensus Protocol and has no mining.

When is a payment on a Proof of Work chain final?

A payment becomes harder to reverse with every block added after it, because reversing it would mean redoing the work of all those blocks. Products therefore wait for several blocks before treating a large payment as settled.

Talk to an engineer

A first call with Massive Sombrero clarifies goals, constraints and timeline.

Talk to an engineer

More from the blog