Computer ScienceExam code: 0984

Digital Currency

Internet and Its Uses

A blockchain is a digital ledger of every transaction in a currency, organised as a chain of blocks linked by cryptographic hashes, with copies stored across many computers in a decentralised network.

Three big ideas in that definition:

  1. A ledger: a record of who owns what and who sent what to whom.
  2. A chain of blocks: transactions are grouped into "blocks" and each block links to the previous one through a hash, so the whole history is connected in order.
  3. Distributed across many computers: no single computer holds "the" blockchain; many computers (nodes) keep copies and agree on the same version.

What is inside a block?

Each block typically contains five things:

FieldWhat it holds
Block numberThe position of this block in the chain (the first block is block 0, the genesis block)
TransactionsA list of new transactions being recorded in this block (who sent how much to whom, when)
TimestampThe exact time the block was added
Hash of the previous blockThe cryptographic fingerprint of the block before this one, linking the chain backwards in time
This block's own hashA cryptographic fingerprint summarising all the data in this block

What a hash is

A hash is the fixed-length cryptographic fingerprint of some data, produced by a one-way function. Even a tiny change in the data produces a completely different hash.

Two important properties of a hash:

  • Deterministic: the same input always produces the same hash.
  • Sensitive to change: changing even one character in the input produces an utterly different output. This is what makes hashes useful for spotting tampering.

How blocks form a chain

Each block stores the of the previous block in its own header. This is the "link" in the chain:

Block 0          Block 1          Block 2          Block 3
[ hash: H0 ]     [ hash: H1 ]     [ hash: H2 ]     [ hash: H3 ]
                 [ prev: H0 ]     [ prev: H1 ]     [ prev: H2 ]
[ data ]         [ data ]         [ data ]         [ data ]

The first block (block 0) is special and is called the genesis block; it has no previous block, so its prev field is zero or empty.

When a new block is added, the network calculates the hash of the latest block and stores it as the new block's prev. The chain grows one block at a time.

Three blocks (Block 10, Block 11, Block 12) drawn left-to-right. Each block holds four fields: Prev_Hash, Timestamp, Tx_Root and Nonce. An arrow runs from each block to the next block's Prev_Hash field, showing that every block stores the hash of the block before it so the chain is linked in order.
Source: How blocks form a chain by Save My Exams

Common exam question

How blockchain tracks digital currency transactions

Question: Name the process that tracks digital currency through a digital ledger, fill the gaps in a description of it, or draw and annotate a diagram of a payment (1–4 marks).

Asked in 3 of the 17 papers, as a one-mark name, a four-mark gap-fill and a four-mark diagram; the specimen paper also asks for a two-mark description. The name is blockchain: a digital ledger that tracks each transaction as a new record with a time-stamp, linked to the record before it. Records already in the chain cannot be altered, only new ones added, so every transaction can be traced. The gap-fill credited "blockchains", "time-stamp" and "traced"; "datachains" and "transaction-chains" were near-misses, so read each term back into its sentence.

The diagram earns one mark for each correct stage you label: the customer's device encrypts the payment data and sends it to a digital ledger; the payment is recorded there with a digital signature and a time-stamp; the transaction is stored in a block that carries its own hash; and the full block is added to the blockchain on every device.

Build on this topic