0% found this document useful (0 votes)
26 views80 pages

02 Blockchain

The document discusses the failure of Silicon Valley Bank (SVB) after it invested deposits in safe but interest rate sensitive assets like treasury bonds. As interest rates increased, the value of SVB's assets decreased, forcing regulators to shut it down amid a run on the bank. This disrupted stablecoin TerraUSD (UST), as $3.3 billion of reserves backing UST were tied up at SVB. The shutdown caused UST prices to drop significantly and transaction fees on the Ethereum network to soar as investors scrambled to move funds.

Uploaded by

ayush agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views80 pages

02 Blockchain

The document discusses the failure of Silicon Valley Bank (SVB) after it invested deposits in safe but interest rate sensitive assets like treasury bonds. As interest rates increased, the value of SVB's assets decreased, forcing regulators to shut it down amid a run on the bank. This disrupted stablecoin TerraUSD (UST), as $3.3 billion of reserves backing UST were tied up at SVB. The shutdown caused UST prices to drop significantly and transaction fees on the Ethereum network to soar as investors scrambled to move funds.

Uploaded by

ayush agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 80

Lecture 2: The blockchain

News this week


• Silicon Valley Bank, the nation's 16th-largest bank,
failed after depositors hurried to withdraw money this
week amid anxiety over the bank's health.
• SVB had invested deposits accumulated during covid
from its startup and venture capital clients from $60
billion to $200 billion.
• SVB invested the deposits in safe assets (treasury bond
and govt backed mortgage securities). Increasing
interest rates decreased the value of these assets.
• Stablecoin prices are volatile and gas fees soar as
investors scrambled to move money around hours
after regulators shut SVB amid a run on the bank.
• Sank to $0.869 on the Kraken exchange at 07:16 UTC
on Saturday
• $3.3 billion of the reserves backing the world's second-
largest stablecoin were tied up at SVB.

Link to article
Outline
• Blockchain conceptually: the layers
• The consensus mechanism on the blockchain
• Signatures
• Miners
• How is data stored on the blockchain: Hash functions and merkle trees
• Proof of work, proof of stake, and delegated proof of stake
• Blockhain interoperability
• Mining pools and the network
• Recap
What is a blockchain?
First, tell me what you think…
Focus of this unit

• Short answer:
• A blockchain provides coordination between many parties, when there is no single trusted
party (e.g. a bank). 区块链提供多方的协调
• One application is ownership: It allows asset ownership to be recorded and transferred with
full transparency and verifiability of ownership.
• There are several advantages:
• The ledger is automated and therefore not as prone to human error. The design is however still man-
made.
• Distributed ledgers are less costly than centralized authorities (lower transaction fees).
• 分布式记账成本低于中央集权
• It’s very easy to audit
The blockchain: The beginning
1970s: Using double-key cryptography to make secure transfers of assets from one wallet to
another (British intelligence)
• Private key/public key cryptography:
• Private key: Password that releases coins from your wallet
• Public key: Address of the wallet, known by everyone, bank account number.

• Elliptical curve cryptography: Provide correct private key, can combine with public key as correct or not correct
• Almost impossible to reverse engineer a private key from a public key: Approximately 100 years with a supercomputer

1976: Recording new data sequentially in a write-only, indelible ledger, the “blockchain” (IBM)
• Each new entry is connected to the entry before it automatically (mathematically)

1991: Decentralizing the ledger to provide transparency of data to all users and interested third
parties (Bell Labs)
• Create security with a third party, not a trusted party (that needs to be incredibly secure)
• Everyone is the third party. Everyone one is an auditor
• The security comes from transparency (not secrecy)
• Cryptographer at bell labs came up with it
2008: Validating new data by cryptographic “consensus” proof, in recurring 10-minute open
competitions, instead of relying on a trusted third party (Nakamoto)
• Anyone can be a miner and compete to validate blocks for rewards
• The rewards keep everyone honest
• Many applications beyond payments
• Whoever built bitcoin understood micro economics and game theory very well and how to make a market reach an interesting equilibrium
Blockchain contains four layers

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers
• The compute layer moves from state to state and writes permanent
information on the blockchain (the history is unchangeable)
• Transparency: The program is public to everyone
• Verifiability: Everyone can verify that state transitions
• Trustless: We don’t need to trust third parties as everything is public

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers
• On this layer we have programs (applications) written on to the
blockchain infrastructure that react to messages from the public
• Bitcoin, MakerDao, uniswap, bZx, Kyber etc

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
Blockchain contains four layers
• Public interacts with cloud servers that interact with the DApps
• Users send commands to the user interfacing tool which the
translates/sends those commands for the DApps

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Consensus and Compute layers Defines abstract computations


reaches consensus
Today we will focus on the consensus layer

User facing tool How the user interacts with the


program

Applications run on the


Application blockchain (Dapps, smart
contracts)

Compute layer Defines abstract computations

Consensus layer Here parties coordinate/agree


on the state of the chain
How does the consensus layer work?
….
Block 1 Block 2

Buy TX Miners
Alice Pizza Mempool
Pizza
Reward

Buy
TX Reward
Drugs
Bob
Drugs

Chris Buy Weapons TX


Weapon

But what are miners really?


For example, in bitcoin consensus would
work like this:

Step 1: Steve sends bitcoin Step 3: The miner


to Karen. The transaction is that verified the
automatically sent to the transaction receives
“miners” for verification a bitcoin reward

A B C

Step 2: The miners compete on verifying the


transaction. The stronger CPU is more likely to win
Logic of a blockchain
Source: Ethereum white paper

• Blockchain can contain other data than simple transactions (e.g., real estate ownership, birth certificate etc.)
• The data is then encrypted with hash codes which is extremely resilient to replication and reverse engineering
(“hashed”): For example, “Tx[1]” is the hash of transaction 1
• Each block contains two entries: hash code of inbound data, Tx(n), hash code of prior block, S(n - 1).
• They’re “chained”: For example, block 2 contains new information, and inbound information from block 1
• Every block hash is 64 characters long regardless of the size of the information
• The hash of the pervious block and the current block combined are 128 characters and then hashed to 64
characters so that it summarizes the current and past block’s information.
• Therefore, unlike a conventional ledger, if you remove or change one block it’s going to affect all future data:
The change will affect the current 64 code, which will ripple forward into all future 64 character codes
• Blockchains therefore can be changed, but it’s easy to detect. Auditing the blockchain is therefore an easy task.
Logic of a blockchain

A beautiful mind (2001): The imitation game (2014):


John Nash deciphering Russian messages Turing deciphers German submarine
movements with his machine

• Cryptography: Making and breaking codes by finding patterns (similar inputs leads to similar outputs)
• Cryptographic method won’t work for the blockchain as the inputs are different every time: Contains the previous
blocks hash + the new transactions hash.
• Even if Tx(1) = Tx(2), we will have S(1) ≠ S(2), making it impossible to recover the raw data
• The methods is so powerful that the US defense department uses it for battlefield orders
Ok, so where do we stand?

Step 1: We know that Step 3: We know that


ownership of an asset can miner who puts the
move between two transactions (in a block)
individuals on a blockchain onto the blockchain gets
a reward for their service

But how do users sign


off on transactions?
A B C

Step 2: We also know that miners verify the shift in ownership. They
act as an alternative to a centralized authority (e.g., a bank)
Signatures

To send money with a check all I need is my


signature to authenticate.

But what if the check is digital? A digital picture


of my signature could then be replicated.

Solution: Make the signature depend on the


content of the document
John wants to send his wife, “Jane”, $100

Accept/reject

Verifier

Signing
algorithm

John’s secret key Verifier’s public key


John want’s to send his wife, “Jane”, $100

Accept/reject

Syntax: Signatures are three algorithms


• Gen(): Creates a key pair, a secret key and a public key
• Sign(secret key, message): Creates a signature
• Verify(public key, message, signature): Accepts or Rejects
Miners verify signatures before adding
transactions
….
Block 1 Block 2
Buy TX Miners
Alice Pizza Mempool
Pizza
+Sig
6.25 BTC

Buy
TX 6.25 BTC
Drugs
Bob
Drugs
+Sig

Chris Buy Weapons TX


Weapon
+Sig
Hash Functions and merkle trees

1. What are they?


2. The input
3. “Hashing” of that input
4. Hash function output
5. Aggregating the data into merkle trees
What is a hash function?

• A “digital fingerprint”

• You cannot reverse the hash into the original content, just like you can’t say anything
about a person from their fingerprint.

• A person can prove their identity by matching their fingerprint with one stored in a
database
• In an airport they can check you fingerprint against database of fingerprints, but they can’t tell your
nationality, age, sex…

• Someone who breaks into the database and steals the fingerprint cannot use it to re-
create the person, or even tell what the person looks like
Input to a hash function

• Anything that can be stored in digital form can be hashed (and verified)
• Text
• Data
• Video, music, photographs
• Fingerprints, irises
• Etc.
• Limit: 2.09 exabytes
• So large it would take 220 years just to read in
• New York times made hash codes of their entire photo album so that they can’t be
doctored. Josef Stalin removed people from photo for example as if they never
existed (chilling)
What does a hash function
do with the input?
• Input is converted to a hexidecimal “hash” by scrambling
it in a way that is impractical to invert
• For instance, “Take every third digit in the file, multiply that
number by 7, add the digits together and divide the total by every
fourth number in the file. Append every number not used in the
previous calculation to the number you have, etc. . .”
• Even if everyone knows the hash code (the process), they can’t
invert it and they can easily be made more complicated
• They are usually updated at NSA (smartest cryptographers in the
world) for example for nuclear launch codes
Hash function complexity (have a go)

Input Output
14f962560929788a1c2a1f8c4f6b1789
2 5 6) 2b0ea0750330872361104c2bce0cf2d6
A -
(SH
“I love Digital Finance” (SHA3-2
56) 2bce9285b12afe39bcbbdadb5c44528d
(SH
A3 8a6cac9c3a15fa427f7ec0c0f0c3c145
- 51
2)
261d1917af20347c92c4eba78b6473e8
637a85cde226636ccc9046211930e945
c76e630c09f4bc8ef704dc46d374b954
a5b6b573ead00523333a0877f0f653bc

Fun fact: Google claimed Prize (1 btc) for cracking Sha256


That weekend everyone had to reset their passwords so they could be rehashed (with stronger hashing)
Try for yourself (SHA-256, SHA3-256, and SHA3-512

Input Output (SHA3-256)


“I love Digital Finance” fbc80f570111234622dfb5115eb45cdff
8175cca383aa58eae1d3958a7c7db2d

“I love Digital Finance!” efce8562d441d07d795d6f4a08aaaffc6


bc83632ce8cdac1c0bd92dafd90e3ff

“Stop telling me what to love!” 0b7ee2b26c2144b8276a21ccc1ad340e


c89b3247d42e04a11987a35ccf60acb0

Developed at IBM in early 1950s

• SHA3-256 is hexadecimal and contain letters (A-F) and numbers (0-9)


• The size of the hash is 256 bit, a 512 code (twice the size) would be twice as hard to break
• Scalable: Even the hash of the bible is 64 characters long

Try hashing: https://emn178.github.io/online-tools/sha3_256.html


1. Try hashing the inputs
2. Try hashing inputs 1 and 2, appending them, and hashing them
What data is actually stored on the
blockchain?
• On a blockchain, we can’t see the name of the sender or the name of
the receiver. So what do we see?
• What is this?:
Answer a payment for
an assassination!
Conversation between Ross Ulbricht and
Hells Angels
Block

Merkle tree
H1234567
910910
910910

H12345678 H910910
910910

H1234 H5678 H910910 H910910

H12 H34 H56 H78 H910 H910

H1 H2 H3 H4 H5 H6 H7 H8 H9 H10
Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx1
1 2 3 4 5 6 7 8 9 0
Merkle tree
Blockchain

Block 1 header Block 2 header Block 3 header Block 4 header


hash hash hash hash
Merkle root Merkle root Merkle root Merkle root

Merkle tree Merkle tree Merkle tree Merkle tree

Tx1 Tx2 Tx3 … Tx1 Tx2 Tx3 … Tx1 Tx2 Tx3 … Tx1 Tx2 Tx3 …
Txn Txn Txn Txn
Storing large amounts of data:
bundle it into blocks using Merkle trees

Each block contains 1 MB worth of data equal to 2000 transactions. We hash the
blocks and condense them into a merkle tree.

In the tree we hash each transaction, combine them, hash again etc. With every hash we
create a 64 alphamerical string. Finally, the merkle root is the the final hash.

What happens if a hack for example changes transaction C?


1) H(C) changes
2) H(hCIhD) changes
3) Merkle root changes
4) Previous head in n+1 block changes
And so on…
We work our way back the blockchain and see that the change originated at C

Penalty of hacking is being ignored: Anyone presenting a new version of the


blockchain will need to validate their version against everyone else's version.
Source: bitcoin.stackexchange.com
Records in a block
of the Bitcoin blockchain

Source: SolidX Partners Inc.

• This is the data that a regular bank would have


• The “data” field is a bit like memo field on check
• On the first transaction on the bitcoin blockchain Nakamoto put hashcode of morning headline of Times of London: Chancellor on brink
of second bailout for banks
• People realized you can put a lot of stuff here: Picture of you girlfriend, bible verse…
• Then people started putting other thigs on there: cusip of bond, deed to my house, my car, my investment securities, works of art.
• The blockchain is way more secure than an art registry, clearing house, or motor vehicle ledger
A blockchain with “proof of work”
Nakamoto (2008)

Each blocks have 4 pieces not 2


1. Root: All transactions condenses into 64 bit hash code
2. Prev_Hash: Hash code of prior block
3. Timestamp: The time
4. Nonce: An integer

The Nonce
• This is where the competition happens
• Miners compete to find a nonce that when added to the other three elements and hashed falls below a certain cutoff value
• Right now the nonce begins with 18 0s

Number of guesses:
For one leading 0?
If I need 1 0 at the start of the hash then I’d need to do 16 guesses since there are 16 possible entries into each cell (hexadecimal: 0-9 and a-f)
For two leading 0s?
If I need two 0’s in a row I’d need 16^2 power
For 18 leading 0s?
If I need 18 zeroes then I need 16^18 power
How do miners reach consensus?

Step 1: We know that Step 3: We know that


ownership of an asset can miner who puts the
move between two transactions (in a block)
individuals on a blockchain onto the blockchain gets
a reward for their service

How do miners reach


consensus
A B C

Step 2: We also know that miners verify the shift in ownership. They
act as an alternative to a centralized authority (e.g., a bank)
A blockchain with “proof of work”
Nakamoto (2008)

You computer needs to guess random numbers very fast and hash them just as fast
“Hash rate”: How many trillions of hashes your computer can do in one second

The reward was originally 50 btc and halves every four years
Today its 6.125 btc
2140 it will disappear
What will incentivize mining then?

Today, 19,101,800 out 21 million bitcoin have been awarded. Every bitcoin in the network was awarded to a miner at some point in time
The value of mining a block is (today) 32,795 * 6.125 = $200,869
They are rewarding people who can play the “lottery” very quickly

Blocks
The blocks come about 10 minutes apart and you can’t guarantee how long it will take for someone to solve a block (random)
The difficulty of the problem is adjusted every 2016 blocks (two weeks roughly) depending on how long it takes for people to solve a
Proof of work (PoW)
May the best Thanks, here’s a
I solved it! reward
CPU win!

Verify block

lved
ine r that so
M
puzzle
Block reward

• Miners use their CPU to solve a hexadecimal puzzle.


• When the puzzle is solved, a block containing transaction is verified, and the miner receives a
reward (for example a native coin).
• The miner engages in a “race” with other miners to solve the puzzle and miners with more CPU
power are more likely to win.
• Currently, for the bitcoin network, this is costing an awful lot of electricity
• Used in Bitcoin which started operating in late 2008
Blockchain demo

• https://andersbrownworth.com/blockchain/blockchain
Miners verify the blockchain via consensus
mechanisms…
• Proof of work (PoW)
• Proof of stake (PoS)
• Delegated proof of stake (Dpos)
Proof of stake (PoS)
Let’s get Won’t let you
Yay! to work! down!
Thanks, here’s a
Pick me! Pick me! Pick me!
reward
Pick me! Pick me! Pick me!

Pick me! Pick me! Pick me!


cted
l y sele
do m
Ran
Much fewer miners
than in PoW
Transaction fee

• Validators “stake” a specific amount (32 eth in Ethereum blockchain) of their cryptocurrency as
collateral for a chance to validate transactions (they have a horse in the race)
• Miners are then selected randomly from the volunteers
• Validators can lose their stake if they perform the validation task poorly (penalty). If the
validator for instance fail to validate (by going offline) or
• First proposed on the “bitcointalk” forum in 2011.
• Ethereum is moving to proof of stake (from proof of work).
PoS increasing in size
Delegated proof of stake (Dpos)
Let’s get Won’t let you
Yay! to work! down!
Vote! Thanks, here’s a
Vote! Vote!
reward, share with
your delegates
Vote! Vote! Vote!

Vote! Vote! Vote!

20-100 delegates
Transaction fee
selected

• Users “elect” delegates


• Remind you of anything?
• Hint:

• Delegates may alter from block to block


Blockchain interoperability?

• Interoperability: How do we move assets between different blockchains


e.g., bitcoin from the bitcoin blockchain to the ethereum blockchain?
• Composability: How do we allow Dapps from different blockchains to
communicate?

• This would be if easy if all blockchain technology was on Ethereum. It


isn’t…
Federated bridge: Bitcoin-Ethereum example
Bitcoin network Ethereum network

Bob’s bitcoin Bridge bitcoin Bridge contract Bob’s ethereum address


address address
Balance:
Balance: Balance:

1) Bob sends bitcoin to bridge address


2) Validators validate bridge balance and instruct
bridge contract to mint pegged (or wrapped)
Bob wants to use bitcoin on the bitcoin
Ethereum blockchain as he enjoys the 3) Validators send wrapped bitcoin to Bob’s
low transaction speed and wants to use it Ethereum address
4) When Bob wants to redeem his bitcoin he sends
Bob on Ethereum DApps the pegged bitcoin back to the bridge contract
Staked validators 5) The bridge contract destroys the bitcoin, the
Signing keys validators validate this and instruct bridge address
to move one bitcoin to Bob’s bitcoin address
Let’s have a look at the data
• Blockchain overview data
• https://www.blockchain.com/btc/blocks?page=1
https://bitinfocharts.com/comparison/bitcoin-
confirmationtime.html#3y
Block size Segregated Witness activated by
7-day moving average miners’ consensus on 24 August
2017 to circumvent block size limit

Unused capacity in the beginning

https://blockchain.info/charts/avg-block-size
Block size
7-day moving average
In the beginning the blockchain had unused capacity, now there is so much demand that there’s backlog
2017: Crisis, blockchain full, average block size up to 1 mb limit

Nakamoto added the 1MB block limit in secret back in 2017 (in and upgrade) to avoid Denial of service attacks (DOS)
where users fill the blockchain with spam (transactions) to crash it

Right now there is a scaling problem with Bitcoin


Nakamoto “We can increase this when we need to”
Different incentives on scaling

In Aug 2017, the segregated witness was implemented but this was just patch to truncate the data (now blocks exceed
1MB by a bit)
After implementation the block size did grow a bit beyond 1 MB

The bottleneck has created:


- Demand for alternative cryptoes
- Forks in the bitcoin network (new cryptoes) supported by miners
Mempool size
7-day moving average, since May 2016
https://blockchain.info/charts/mempool-count

Congestion is also observable in the mempool


2017: Sometimes 100 blocks waiting time (the better part of a day)
2018: Crypto winter decreased this

Day of the week effects: Monday and Friday much more mempool pressure
During regular business hours in the US (most of the demand is American) its also higher (US daylight hours)
When middle of the night in US there’s no no backlog

Remind you of anything (Hint= stock markets)


Trading in stocks:
Median transaction confirmation time
7-day moving average, transactions with mining fees only

How long does it take for the median transaction to be include in a block (confirmed): 5-10 minute
Lately its gone up: 8-9-10 minutes
https://blockchain.info/charts/median-confirmation-time
User fees and confirmation speed
February 24, 2019
• Fees work as an extra incentive for the miner to use your
transaction in their block (opposite to stock markets who
work FIFO)
• To find out how much to tip you can look at what others are
tipping (you don’t want to tip too much)
• Fees will increase in the future as block rewards shrink
• Separating equilibrium: The tip based on their patience.
• Your transaction can only stay in the mempool for 72 hours
• Out of this pool miners won’t pick the same transactions.
This means that no two miners will have the same root to the
tree
• Incentives may be off. Maybe the tip should be set by the
receiver (miner)?

257 x 32 x ($5,300 x 10-8) =


$0.45 fee for a typical
https://bitcoinfees.earn.com/
transaction
Voluntary transaction fees to miners
7-day moving average, June 2014 – June 2018

Impact of
congestion:
customers paying
for liquidity

Likely a user
error
(irreversible)

https://blockchain.info/charts/transaction-fees-usd
Mining fees vs. block rewards

Another user
error, but the
Why tips miner gave back
this far the money
back?

Source: Easley, O’Hara & Basu (2019)


Recalibrating the time required
to mine a new block

Example: on February 18, 2017, hash target value was reduced from
0000000000000000029ab9000000000000000000000000000000000000000000
to
0000000000000000027e93000000000000000000000000000000000000000000

https://blockchain.info/charts/difficulty
Recalibrating time to mine each block
• As the mining difficulty changes during a 2,016-block cycle
(blue series), difficulty is re-set for the next 2,016 blocks (red
series) such that the new expected block time equals 600
seconds. It then could drift upward or downward.

Goal

https://bitcoinwisdom.com/bitcoin/difficulty
Mining technology
• Central Processing Units (CPUs) of a high-end laptop or desktop, circa 2009
• 14 million SHA-256 hashes per second

• Graphics Processing Units (GPUs), circa 2010


• 850 million per second, 40 times faster that CPUs
• Designers began building PCs that had up to seven GPUs. These required improvised
housing in milk crates, etc.
• Led to a world shortage in graphics cards
Mining technology

• Purpose-built mining hardware, circa 2011


• Fivefold reduction in power consumption

• Specialized application specific integrated circuit (ASIC) chips


• Avalon 1 (2013), 66 GH per second and tenfold reduction in power
consumption
• This created a huge initial advantage for early adopters
• Mining revenue of approximately $300 per chip per day initially
• Competed away by market entry within three months
• Vast technical improvements continuously since then

Source: Joshua Cain


Mining hardware
Useful life ≈ 1 to 2 years

• Compare these to conventional


mining equipment (salvage value
and time)
• The producers of these miners
keep half for themselves (create
mining pools)
• Which miner would you chose?

https://bitcoinmining.com Source: Joshua Cain


Mining farms
Some can switch between currencies
or mine multiple currencies simultaneously

• Mining = “Competitive book keeping”


• Imagine asking Deloitte and EY to race
• Where would you put your farm?
• Cooling
• Energy
• Political stability
• Skilled labour
• This probably looks a lot like
commonwealth bank datacenter
Life Inside a Secret Chinese Bitcoin Mine:
https://www.youtube.com/watch?v=K8kua5B5K3I
• Do you want his job?
• Why did all the miners end up in China?
A miner’s economic problem
How different is this from a commercial bank data center?

• Balancing capital cost (hardware) against operating cost (energy), real estate cost, and
maintenance/IT personnel cost

• Estimating erosion of market share


• Quick obsolescence of hardware due to innovation = faster competitors
• Market entry when Bitcoin price rises = more competitors

• Replacing hardware and re-selling units into the secondary market for used miners

• Hedging currency risk / storing or liquidating Bitcoin revenue


• Hardware cost in USD
• Power cost in CNY, ISK, or ???
• Revenue in BTC
Bitcoin electricity consumption 250
TWH
PER
200 YEAR
TWH
PER
YEAR

• Bitcoin consumes almost as much energy as Australia per Sorry our


machines are a
year? bit slow
• And for this incredible energy output a bitcoin transaction
still takes 10 minutes – an eternity if you’re buying a cup of
coffee
• Wasteful?
Competition among miners creates the
indelibility of data on a blockchain
• Fraud = rewriting old transactions

• Prohibitively difficult to recreate a block;


nonces must be found for all subsequent blocks
before honest miners code the next block

• Implication: transactions are indelible, but also


irreversible

• What would you do if you were red and had a


17 times faster computer than yellow?

• Incentives guard the protocol: No virus


detective. No army guarding the servers.

• A game theory equilibrium that makes everyone


“row” in the same direction: Admired by
microeconomists everywhere
Source: Mark Montgomery / IEEE Spectrum
Mining strategies
How to overcome huge barriers to entry due to capital cost and smooth out the cash
flows?
• Mining pools
• Syndicates of miners who work
together and agree to share the rewards
• Similar to lottery pools involving many
people who purchase tickets and share
the prizes equally
• Cloud mining
• Using background computing power
that would otherwise be idle
• We could all start a mining pool in
class. What would we do if someone
shows up with a fast laptop?
• Give them a bonus?
• Worry about defection?
Hashrate shares of mining pools
as of 7 July 2022

• To smooth out cashflows miners have centralized


• Oligopaly: This looks like the Australian (or US)
banking competition
• Do they collude?
• Resist adoption of new hardware
• Conspire to not upgrade protocol

• Users join several mining pools to diversify. As


mining pools differ in terms of
• Reward for being a new entrant
• Who gets which reward

https://www.buybitcoinworldwide.com/mining/pools/
Maybe crypto mining is the new gold mining?
Maybe crypto mining is the new gold mining?

The paper is on SSRN soon.


Mining process

1. Exploration
2. Development
Complex

3. Mining
4. Initial processing
5. Refining
Choosing the location

Georgia responsible for 34% of


Foundry’s mining:
- Nuclear/solar power: Cheap
electricity low emission power
- Day ahead prices: A chance
to throttle back operations

• Gold miners require gold to be present in the


country they operate: • Bitcoin miners depend on cheap sources of
• Decentralized: China is the largest gold electricity for their GPUs, low temperature
producer (11 per cent) followed by Australia, for cooling, and favorable legislation.
the Russian Federation, the United States of • 44 percent of Bitcoin mining pools were in the
America and Canada. Asia-Pacific region.
• Competitive: largest 20 gold producers
collectively comprise about 40% of the market
Mining costs

• Costs average US$1000 to US$1500 per ounce • Bitcoin mining requires an up-front cost for
of gold the GPU and then variable costs in electricity.
• Main costs tied up with physical mining and • The cost of a miner is closely related to its
processing. Refining only 1% of costs. profits (accounting for electricity costs).
Supply uncertainty

Gold supply is uncertain: Bitcoin supply is certain:


• In-ground gold estimated • Bitcoin block rewards half every four years such
• Mining activity varies depending on that all bitcoin (21 million) are mined in 2140.
1. technical factors (e.g. geological conditions) and
2. non-technical factors (e.g., legislation and civil
unrest).
Market model

Bitcoin miners exposed to


a. higher stock volatility and
d. Gold firms commodity volatility
correlated with
their commodity
but work as a b. more systematic risk but
hedge c. less idiosyncratic risk.
Decentralized mining in centralized pools
Cong, He and Li (2019)

Long run: Who do you think will mine crypto?


• Social media cloud computing services
• Amazons and googles of the world
• If the reward get big enough then google will
want to be in the business
Organizational issues for mining pools
• Collusion / cartel behavior
• Bitcoin scalability debate amounts to a negotiation among mining pools
• GHash briefly achieved > 51% market share

• Internal governance

• Defection by members

• Potential for vertical integration by hardware manufacturers merging with mining


pools

• Possible market entry by Amazon, Microsoft, and other cloud computing providers
Botnet miners

Botnet miners that “hijack”


your compute to mine crypto.
Ever wondered why your
compute is running slow?

2017 data is for January – August period only


Cloud mining

Other miners:
• Sometimes professor hijack computing power to mine crypto
• Government computing facilities can also do it
• Soviet nuclear engineers where mining crypto instead of
designing weapons with the mainframe.
• People at Langley have also been arrested for doing it
• The incentives are great

Japanese social media company that used their computers to


mine crypto overnight

DMM is an eCommerce company with $700 million in revenue - www.dmm.com


Cost per transaction ($USD)
7 day moving average, block rewards plus mining fees

Lets look at this from on percentage basis:


How much bitcoin volume is put through
https://blockchain.info/charts/cost-per-transaction How much reward is diverted to miner (block reward and fee)
Mining revenue / Value processed
7 day moving average
This is ironic!
The whole reason for Nakamoto was to reduce the fees, but
we’re back to where we started
Are there some market forces that leads to this post outcome?
Some sort of first order condition: You add capacity and mining
cost up to the point you become indifferent between system A
and system B.

2%

https://blockchain.info/charts/cost-per-transaction-percent
Recap questions
• Q1: What are the four layers of the blockchain and what are their functions?
• A1: Consensus-, Compute-, Application-, and User facing layer.
• Consensus layer: parties agree on the state of the chain
• Compute layer: changes the state of the chain
• Application layer: allows for applications to function on the chain
• User facing tool: allows for the user to send messages to the blockchain

• Q2: What are the three consensus protocols (that we discussed) and how do they work?
• A2: PoW, PoS, DPoS
• PoW: An “arms race” with multiple participants that all try to mine a block
• PoS: Only a few individuals with a stake mine blocks
• DPoS: Network choses a few “delegates” that mine blocks
• How many guesses do you need for a nonce with a limit value of 3 leading 0s?
Recap questions
• Q3: How do blockchain communicate with each other? Explain the process chat
一下
• Q4: How are miners remunerated? chat 一下
• Q5: Name three strengths of the bitcoin blockchain
• A5
1. Transparency: The program is public to everyone
2. Verifiability: Everyone can verify that state transitions
3. Trustless: We don’t need to trust third parties as everything is public
• Q6: Can a hacker change something in the blockchain without anyone noticing?
• Q7: Why is it hard (impossible) to hack the bitcoin network?

You might also like