Introduction

The MONS Project is a fictional IB case study where a small town wants to implement a local currency, but have seen the potential downfalls of physical money, so have considered using cryptocurrency to help solve this issue.

Block

Each block in a blockchain records a large number of transactions that have taken place (for example, in Bitcoin it's around 2400)

At the end of each block, there needs to be a 'proof of work' where each result in a block is chained together, and 'miners' find a value that returns a hash that has a set number of 0s at the beginning (which can be changed depending on number of miners)

Each block must contain the hash of the previous block in the header - making a chain. Thus, if you want to change an earlier block, you need to calculate the proof of work for all subsequent blocks too. And at that point, you are simply racing against other miners (assuming proof of work is used instead of proof of stake [links added later!]) - if you have less than 50% of the share of resources in terms of mining, then you won't be able to keep up (in terms of trying to fake data)

The first block in the chain (without any data in the 'previous block hash' field) is called the genesis block.

Whenever the miner gets the correct nonce to make the block data + nonce lower than the target value, the block now is successful and is added to the blockchain. Through this, the miners then get paid a share of the cryptocurrency for their work (which is why miners have an incentive to mine, and a partial reason as to why the mining pool constantly grows)


A block is formed by different miners.

When a transaction is made within a cryptocurrency, it doesn't go to the blockchain straight away, but is held in a transaction pool (place where multiple transactions are stored)

A miner aims to gather transactions from the transaction pool into a "candidate block", and then attempt to add this block to the blockchain.

Header Fields

  • Each candidate block has a header, which contain the following metadata (data that describes data) about the block:
    • Version: Describes the structure of the data inside the block - this allows miners to know what standard the block is in
    • Last Block: An identification number for the previous block - this is hashed
    • Transactions: This is basically the Merkle Root where all transactions are hashed into a single string.
    • Time: The current time (when the block was made)
    • Target: This is calculated from the difficulty value which is set by the cryptocurrency network in order to regulate how hard it is to add a block of transactions to the blockchain. Then, the miners will keep hashing the block header with a nonce at the start (arbitrary number) in order to get the hash below the target value.

Once a nonce is found that makes the block header + nonce below the target value, the block is solved, and then all transactions of the block are added to the blockchain. The nonce can only be found through brute force, as it has an NP time complexity.


Fixed Sizes

Each block has a maximum size - meaning that only a certain number of transactions from the memory pool can be placed in a block.

Blockchain

A blockchain is a chain of blocks when you're thinking about it on the high level. In the context of computer science, a blockchain is often used in cryptocurrency to make sure that transactions are immutable and as a result, more reliable for people using the cryptocurrency.

This works in cryptocurrency by using hashing algorithms and making subsequent blocks be hashed with data from previous blocks, thus creating a chain.


...

Hashing

Merkle Root

This will be updated in the future with more information.

Public and Private Keys

This is important for cryptography, and by extension, also for cryptocurrency.

Digital Signature

A digital signature is a combination of the private key and the transaction data itself. This is useful in cryptocurrency because it allows someone to show that they are the correct recipient without revealing their private key. This is also unique to every transaction as transaction data is always going to be different - this means that people can't use the same digital signature for other transactions to pretend to be somebody else.


How do they work

To create a digital signature, the private key, transaction data as well as a random number is used.

To confirm whether a legit private key was used to generate the digital signature, the digital signature, transaction data, and the public key are used together, and the result will then show whether the private key used is legit.

SSH and PuTTYGen

PuTTYGen is used to generate private and public keys using the SSH-2 algorithm.

These private and public keys are used for the output locks - locks used to identify the address that the transaction is aimed for.

When each transaction is created, it takes one output (that someone owns) and creates more outputs out of that (potentially addressed to other people). When an output is created, a lock is placed with it addressed to a certain person, and they can only access the outputs of that if they can unlock the lock - essentially only if they have the private key to ensure that the person trying to unlock the outputs is the person they say they are.


Example Question:

Explain how PuTTYGen and SSH are used in blockchain.

Transactions

Coinbase Transaction (additional information)

This is the transaction that goes to the miner when they successfully mine the block. Think of this as like putting your name on the top of a lottery sheet in order to address the contents of the reward to you.

When people make transactions, they can put a "fee" on it which they pay. This fee goes to the miner if they successfully mine a block.

This fee is essentially like a priority ticket. The more you pay, the further ahead in the queue you are. This is because miners aim to make the largest amount of profit, so they are going to put a transaction from their [memory pool] to a [candidate block] with the highest reward per bit size.

The transaction amount is then checked by other nodes to see if it's calculated correctly. If not - the block reward will not be given to the miner.

Additionally, these coinbase transactions will only be transferred over to the miner once the block is 100 blocks deep (in Bitcoin) to basically ensure that the transaction is not fraudulent.

Fee per Byte

Every transaction takes up a certain amount of space, and each transaction may take a different amount of space. As a block has a limited size (around 1 MB for a block), miners will place their transactions where the reward per byte (size of the block) is at a maximum, so they can make the most of the limited space inside a block.

Example

If a transaction takes up 8B, and has a reward of 20, while another transaction has a size of 1B, but a reward of 5, the 1B transaction will have higher priority as it takes up the least amount of space but gives a lot of value in return.


Key Terms and Definitions

51% Attack

Definition: When a person or affiliated group of people have 51% or more of the resources in the mining pool in a cryptographic system that uses proof-of-work, allowing them to manipulate the network to their own liking.

Explain: When a block is considered 'valid' on the blockchain, that fork of the blockchain needs to be the longest chain, meaning that in order to create a fraudulent block, you would need to make blocks faster than the rest of the mining pool to get your fork of the blockchain 'trusted', which requires more than 51% of the share of the mining pool and enough luck.

Block

Definition: A group of a fixed size of transactions from the transaction pool to be inserted into the blockchain.

To expand, you could say that each block has a header which contains the previous block hash, the nonce, the version that the cryptocurrency is running on in that block (so other miners know how to read it and what to do with that data), and the hash of the block.

Blockchain

Definition: A blockchain is made up of several blocks linked to each other by using the hash of the previous block and hash of the current block such that if a single value in one of the blocks is changed, the hash changes, and thus, the chain is 'broken' and is therefore an invalid chain unless all subsequent blocks are re-validated.

Candidate Block

Definition: A candidate block is a block to be entered into the blockchain. This is essentially a list of transactions where the nonce hasn't been found to make the hash of the block and the nonce under a certain target value.

Collision Resistance

Definition: A property of a cryptographic hash function where a function is considered collision resistant if it is very hard to find two inputs that map to the same output.

Cryptocurrency

Definition: A form of digital currency that is not regulated by a central authority.

Cryptographic Hash

Definition: A one-way function where an input maps to a unique output of fixed length and where a small change to the input creates a completely different end hash.

Determinism

Definition: A function is deterministic if one input always maps to the same output.

Digital Signature

Definition: The use of the transaction data and a private key to create a signature that is attached to each transaction. To verify that a signature is valid, the private key (unique to each person), transaction data as well as the digital signature itself is used together to show whether block funds are linked to the correct person or not.

Distributed Consensus

Definition: A distributed consensus ensures the consensus of the validity of the data among different nodes in the distributed system (in this case the MONS project). The members of a cryptocurrency are part of a distributed system, and they have to ensure that their individual copies of the blockchain in sync with everyone else's. Each ‘full node’ in the system contains a copy of all the transactions, otherwise known as blockchain. Each block on the blockchain contains transaction history, and when a node adds a transaction or a block to the blockchain, it sends out the information to the rest of the network. The blocks are then validated by the miners and proof of work. If someone is receiving two different blockchains, they will always disregard the shorter of the two chains.

Double-spend problem

Definition: When the same amount of cryptocurrency is spent in two different places. This is avoided by essentially using the longest block (and this depends on which transaction ends up in the longest block because they're broadcasted to different nodes).

Also linked to why in Bitcoin, you would want your transaction to be 3 blocks deep before feeling safe about it being confirmed.

Entropy

Definition: Measure of uncertainty associated with a random number generator (also something to do with atmospheric noise/humidity levels/gyroscope sensor type stuff with RNG)

Genesis Block

Definition: A block without a previous block hash attached to it in the header (effectively the start of the blockchain)

Immutable Transactions

Definition: Once a transaction is around 3 blocks deep in a blockchain, it is essentially "immutable", which means that the value of that transaction cannot change

(Links to hashing and block headers)

Key Pair Generation

Public + Private Key generation: RSA Encryption

Ledger

Definition: A public record-keeping system of all the transactions that have occurred in a blockchain that every full node in the blockchain keeps a copy of.

Merkle Proof + Merkle Tree

Definition: A method to get all the transactions hashed in a block (by essentially using a binary tree structure to make a final hash)

This takes off some computational workload when used.

Miner

Definition: A node that works to put transactions in a candidate block and find a nonce that makes the hash go below the target value to then be placed on the blockchain. They get a bit of reward in BTC for doing this.

Mining

Definition: Finding a nonce that makes the block hash + the nonce hashed together below a certain target value

Nonce

Definition: Number only used once - hashed together with a block to hopefully get something to be below a target value for that thing to be a 'valid' block.

Non-invertibility

Definition: Goes hand in hand with a one-way function and is important for hashing functions (can only go one way, very hard to go the other way)

Non-repudiation

Definition: A situation where it is impossible to deny the authorship of a digital signature. In essence, message senders are unable to falsely claim that they did not send the message.

One-way function

See above Non-invertibility

Proof of work

A paradigm in cryptocurrency used where people find a nonce below a certain target value (aka mine the block) to make sure that it is valid.

PuTTYgen

PuTTYgen is a software used to generate public and private SSH keys (RSA keys being one of them).

Self-referential Data Structure

Points to the same kind of structure (ie singly linked list)

SHA256

Definition: Is a hashing algorithm

Takeover Attack

Definition:

Transaction Pool

Definition: 'Waiting area' for all transactions that each full node has for themselves.

November 2020 Paper 3 Past Paper

These notes aren't too good right now - these will be changed.

1a - Identify 2 characteristics of Peer-to-peer network [2]

  • A peer to peer network contains multiple nodes connected to each other, where each node acts as both a client (receiving data) and a server (sending data).
  • Scalable
  • Seeding - can be used to say how reliable one connection is over another connection. (Sort of like a trust mechanism)

1b - Identify 2 sources of entropy. [2]

  • Atmospheric Noise - True RNG
  • Time - Pseudo RNG
  • Light level in the atmosphere
  • Temperature/Humidity

2a - Describe the steps that need to be carried out by the blockchain system to find a user's central MONS balance [4]

  • The blockchain system calculates the balance of each user by looking at the transaction history.
  • When a user needs their balance calculated (for future transactions for example), each node looks at transactions associated with the user (both as the sender and the receiver), and then calculates how much cryptocurrency has been given to the user, and how much cryptocurrency the user has given away to other users.
  • These two values are then added up together (with the cryptocurrency the user given away being negative) to find a user's MONS balance.
  • UTXO - sequentially goes through UTXO for each user from the start of the block to the end of the block.
  • The block when split - calculations are done that way
  • Blocks have to be validated in order for the transaction to be valid.

Dolores states "one of the great things about the blockchain is that we can ensure that the solution time remains at 10 minutes, and we can do this even as the number of MONS miners increases" (lines 63-65).

2b - Explain why it is important to ensure the solution time remains at 10 minutes. [4]

  • By setting the solution time at 10 minutes, a block can only be added to the MONS blockchain every 10 minutes.
  • Making the solution time take 10 minutes (as opposed to 2 seconds) allows more transactions from the memory pool to be placed in a blockchain, and also helps with making sure transactions are non-malicious. As the solution time is 10 minutes, if a malicious user decides to edit transactions 3 blocks down, they would need to spend 30 minutes to find correct nonces to keep the blocks chained to each other. By the time they finish finding correct nonces, other miners would have added blocks to the blockchain, leading to 30 minutes of wasted time by the malicious users.
  • Also to ensure that the difficulty of mining the block does not change as the currency gets more popular.

Critics have complained about the potential environmental effects caused by the computing resources required by a blockchain network.

3 - Analyse the potential effects that the use of MONs could have on the environment. [6]

  • Proof of work uses a lot of electricity because a lot of computational power is needed.
  • Printed money - cost to environment by producing physical money (metal/heating/trees etc)
  • Inflation - don't need to print more money/different types of money
  • Heat generated by proof-of-work -> potential difference in climate change
  • Depends on where the electricity comes from
  • If electricity comes from more renewable sources of energy, it is likely that cryptocurrency is more environmentally friendly, but if electricity comes from non-renewable sources, it is more likely that cryptocurrency is worse from the environment. Looking at the world today, a sizeable portion of energy comes from non-renewable energy, so it is likely that the MONS project will be bad for the environment.

Pablo states: "In a traditional banking system, users trust the banks to keep everyone's money safe; but with MONS, the whole blockchain, right from the very first transaction, would be visible to all MONS users, so it is important to be able to explain to citizens how their money is guaranteed to be safe" (lines 109-112).

4 - With reference to the key technologies, to what extent do you believe the MONS project will ensure the safety of the residents' money? [12]

Plan:

  • Positive
    • Proof of work requires a lot of computational power - hard to fake data
    • Digital signature makes it obvious to the node that blocks are given from the correct user and stuff
  • Negative
    • In the beginning stages of the currency, it's very easy to get 51% of the share, and thus at the beginning, it will be harder to trust the data of the resident's money
    • This requires the people to be technologically secure - if the people have weak passwords, then a digital signature won't matter as other people will be able to access their funds and stuff like that
  • Evaluation
    • Another potential method that could be used is proof-of-stake -> does the same thing as proof-of-work but it's unlikely to have a 51% attack as this would mean they would need a large share of the currency (rather than just computational power), which is far far far more expensive

12 Marker Answer

The MONS project uses proof of work, which ensures that the resident's money is safe. Proof of work requires a group of miners to race and find a nonce that when hashed together (using an algorithm such as SHA-256) with the block header in a candidate block (a block to be put on the blockchain), results in a value lower than the target value set by the cryptocurrency. This target is changed by the MONS project such that it takes all the miners in a network 10 minutes to find a suitable nonce. Additionally, each block in a blockchain is linked to the previous block, meaning that if a single transaction in a block is changed, the whole link from that block onwards needs to be rebuilt, so if a transaction is several blocks down, it takes a lot of computational power to rebuild the chain. All this helps to ensure that the residents' money has not been tampered with, ensuring the safety of their money. However, in the beginning stages of the MONS project, there will be fewer miners competing to find the correct nonce, so staging a 51% attack at the earlier stages will be far easier, and potentially realistically viable. When a 51% attack occurs, a single party will have the majority of the resources in the mining pool, allowing them to create malicious transactions and as a result, makes Santa Monica's resident's money potentially unsafe and invalid. This could happen if a Trojan horse virus infected much of Santa Monica's computers, which would allow for a single party to be able to have the majority of the mining pool.

Additionally, digital signatures secure the transactions of residents, which makes sure that transactions are not created by another person. This works by using asymmetric encryption with an algorithm such as the RSA encryption algorithm. A digital signature is created by hashing the transaction data and private key together, and this digital signature is placed alongside the transaction to ensure that the transaction is 'signed' by the intended person. When people verify, they use the public key associated with the user alongside the digital signature and the public key, which will then return a boolean value describing whether the digital signature is correct. This digital signature is different for every transaction, meaning that a user cannot reuse the same digital signature for other transactions, ensuring the privacy of citizens' data. However, this depends on how tech-savvy the users are. If they use weak passwords or use the same password for every account, and possibly don't use an anti-virus, they could be infected by a Trojan horse which would allow for more likelihood of a 51% attack, or at the very least, transactions being falsely created by hackers using the accounts of infected citizens whether using their physical devices or through virtual means.

In evaluation, it is likely the ensure that MONS will be safe for citizens as long as they are tech-savvy and are able to use computers that are secure, and use a password manager to make sure all their passwords are unique and secure. Additionally, the currency will only be more secure with more users (as there will be more demand for miners, thus making it harder to stage a 51% attack), meaning that citizens will need to be informed about why MONS is secure to be confident in using it, and thus making the system more secure.


Add RSA encryption for digital signature section above.

Potential Questions

Social/Ethical:

  • Digital Divide (access to technology (both physically accessible, skill levels and confidence levels in cryptocurrencies))
    • Depends on the demographics of the town.
    • Culture/Schooling
  • Environment
  • Privacy/security
    • everyone is able to see how rich/poor you are
    • your wallet can be used to track where you live
  • Loss of jobs
    • Central Bank - jobs created are higher level than jobs being replaced
    • Higher pressure on businesses to use the cryptocurrency (for a benefit of some sort)
    • Cost of training
  • Potential differences in converting currency

12 Markers:

  • understanding how new blocks are added to the ledger and how the proof of work prevents malicious nodes from taking over the MONS network

  • understanding how the MONS architecture is scalable and can remain efficient as the number of users increases

  • understanding the use of cryptographic techniques in the MONS project

  • explaining to the Santa Monica citizens how their MONS balance is calculated from transaction data securely stored in a publicly accessible blockchain ledger

  • investigating how the distributed nature of a blockchain cryptocurrency and the confirmation process may have disadvantages for the citizens of Santa Monica.

  • To deploy MONS as a new currency for Santa Monica successfully, Pablo has to convince his citizens that MONS is reliable in the long run, suggest and explain four challenges to be solved before large-scale deployment regarding the scalability. [12]

    • What challenges need to be solved before large scale deployment (more secure stuff)

Mindmaps

This will contain a collection of 'mindmaps' in a list form based around different parts of cryptocurrency. These can be used for revision purposes.


Blocks

Header

  • This contains metadata - information about the (information of the) block.
    • Version
      • Describes the 'standard' of the block - miners can know what structure the data is in and the conventions that the version is associated with.
    • Last Block (Previous Block Hash)
      • Identification number for the previous block.
    • Transactions (Merkle Root)
      • All the transactions are hashed into a single string using the Merkle Root.
    • Time
      • The current time of when the block was created.
    • Target (Nonce)
      • This is calculated by the 'difficulty value' set by the cryptocurrency network to regulate how hard it is to add a block to the network. (Basically people need to keep incrementing the nonce (alongside the hash data) until the value of the hash is below the target value - related to hashing)
    • Nonce
      • This is a value that people can use to verify that the block was mined properly.

Genesis Block

  • This block is one without a value in the header for the previous block
    • This means that the block is the first in the blockchain (the one that starts the chain)

Blockchain

  • The blockchain is basically many blocks linked together. In the header for each block, they're linked to the hash of the previous block. The validity of the chain is dependent on the previous block being integral, meaning that if you wanted to change a transaction in one block in the chain, you would need to find the correct nonce for all the previous blocks beforehand faster than the rest of the mining pool.

Security

Immutable Transactions

Hashing

  • Hashing is a one-way function - meaning that it's very easy to hash a string, but very hard to reverse engineer.
  • Hashing typically provides a result that's of a fixed length and random. When even one character in the hash changes, the output of the hash completely changes.

Nonce

  • Nonce stands for Number only used once.
  • This nonce and the transaction data in a block are hashed together to create a block hash. If this block hash is lower than the target, then the nonce will have been found, and mining will have succeeded.

Digital Signatures

  • This is used to identify the owner of a currency.

Mining

Mining Pool

51% Attack

This happens when a single party has more than 51% of the share of the mining pool.


Transactions