Edexcel International Advanced Level Computer Science, point 16.1.2
Definition
A blockchain is a distributed, shared digital ledger (record book) made of a growing chain of blocks. Each block contains data (such as transactions) and a hash of the previous block, which links them together so that changing an old block would break every block after it. It is copied across many computers (nodes), with no single owner or central authority.
Function and why needed
It lets people who don't trust each other agree on a shared record, without a trusted middleman such as a bank. Once data is recorded, it is extremely hard to alter or delete. Best known for cryptocurrencies (Bitcoin), it is also used for supply chain tracking, digital identity, voting systems, medical records, contracts ("smart contracts") and proving ownership.
Characteristics
- Distributed: every node holds a copy of the whole chain.
- Decentralised: no central controller.
- Immutable (tamper-evident): old blocks can't be changed without detection.
- Transparent: participants can inspect the ledger (in public blockchains).
- Consensus: nodes follow rules to agree which new blocks are valid.
- Uses cryptography: hash functions and digital signatures (16.1.1).
Operation
Structure of a block
| Part | Purpose |
|---|---|
| Data | The transactions or records stored |
| Timestamp | When the block was created |
| Previous hash | The hash of the block before, which links the chain |
| Nonce | A number adjusted during mining (below) |
| Hash | The digest of the whole block (data, previous hash, nonce), its "fingerprint" (16.1.1) |
How the chain stays secure
Each block's hash depends on its contents, and the next block stores that hash. If someone changes data in Block 2:
- Block 2's hash changes.
- Block 3 still holds the old hash of Block 2, so the link is broken (the chain no longer verifies).
- To hide the change, the attacker would have to recalculate the hash of Block 2 and of every block after it, and do it faster than the whole network adds new blocks, and on most of the copies. This is practically impossible for a large network.
Mining and proof of work
Adding a new block needs agreement. In proof of work, miners compete to solve a puzzle: find a nonce so that the block's hash starts with a required number of zeros. This can only be done by trial and error, which takes a lot of computing power, but checking the answer is instant.
- The first miner to find a valid nonce broadcasts the block, and other nodes check it and add it to their copy. The miner receives a reward (new coins and fees).
- Raising the difficulty (more leading zeros) makes the puzzle harder. Each extra zero makes it about 16 times harder (in hex).
- If two valid blocks appear at once, nodes follow the longest chain.
Consensus
Nodes must agree which blocks are valid. Proof of work is one method. Proof of stake (validators put up coins as a stake, and are chosen in proportion) uses far less energy.
Benefits
- Tamper-evident and secure: very hard to alter the record.
- No central point of failure or control.
- Transparent and auditable.
- Removes middlemen, which can cut costs and speed up transactions.
- Resilient: many copies exist.
- Smart contracts automate agreements.
Drawbacks
- Energy use: proof of work uses enormous amounts of electricity.
- Slow and limited throughput compared with a central database (Bitcoin handles about 7 transactions a second, a card network thousands).
- Storage grows forever: every node keeps the whole chain.
- Immutable means errors can't be corrected (a mistaken transaction can't be reversed), and illegal content can't be removed.
- A 51% attack: someone controlling most of the computing power could rewrite recent history.
- Privacy: public ledgers are visible (even if pseudonymous).
- Lost private keys mean lost funds, with no recovery.
- Regulation, scams and misuse (illegal transactions).
Worked example
Task: a supermarket chain records each batch of produce as it moves from farm to shelf on a blockchain. Explain the benefit, and what happens if someone tries to change a record.
- Benefit: every party (farm, transport, warehouse, store) adds records that all can see. If contamination is found, the batch can be traced quickly, and nobody can quietly alter the history to hide a problem. No single company owns the record.
- Tampering: if a haulier edits an earlier block (to hide a delay in transport), that block's hash changes, so the next block's stored "previous hash" no longer matches, and every other node's copy disagrees. The change is detected immediately, and rejected.
- Limitations: the blockchain only proves the record hasn't changed: if a false entry is made at the start ("garbage in"), it stays false forever.
Exam tip: describe a block (data, previous hash, own hash) and explain how changing one block breaks the chain. You may be asked to complete a diagram of a blockchain: show each block's "previous hash" matching the hash of the block before it. Mention that the data is distributed across many nodes. Give a benefit (tamper-evident, no central authority) and a drawback (energy use, slow, can't undo mistakes).
Check yourself
What does each block in a blockchain contain?
Data (such as transactions), a timestamp, the hash of the previous block, a nonce and its own hash.
Why is a blockchain tamper-evident?
Changing a block changes its hash, which no longer matches the previous hash stored in the next block, so the chain breaks and every other copy disagrees.
What is proof of work?
Miners search by trial and error for a nonce that makes the block's hash meet a difficulty target, which takes much computing power but is easy to check.
Give one benefit and one drawback of blockchain
Benefit: tamper-evident record with no central authority. Drawback: high energy use (for proof of work), slow, and records can't be corrected.
What does "distributed" mean for a blockchain?
Many nodes each hold a copy of the whole chain, so there is no central point of control or failure.