← IGCSE Computer Science Paper 1

Stopping the same digital currency being spent twice

Spending the same digital currency twice. Blockchain stops it: each spent payment is already in the shared ledger, so a second payment of the same money is refused.

Understanding Stopping the same digital currency being spent twice in IGCSE Computer Science Paper 1

What it does: Once a payment is recorded in the shared ledger, that money is marked as spent. The entry cannot be used again, so copying does not help. The pseudocode checks whether the coin is already in the ledger. If it is, the second payment is refused, which stops double spending. Double spending is using the same digital money for two different payments. It is not about paying a higher price. Computers on the network look in the shared ledger. They do not rely on the buyer's word.

Common mistakes: If the coin is already in the ledger it has been spent, so the second payment must be refused. The line should output "Refused". The check must use the shared ledger, which records every spent payment. A wallet does not show whether the coin was already spent. It should be SEARCH(ledger, coin).

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
Why could double spending be a problem for digital money but not for a physical coin?
A digital file can be copied, so the same money could be sent twiceA physical coin can be copied for free but digital money cannot
Matches
Ava sends the same coin to Ben and to Cara, and both payments are accepted
↓
Blockchain would not accept both payments. The first payment is already in the ledger, so the second one is refused.
Applying
Meanings
Term
double spending
Meaning
Spending the same digital currency twice. Blockchain stops it: each spent payment is already in the shared ledger, so a second payment of the same money is refused.
Practice
IF coin IN ledger THEN
Testing
Gaps
IF coin IN THEN
Check Answer
Spots
2IF coin IN ledger THEN
3 OUTPUT "Accepted"

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

The 'Moose' badge — Tundra Champion, 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. Why could double spending be a problem for digital money but not for a physical coin?
A. A physical coin can be copied for free but digital money cannot
B. A digital file can be copied, so the same money could be sent twice ✓
A physical coin can only be handed to one person at a time. A digital file can be copied, so a system is needed to stop the same money being spent again.
2. What does double spending mean?
A. Paying twice as much as the price of an item
B. Spending the same digital currency more than once ✓
Double spending is using the same digital money for two different payments. It is not about paying a higher price.
3. How does blockchain check a payment before accepting it?
A. It checks the shared ledger to see if the money has already been spent ✓
B. It asks the buyer to promise the money has not been spent
Computers on the network look in the shared ledger. They do not rely on the buyer's word.
4. Ava spends her coin in a shop. She then tries to pay the same coin to a friend. What happens?
A. The second payment is refused because the first is already in the ledger ✓
B. The second payment is accepted because it has a new time-stamp
The first payment is already recorded in the ledger, so the same money cannot be used again. A new time-stamp does not make the coin spendable again.
5. Which statement about a ledger entry is correct?
A. Once a payment is recorded it cannot be reused for another payment ✓
B. A recorded payment can be copied and used for as many payments as needed
A recorded ledger entry shows that the money has been spent. Copying it does not create new money.

Match the Pairs

double spending → Trying to spend the same digital currency twice, which blockchain prevents
check ledger before accepting → The shared ledger is searched to see if the money was already spent before a payment is accepted
A digital file can be copied, but a ledger entry cannot be reused once the money is spent → coin spent = recorded in ledger
A second payment of the same money is refused because the ledger already shows it as spent → IF coin IN ledger THEN refuse payment
Ava sends the same coin to Ben and to Cara, and both payments are accepted → Blockchain would not accept both payments. The first payment is already in the ledger, so the second one is refused.
Copy the coin file and spend the copy, because the ledger does not check it → The ledger does check. Copying a file does not create new money, because only the ledger entry counts and it is already used.

Key Term

double spending
Spending the same digital currency twice. Blockchain stops it: each spent payment is already in the shared ledger, so a second payment of the same money is refused.

Fill in the Blanks

1. IF coin IN ledger THEN REFUSE payment ENDIF
Hint: Type the name of the shared record that already lists every spent payment.
2. IF coin IN ledger THEN REFUSE payment ENDIF
Hint: Type the action taken when the coin is already in the ledger as spent.
3. IF coin IN ledger THEN REFUSE payment ELSE ACCEPT payment ENDIF
Hint: Type the keyword that chooses the other path when the coin is not yet in the ledger.
4. IF coin NOT IN ledger THEN ACCEPT payment ENDIF
Hint: Type the logic word that checks the coin has not been spent before.
5. coin ← 5 ADD coin TO ledger IF coin IN ledger THEN REFUSE payment
Hint: Type the variable holding the money that is being spent a second time.

Spot the Error

Question 1
A coin ← "C7"
B IF coin IN ledger THEN
C OUTPUT "Accepted"
D ELSE
E ADD coin TO ledger
Line C — If the coin is already in the ledger it has been spent, so the second payment must be refused. The line should output "Refused".
Question 2
A INPUT coin
B found ← SEARCH(wallet, coin)
C IF found = TRUE THEN
D OUTPUT "Refused"
Line B — The check must use the shared ledger, which records every spent payment. A wallet does not show whether the coin was already spent. It should be SEARCH(ledger, coin).
Question 3
A payment ← "Ava pays Ben 5"
B IF payment NOT IN ledger THEN
C DELETE payment FROM ledger
D ELSE OUTPUT "Refused"
Line C — An accepted payment must be added to the ledger so that a later attempt to spend the same money is refused. Deleting it would allow double spending. It should be ADD payment TO ledger.
Question 4
A entry ← "C4 paid to Sam"
B ledger ← entry
C IF entry IN ledger THEN
D OUTPUT "Already spent"
Line B — This overwrites the whole ledger and wipes out all earlier records. A ledger entry is added to the end of the ledger, so it should be APPEND entry TO ledger.
Question 5
A FOR each block IN chain
B IF coin NOT IN block THEN
C spent ← TRUE
D NEXT block
Line B — The coin should be marked as spent when it IS found in a block. NOT IN would mark it as spent when it is missing. It should be IF coin IN block THEN.

Student with a class code? Join your class →