← IGCSE Computer Science Paper 1

Working out ownership from the blockchain

The amount of digital currency a person owns, found by adding up all the money they received and taking away all the money they sent in the blockchain records, in time order.

Understanding Working out ownership from the blockchain in IGCSE Computer Science Paper 1

What it does: The blockchain lists every transaction in order, so you work through them one at a time to track who owns what. Ava's money in is 10 and her money out is 4, which leaves 6. Ben only received 4. Money in minus money out: 10 - 4 = 6. Sent coins are taken away, not added. Money in is 8 + 5 = 13. Money out is 3. So 13 - 3 = 10 coins. Ben received 5 and sent 2, so 5 - 2 = 3 coins. Cai has 2 coins. The blockchain records are all that is needed. Balances are worked out by adding up the transactions.

Common mistakes: Money sent must start at 0 before the records are added up. Starting at 10 would wrongly take 10 coins off the balance. It should be moneyOut ← 0. The records must be read in time order, so they are sorted by time-stamp. Sorting by amount puts them in the wrong order. It should be SORT chain BY timestamp.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 520–546) and word search (Modules 510–546).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
How can you work out how much digital currency a person owns using the blockchain?
Add up everything they received and subtract everything they sentLook up one number stored in a bank account
Matches
Ava received 10 and sent 4, so balance = 10 + 4 = 14
↓
Money sent was added instead of taken away. The balance should be 10 - 4 = 6.
Applying
Meanings
Term
balance
Meaning
The amount of digital currency a person owns, found by adding up all the money they received and taking away all the money they sent in the blockchain records, in time order.
Practice
balance ← 0
Testing
Gaps
balance ←
Check Answer
Spots
1moneyIn ← 0
2moneyOut ← 10

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Star Fox' badge — Frozen Master, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. How can you work out how much digital currency a person owns using the blockchain?
A. Add up everything they received and subtract everything they sent ✓
B. Look up one number stored in a bank account
The blockchain lists every transaction, so a person's balance is money in minus money out across all their records.
2. In which order should you read the blockchain records to work out a balance?
A. Time order, from the oldest record to the newest ✓
B. Any order, because the total is always different
Records are read in time order using their time-stamps. Following them in order shows how the balance changed step by step.
3. Ali receives 10 coins and later sends 4 coins. What is his balance?
A. 14 coins
B. 6 coins ✓
Money in minus money out: 10 - 4 = 6. Sent coins are taken away, not added.
4. Mia has these records: receives 8, sends 3, receives 5. What is her balance?
A. 10 coins ✓
B. 16 coins
Money in is 8 + 5 = 13. Money out is 3. So 13 - 3 = 10 coins.
5. Ana sends 5 coins to Ben, then Ben sends 2 coins to Cai. Assuming they started with nothing else, what is Ben's balance?
A. 7 coins
B. 3 coins ✓
Ben received 5 and sent 2, so 5 - 2 = 3 coins. Cai has 2 coins.

Match the Pairs

balance = received - sent → Work out how much digital currency a person owns by adding up what they received and subtracting what they sent
Ava -> Ben: 5 coins → A record showing that Ava sent 5 coins to Ben, so Ava's balance goes down by 5 and Ben's goes up by 5
Read the records in time order from the first one, starting every balance at 0 and updating after each record → for each record in time order: update balances
Worked example: Ava is paid 10 coins and then sends 4 coins to Ben, so Ava owns 6 and Ben owns 4 → Ava: 10 - 4 = 6, Ben: 4
Ava received 10 and sent 4, so balance = 10 + 4 = 14 → Money sent was added instead of taken away. The balance should be 10 - 4 = 6.
Ben's balance = only the coins he received, ignoring the coins he sent → Ignoring the records where Ben is the sender. You must count all records, both money in and money out.

Key Term

balance
The amount of digital currency a person owns, found by adding up all the money they received and taking away all the money they sent in the blockchain records, in time order.

Fill in the Blanks

1. balance ← 0 FOR EACH record IN blockchain OUTPUT record.amount
Hint: Type the number a person's balance starts at before any records are read.
2. IF record.to = "Ava" THEN balance ← balance + record.amount ENDIF
Hint: Type the operator used when Ava receives money, which makes her balance go up.
3. IF record.from = "Ava" THEN balance ← balance - record.amount ENDIF
Hint: Type the field name that holds the sender, so the record shows money going out.
4. ava ← 10 - 4 ben ← 0 + 4 - 1 cara ← 0 + 1
Hint: Type the amount Cara received, which is what Ben sent out in his last step.
5. SORT blockchain BY timestamp FOR EACH record IN blockchain OUTPUT record.from, record.to
Hint: Type the field used to put the records in time order before tracing a coin.

Spot the Error

Question 1
A moneyIn ← 0
B moneyOut ← 10
C FOR EACH t IN chain
D IF t.to = name THEN
E moneyIn ← moneyIn + t.amt
Line B — Money sent must start at 0 before the records are added up. Starting at 10 would wrongly take 10 coins off the balance. It should be moneyOut ← 0.
Question 2
A SORT chain BY amount
B balance ← 0
C FOR EACH t IN chain
D IF t.to = name THEN
E balance ← balance + t.amt
Line A — The records must be read in time order, so they are sorted by time-stamp. Sorting by amount puts them in the wrong order. It should be SORT chain BY timestamp.
Question 3
A ana ← 10; bob ← 0; cy ← 0
B ana ← ana - 4; bob ← bob - 4
C bob ← bob - 3; cy ← cy + 3
D OUTPUT ana, bob, cy
Line B — When Ana sends 4 coins to Bob, Ana loses 4 and Bob gains 4. Bob's balance must go up. It should be bob ← bob + 4.
Question 4
A balance ← 0
B FOR EACH t IN chain
C IF t.from = name THEN
D balance ← balance + t.amt
E ENDIF
Line D — This record is one where the person sent money, so the amount must be taken away. It should be balance ← balance - t.amt.
Question 5
A owner ← lastRecord.to
B FOR EACH t IN rest
C IF t.coin = coinId THEN
D owner ← t.to
Line A — Tracing a coin starts at the first record in time order, which gives its first owner. Then each later record changes the owner. It should be owner ← firstRecord.to.

Student with a class code? Join your class →