DC

5.2 Digital Currency

Understanding digital currency, cryptocurrency, blockchain technology, hashing, and how transactions are tracked and secured.

Learning Objectives

By the end of this lesson, you will be able to:

  • Understand the concept of adigital currencyand how digital currencies are used
  • Understand the process ofblockchainand how it is used to track digital currency transactions
  • Describe howhashingandencryptionare used to secure blockchain networks
  • Explain the role ofminersandproof-of-workin validating transactions
  • Understand the difference betweencentralisedanddecentraliseddigital currency systems

Key Terms

Digital Currency

Money that only exists in electronic form, exchanged for goods and services without physical banknotes or coins.

Cryptocurrency

A type of digital currency that uses cryptography for security. It is decentralised and not controlled by a central authority.

Blockchain

A digital ledger that records every transaction made with a particular digital currency. It is decentralised and immutable.

Block

A record of transactions that is linked to other blocks in a chain. Each block contains data, a hash value, and a previous hash value.

Hash Value

A unique value generated by an algorithm that acts as a fingerprint for a block of data.

Previous Hash Value

A value that points back to a previous block in the chain, linking the blocks together.

Genesis Block

The first block in a blockchain. It does not point to any previous block.

Mining

The process used to generate new coins and verify new transactions by solving complex mathematical problems.

Miners

Special network users who verify transactions and receive a commission for each new block created.

Proof-of-Work

A system that makes it take time (about 10 minutes) to determine the necessary proof-of-work for each block before it can be added to the chain.

Timestamp

Small data stored in each block that determines the exact moment the block was mined and validated.

Ledger

A book or collection of accounts in which account transactions are recorded.

Distributed Ledger Technology (DLT)

A digital system for recording transactions where the transactions and their details are recorded in multiple places at the same time.

Decentralised

Not controlled by a single entity or authority. Every participant in the network has a copy of the ledger.

Bitcoin

The original cryptocurrency, privately developed as a means of exchange on the internet.

Ethereum

A cryptocurrency that supports smart contracts. Founded by Vitalik Buterin.

Fiat Currency

Money issued and backed by a government, such as the US dollar or the euro.

Immutable

Unchanging over time or unable to be changed.

Smart Contracts

Self-executing contracts with the terms written into code, stored on a blockchain.

Encryption

The process of encoding data so it can only be read by authorised parties.

Hashing

The process of converting data into a unique fixed-length value that acts as a fingerprint.

Digital Wallet

A software application that stores the keys needed to access and manage digital currency.

1. What is Digital Currency?

Digital currencyis money that only exists in electronic form. It is exchanged for goods and services without the use of physical money such as paper bills or coins.

Key Features of Digital Currency

  • Exists purely in a digital format
  • Not available in physical form (unlike fiat currency)
  • Can be generated, stored and transferred electronically
  • Can be transferred between parties using computers, smartphones, and the internet
  • Accepted as a form of payment for goods or services
  • Can be transferred between accounts when carrying out transactions
  • Money only exists as data on a computer system
  • Can be transferred into physical cash if needed

Centralised vs Decentralised

Digital currencies can be either centralised or decentralised.

Centralised
  • Regulated by central banks and governments
  • All transactions and exchange rates determined by these bodies
  • Relies on a central banking system
  • Uses a system of serial numbers to make sure each note is unique
Decentralised
  • No state control
  • All rules set by the cryptocurrency community itself
  • Transactions are publicly available and can be tracked
  • Works within a blockchain network

Centralised Transaction Example

Suppose Nick wishes to send Irina some money. Nick uses Bank X and Irina uses Bank Y:

Nick
Bank X
Central Bank
Bank Y
Irina

Problem with centralisation:Maintaining confidentiality and security have always been issues with centralised digital currency systems.

Decentralised Transaction Example (Cryptocurrency)

Cryptocurrency has overcome the problem with centralisation by introducing decentralisation:

Nick
Nick's Wallet
Irina's Wallet
Irina

Cryptocurrency uses cryptography to track transactions and has no state control.

Activity 1: Digital Currency

  1. What is digital currency? [2]
  2. Give two differences between centralised and decentralised digital currency. [2]
  3. Explain what is meant by cryptocurrency. [2]
Solution:
  1. Digital currency is money that only exists in electronic form [1]. It is exchanged for goods and services without physical banknotes or coins [1].
  2. Centralised: regulated by central banks and governments [1]. Decentralised: no state control, rules set by the community [1].
  3. Cryptocurrency is a type of digital currency that uses cryptography to track transactions [1]. It is decentralised and not controlled by a central authority [1].

Check Your Understanding: Digital Currency

  • [1]Money that only exists in electronic form
  • [1]Exchanged for goods and services without the use of physical money
  • [1]A type of digital currency that uses cryptography for security
  • [1]Decentralised / not controlled by a central authority
  • [1]Bitcoin
  • [1]Ethereum
  • [1]Maintaining confidentiality
  • [1]Maintaining security
  • [1]Due to volatility / value can fluctuate rapidly in a short period of time
  • [1]By introducing decentralisation / no central authority
  • [1]All transactions are publicly available and can be tracked

2. What is Blockchain?

Ablockchainis a digital ledger that records every transaction made with a particular digital currency. Transactions are time-stamped and added to the blockchain in a permanent and unalterable way.

Key Features of Blockchain

  • Decentralised:Not controlled by a single entity or authority
  • Every participant in the network has a copy of the ledger
  • Participants can verify transactions independently
  • Made up of "blocks" of transactions linked together in a "chain"
  • Uses cryptographic algorithms to create a secure and tamper-proof record
  • Each transaction must be verified by multiple participants
  • Verification prevents fraudulent activity
  • Immutable:Unchanging over time or unable to be changed

Why Blockchain is Important

  • Provides immediate, shared and completely transparent information
  • Stored on an immutable ledger accessible only by permissioned network members
  • Can track orders, payments, accounts, production and much more
  • Members share a single view of the truth
  • See all details of a transaction end to end
  • Reduces risk and cuts costs for all involved
  • Virtually anything of value can be tracked and traded

The Structure of a Block

What is in a Block?

Whenever a new transaction takes place, a new block is created which has the following attributes:

Data
Name of sender and recipient, amount of money, etc.
Hash Value
A unique value generated by an algorithm (usually SHA-256) which acts as a fingerprint
Previous Hash Value
This points back to a previous block in the chain

Timestamp

Atimestampis small data stored in each block as a unique serial that determines the exact moment the block was mined and validated by the network.

In the context of verifying authenticity, Nakamoto developed timestamps based on the use ofhash-based proof of work. A Timestamp Server takes the hash of a block containing transactions to be timestamped and published on the network. This ensures that the transactions have existed at this point in time.

This system is chronologically enforced as each transaction hash contains the timestamp of the previous block of transactions, forming a chain of blocks.

Types of Blockchains

P
Public

Anyone can join and participate

C
Consortium

Controlled by a group of organisations

Pr
Private

Controlled by a single organisation

Activity 2: Blockchain Basics

  1. What is a blockchain? [2]
  2. Name three values that would be created for a new block. [3]
  3. What are the three types of blockchain? [3]
Solution:
  1. A blockchain is a digital ledger [1] that records every transaction made with a particular digital currency [1].
  2. Data (name of sender and recipient, amount) [1]. Hash value (unique value generated by an algorithm) [1]. Previous hash value (points back to previous block) [1].
  3. Public [1]. Consortium [1]. Private [1].

Check Your Understanding: Blockchain

  • [1]A digital ledger that records every transaction
  • [1]Transactions are time-stamped and added in a permanent, unalterable way
  • [1]Data (e.g. name of sender and recipient, amount of money)
  • [1]Hash value (unique value generated by an algorithm)
  • [1]Previous hash value (points back to a previous block in the chain)
  • [1]The first block in a blockchain — it does not point to any previous block
  • [1]Small data stored in each block as a unique serial
  • [1]Determines the exact moment the block was mined and validated by the network
  • [1]Because it is unchanging over time / unable to be changed
  • [1]A book or collection of accounts in which account transactions are recorded

3. How Blockchain Works

A new hash value is created each time a new block is created. This hash value is unique to each block and includes a timestamp, which identifies when an event actually takes place.

Block 1
Genesis
hash: A4BF
prev: 0000
Block 2
hash: 6AB1
prev: A4BF
Block 3
hash: 34EE
prev: 6AB1
Block 4
hash: FF12
prev: 34EE
Block 5
hash: AA00
prev: FF12

What Happens if a Block is Hacked?

SupposeBlock 2is changed in some way. Any changes to the data within Block 2 will cause the value of the hash to change (it will no longer have the value 6AB1).

This means thatBlock 3 and beyond will now be invalidsince the chain was broken between Block 2 and Block 3 (previous hash 6AB1 in Block 3 is no longer valid).

This will prevent tampering (for example, by a hacker).

Proof-of-Work and Mining

Proof-of-Work

  • Computers are so fast that it should be possible to quickly create a whole new string of blocks
  • Proof-of-workmakes sure it takes about 10 minutes to determine the necessary proof-of-work for each block before it can be added to the chain
  • This slows down the whole process of creating new blocks
  • This foils hackers and means the currency is regulated by all the network computers
  • Makes it almost impossible to hack into the blockchain
  • It would be necessary to attack every single block in the chain at the same time
  • It only takes one block to break the link for any transaction to be terminated

Miners

  • Special network users that get a commission for each new block created
  • They 'police' the proof-of-work process
  • Mining is the process that Bitcoin and several other cryptocurrencies use to generate new coins
  • They verify new transactions
  • When a new block is created, it is sent to each computer in the blockchain
  • It is checked for correctness before being added to the blockchain
  • If a new network user is created, they get a copy of everything in the whole blockchain system

The Six-Step Process of a Blockchain Transaction

  1. A transaction is requested— A wants to send money to B.
  2. A block is created— The transaction is represented online as a 'block'.
  3. The block is sent to every node in the network.
  4. Nodes validate the transaction— Those in the network approve the transaction is valid.
  5. The block is added to the existing blockchain— The block can be added to the chain, which provides an indelible and transparent record of transactions.
  6. The transaction is complete— The money moves from A to B.
FeatureCentralisedDecentralised (Blockchain)
Control
  • Controlled by a single entity or authority
  • Regulated by central banks and governments
  • Not controlled by a single entity
  • Every participant has a copy of the ledger
  • Security
  • Maintaining confidentiality and security are issues
  • Almost impossible to hack
  • Would need to attack every block at the same time
  • Transparency
  • Transactions are private
  • All transactions are publicly available
  • Can be tracked by anyone
  • Speed
  • Transactions processed through central bank
  • Takes about 10 minutes per block
  • Regulated by all network computers
  • Activity 3: How Blockchain Works

    1. Describe what would happen if block 3 was hacked to change the sum of money in the transaction. [3]
    2. What is proof-of-work and why is it important? [3]
    3. What are miners and what do they do? [2]
    Solution:
    1. Changing block 3 would cause its hash value to change [1]. Block 4 and beyond would become invalid since the previous hash value no longer matches [1]. This prevents tampering [1].
    2. Proof-of-work makes it take about 10 minutes to determine the necessary proof for each block before it can be added to the chain [1]. It slows down the process of creating new blocks [1]. This foils hackers and makes it almost impossible to hack into the blockchain [1].
    3. Miners are special network users that get a commission for each new block created [1]. They 'police' the proof-of-work process and verify new transactions [1].

    Check Your Understanding: How Blockchain Works

    • [1]The hash value of that block changes
    • [1]All blocks after it become invalid since the chain is broken
    • [1]This prevents tampering by a hacker
    • [1]To slow down the process of creating new blocks and foil hackers
    • [1]The process that Bitcoin and other cryptocurrencies use to generate new coins
    • [1]Also verifies new transactions
    • [1]Miners (special network users)
    • [1]It would be necessary to attack every single block in the chain at the same time
    • [1]It only takes one block to break the link for any transaction to be terminated
    • [1]They get a copy of everything in the whole blockchain system

    4. Encryption and Hashing

    Data security always matters.Encryptionis an approach that helps organisations keep their data secure. In blockchain, encryption adds to the overall security and authenticity of blocks and helps keep them secure.

    Encryption

    • An approach that helps organisations keep their data secure
    • Data is encoded or changed before it is sent out of a network
    • Only authorized parties can access that information
    • In Blockchain, encryption adds to the security and authenticity of blocks
    • Uses asymmetric algorithms with private and public keys
    Example
    Some text → Asymmetric algorithm + Private key + Public key → 6ab3d9f...

    Hashing

    • A hash function is a one-way function that converts data into a unique fixed-length value
    • The hash acts as a fingerprint for the data
    • A new hash value is created each time a new block is created
    • Any change to the data will change the hash value
    • Each block has a unique hash pointer
    • This ensures the security of the block
    Try hashing:

    Security of a Block

    A block — or the entire blockchain — is protected by a strong cryptographic hash algorithm. Each block has a unique hash pointer. Any modification in the block constituents will result in a change in the hash identifier of the block. Therefore, it offers an excellent level of security. One need not worry about the safety and security of data present in a block.

    Activity 4: Encryption & Hashing

    1. What is encryption and what is its role in blockchain? [3]
    2. How is hashing used to secure a block? [2]
    3. What is a block identifier? [2]
    Solution:
    1. Encryption is an approach that helps organisations keep their data secure [1]. Data is encoded or changed before it is sent out of a network [1]. In blockchain, it adds to the overall security and authenticity of blocks [1].
    2. Each block has a unique hash pointer [1]. Any modification to the block will change the hash identifier [1].
    3. Blocks can be identified by the block header hash [1] and the block height [1].

    Check Your Understanding: Encryption & Hashing

    • [1]An approach that helps organisations keep their data secure
    • [1]Data is encoded or changed before it is sent out of a network
    • [1]A unique value generated by an algorithm
    • [1]It acts as a fingerprint for a block of data
    • [1]The hash value of the block changes
    • [1]Subsequent blocks have a previous hash that no longer matches
    • [1]No — it's not possible to do so without erasing the information from all other blocks too
    • [1]Through the previous hash value, which points back to the previous block
    • [1]Its compatibility with other business applications due to its open-source nature
    • [1]Its security — developers paid special attention to security for online transactions

    Key Takeaways

    • Digital currencyis money that only exists in electronic form. It can be centralised or decentralised.
    • Cryptocurrencyis a type of digital currency that uses cryptography for security. It is decentralised.
    • Blockchainis a digital ledger that records every transaction. It is decentralised and immutable.
    • Ablockcontains data, a hash value, and a previous hash value.
    • Thegenesis blockis the first block in a blockchain.
    • Proof-of-workmakes it take about 10 minutes to add a new block, preventing hacking.
    • Minersare network users who verify transactions and receive a commission.
    • Hashingcreates a unique fingerprint for each block. Any change to the data changes the hash.
    • Encryptionkeeps data secure by encoding it before transmission.
    • Blockchain is used in cryptocurrency exchanges, smart contracts, research, politics, and education.

    Question Bank

    • [1]Digital currency can be centralised or decentralised; cryptocurrency is always decentralised
    • [1]Digital currency is regulated by central banks and governments; cryptocurrency has no state control
    • [1]Cryptocurrency uses cryptography to track transactions / works within a blockchain network
    • [1]Five blocks shown in a chain
    • [1]Each block contains a hash value
    • [1]Each block (except the first) contains a previous hash value pointing to the previous block
    • [1]The first block is the genesis block with previous hash = 0000
    • [1]The hash value of block 3 would change
    • [1]Block 4 and beyond would become invalid since the previous hash no longer matches
    • [1]The hacker would need to change all subsequent blocks at the same time, which is almost impossible
    • All digital currency systems use blockchaining →False
    • Blockchaining uses a decentralised database →True
    • The last block in a blockchain is known as the 'genesis block' →False
    • New hash values are only generated when data in a block is altered →False
    • Tampering of data in a block by a hacker would cause the hash value to change →True
    • Blocks are 'policed' by network users called 'miners' →True
    • [1]Data (e.g. name of sender and recipient, amount of money)
    • [1]Hash value (unique value generated by an algorithm)
    • [1]Previous hash value (points back to previous block)
    • [1]It enables information to be distributed among users without being copied
    • [1]Decentralised systems
    • [1]Distributed ledger
    • [1]Safer & secure ecosystem
    • [1]Minting
    • [1]Blockchain consists of a list of records
    • [1]Such records are stored in blocks which are linked with other blocks to form a chain
    • [1]Blocks can be identified by the block header hash
    • [1]And the block height
    • [1]No — it's not possible to do so without erasing the information from all other blocks too
    • [1]Every block consists of a hash pointer which acts as a link to the prior block
    • [1]Transaction data and a timestamp
    • [1]Bitcoin is a digital currency; Ethereum supports smart contracts
    • [1]Bitcoin was founded by Satoshi Nakamoto; Ethereum by Vitalik Buterin
    • [1]Bitcoin uses SHA-256; Ethereum uses its own algorithm
    • [1]Bitcoin block time is 10 minutes; Ethereum block time is 12–14 seconds