HashLinked Databases and Consensus

Instructors:          Andreas Park & Zissis Poulos
 

 


Rotman – MBA

Silos vs Common Infrastructures

Illustration of Infrastructure Frictions: money transfers

Version 1: They use the same bank

Change ledger entry locally

Version 2: They use different banks but the banks have a direct relationship

Sue's bank transfers from Sue's account to Bob's bank's account

Bob's bank transfers from its account to Bob's account

Version 3: They use different banks that have no direct relationship

Sue's bank transfers from Sue's account to its own account

Bob's bank transfers from its account to Bob's account

Central Bank

Central bank transfers from Sue's bank's account to Bob's bank's account

International transfers

Sue's bank transfers from Sue's account to its own account

Bob's bank transfers from its account to Bob's account

use the Swift network of correspondent banks

Bottom Line

very complex

many parties

lots of frictions and points of failure

very expensive

Crazy thought: Wouldn't it be nice if there was a single ledger?

Existing solutions

Problem:
power concentration/Monopoly

Distributed Ledger/Blockchain Technology

  • A "joint, single system"
  • Features:
    • secure storage of information and transfer of value
    • guaranteed execution of code
  • Promise
    • open platform
    • global reach
    • frictionless finance

How does it all work and why?

How do we establish trust in commerce?

trustworthy People

long-term Relationships

reputation

contract law

institutions

What's needed for trust in  anonymous deals?

Authority

Execution

Continuity

Authority

Do you have the item?

Do you have power over it?

Tool: "key" cryptography

Execution

Can we agree that it happened?

Tool:
consensus algorithm

Security and Continuity

Are the records immutable?

restricted permissions

really difficult to hack

premise of blockchain

no trusted parties needed

everything
in code

open to
anyone

platform or network

commerce thrives

How?

A deep dive into the "How?"

Cryptography: only Sue can spend her money

Authority

Execution

Problem: double-spending

How can we trust that

  1. sale happened and
  2. $$ only spent once?

Execution

Security

B3

B1

B2

B4

B5

Contains transaction from Sue to Bob

Question: Can Sue rewrite history?

immutability

No! Because: Economics!

Incentive to support longest Chain

B3

B1

B2

B4

B5

B6

Where to add a new block B7?

  • Add to B3?
    • => people after still more likely to add to B6
    • lose "coinbase" reward

Altering the past?

B3

B1

B2

B4

B5

  • needs to be faster than anyone after who adds to B5 and build a longer chain
  • or needs to be able to mine repeatedly

B8

B7

B9

B10

B6

Contains transaction from Sue to Bob

Sue wants to undo the transaction by rewriting history with B6

Sue's objective

  • Wants to undo this trade and cheat Bob by building alternative chain from B6

What does it take?

  1. needs to be predictably able to add several blocks to the chain without interference, or
  2. needs to be faster than anyone after who adds to B5 and build a longer chain, or
  3. needs to ability to reject new blocks that are added to B5 .

How does Proof of Work prevent this?

  • mining success is random subject to resources spend:
    • computers/GPUs
    • electricity
  • you need faster/more computers than 51% of the network
    • current network power: 150million tera-hashes per second (blockchain.info)

Back of the envelope calculation

  • hashrate: 150,000,000 TH/s
  • best hardware (ASIC) has 110TH/s per unit
  • => need 150,000,000 / 110 x 0.5 = 682,000 ASICs
  • 1 ASIC costs around $10,000 (conservative)
  • =>Cost = $6,820,000,000
  • But it doesn't end here...Power consumption at 4.5GW
  • => enough to power 1M homes in the US

Economic Analysis, Part II

Double spend attack prevention

  • Validation rewards are taken as given, but they are crucial in
    • determining incentives to participate,
    • to support the chain, and
    • to expense electricity and computing power

Basic idea of competitive equilibrium

aggregate mining cost = aggregate reward

Double spending attack

  • expense resources but:
  • win N block rewards until "confirmation" block
  • ability to double-spend

condition that prevents it

(Chiu & Koeppl RFS 2018)

 

 

\text{mining reward} \times (N+1)N > \text{double spend amount}

How do you agree though that something happened, or, what is consensus?

How can we reach consensus? The Byzantine Generals' problem

How can we reach consensus? The Byzantine Generals' problem

Blockchain proof of work establishes consensus

Byzantine Generals' Problem

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(x\)

\(t\)

\(t\)

\(t\)

\(t\)

\(t\)

\(x\)

\(t,t,x\)

\(t,t,x\)

\(t,t,t\)

consensus is reached!

Byzantine Generals' Problem

\(x\)

\(y\)

\(z\)

\(y\)

\(x\)

\(z\)

\(y\)

\(x\)

\(z\)

\(x,y.z\)

\(x,y,z\)

\(x,y,z\)

consensus is reached (no attack)

Byzantine Generals' Problem

Equilibrium

  • generals pick majority message
  • successful consensus as long as no more than 1/3 cheats

Blockchain requirement

  • reach Byzantine Fault Tolerant consensus
  • trick: messages are hard to forge

Byzantine Generals' Problem

Proof of Work Protocol

A Byzantine Fault Tolerant Algorithm

This Hash starts with a pre-specified number of zeros!

Blockchain BFT

= 00000xd4we...

= 00000xd4we...

= 00000xd4we...

consensus is reached if hash starts with right number of leading zeros

PoW does two things

- selects a leader

- makes messages hard to forge

Blockchain BFT

Proof-of-Stake

Proof of X

Proof of Stake (PoS) - What is the goal?

  • Energy efficiency
    • ​No need to commit extreme compute power to solve puzzles for leader election (PoW)
  • Centralization Risk
    • Can validate using simpler hardware -> more nodes can participate to validate network
  • Economic cost of attacks​
    • Explicit penalties for misbehaviour (vs. PoW)

 

Validation and leader election

random

32 ETH

Validation and leader election

random

random

random

Committee 1

Committee 2

random

Block formation

Committee 1

Committee 2

...

Committee 32

attest

attest

Slot 1

Slot 2

Slot 32

...

12 seconds

Finality!

...

checkpoint

...

vote

vote

When final?

2/3 of stake has voted

Security

What do we need from validators?

  1. Participation
  2. Honesty

if "lazy"

misses out on rewards

if dishonest

Security

What is dishonest?

  1. Propose multiple blocks for single slot
  2. Contradictory attestations

TLDR

Performing a 51% attack still possible but "almost equivalent to having your entire mining farm burn down while you are doing it" -Zamfir

Other malicious behaviour

  1. Long-range attack
  2. Short range reorgs (can be bad for DeFi)
  3. etc.

What about forks??

Still possible

  1. Need agreement on what the canonical chain is
  2. Longest-chain rule not ideal. Why?

B3

B1

B2

B4

Protocol Rule

"The canonical chain is the one with greatest weight of attestations in its history"

PoS vs PoW

https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/

PoS vs PoW Economics

Basics:

validators receive:

  • coinbase rewards
  • "tips" = fees attached to transactions
  • NB: since London fork fees have two parts:
    • manatory (>0 needed for code processing) => gets burned
    • tips => fees to validators
  • coinbase rewards are inflationary/dillution
    • shifts chain value from everyone to validator

PoS vs PoW Economics of Coinbase Rewards

  • PoW:
    • coinbase reward go to outside party for performing a service
    • proportional to resources committed
  • PoS:
    • fees go to existing coin holders for "community service"
    • proportional to stake

 

PoS Economics of Coinbase Rewards

Question: do the rich get richer?

  • No
  • same idea as in investment: wealth shares in the economy grow proportional to risk-taking
  • Here: wealth shares are a Martingale
    • convergence to distribution that mimics the initial distribution
    • mathematical concept: Polya's Urn

 

Intution

  • Two validators A, B with 20%/80% of coins
  • Assume
    • 1,000,000 at the begining of the year
    • 1,000,000 issued during the year
  • Ownership at the beginning of year
    • A owns 200,000 coins
    • B owns 800,000 coins
  • A gets selected 20% of the time, B 80%
    • => A earns ~200,000 coins
    • => B earns ~800,000 coins
  • Ownership at the beginning of year
    • A owns 400,000 coins = 20%
    • B owns 1,600,000 coins = 80%

PoS Other Questions

  • Is PoS an equilibrium?
    • Yes: Saleh RFS 2019
  • Is verification an equilibrium?
    • Tricky!
    • Biais et al (WP 2022)
    • If everyone verifies, there is no incentive to verify! => Why spend the resources?
    • But: can construct a mechanism such that only valid blocks are produced.
    • Requires making validators pivotal
  • Are higher staking rewards always better?
    • John, Rivera, Saleh (WP 2022): not necessarily, can make long-term investment less attractive
  • Is scaling a problem?
    • limited capacity: validators earn more fees
    • increasing capacity
      • under PoW: lowers fees and reduces incentives for miners  => security \(\searrow\)
      • under PoS: increases demand for blockchain => value of chain => security \(\nearrow\)

What can it for finance, what are problems and obstacles?

Evolution

  • blockchain 1.0
  • first solution to double spending
  • clunky, slow, expensive
  • huge following and computing power

vs

  • blockchain 2.0
  • smart contract platform
  • highly flexible
  • foundation for many private initiatives
     

"Let me just say how impressed I am with Ethereum...If Bitcoin is email ––a one-trick pony, so to speak, but obviously revolutionary–– Ethereum goes far beyond that; it's more like the Internet...The whole idea of DeFi really is, number one, it’s obviously revolutionary, and I think at the end of the day could lead to a massive disintermediation of the financial system and the traditional players."

Heath P. Tarbert, CFTC Chairman, October 2020

cryptocurrency = 

internal payment mechanism to pay for operation of a blockchain

With Blockchain: single ledger for money and securities

0xA69958C146C18C1A015FDFdC85DF20Ee1BB312Bc

0x91C44E74EbF75bAA81A45dC589443194d2EBa84B

0xA65D00Eda4eEB020754C18e021b1bF4E66C9Ed90

Usage of blockchain in financial industry

Areas of applications

moving value (remittances)

digital money: real-time settlement, reduced reserves

tokenization of assets

automization of contract payments

securitization

systems and infrastructure reorganization

digital identity

new forms of financial contracts, assets, and forms of financing

What Changes in Business Models can Blockchain Technology bring?

What does blockchain do?

peer to peer value transfers

self-powered platforms

contract execution

disintermediation

Who do you dis-intermediate, and then who is your customer?

issuer

investor

broker-dealer

The Business challenge of dis-intermediation

investment advisor

Private Sector Solutions

Private vs. public

some key questions

Who gets to update?

Can a higher body prevent
transactions?

Can the past be altered?

consensus

immutability

censorship resistence

Public Blockchains provide

Main private blockchain systems

Features of Private vs. public blockchains

open to anyone

no one can be excluded

past cannot be changed

Public Blockchains

private Blockchains

high visibility of transactions

open-access eco-system

slow governance

privacy only at a cost

joint control and governance

straightforward KYC and AML

tech support

transaction secrecy simpler

rely on corporate development

compliance with law (reversion)

can keep competition out

Enter BigTech

cellphone data from 2018 (NewZoo), inflation from 2020 (World Population Review)

Evolution

DIEM = "new financial infrastructure"

Why does BigTech enter the finance game?

They have ZERO interest in becoming a financial institution/bank

\(\rightarrow\) no expertise

\(\rightarrow\) competitive market

\(\rightarrow\) one of the most regulated business environments

My take

They are trying to deal with frictions that impede their business

They aim to collect data which will vastly improve their business

Lay the groundwork for the next step of the digital evolution: the "Metaverse"

Key Challenges for the blockchain Community for 2019

Technology

Legal/Regulation

Economic functions

What is the right governance structure for systems?

How should we design tokens as contracts?

How do platform payment means interact with outside world

How much do we have to pay operators to maintain the chain?

Key Economic Questions for Blockchain Design

Key Technology Questions for  Blockchain Design

interoperability

cybersecurity and privacy

functionality

scalability

smart contract features and verification

space constraints

Solution projects to Key Technology Questions

interoperability

scalability

space constraints:

Does the law have to change to accommodate new tech? If so, how? What's dated, what's not?

Key Legal Questions for  Blockchain Design

Legal setup of a platform: what rules can, should, and must a platform establish? What regulations are necessary?

How can token design and the law be married?

Questions for the future

What is the economic impact of "tokenizing everything"?

How will it affect investments and investment banking?

Which business opportunities will it enable?

What do tokens and "alternative money" mean for payments?

quick comparison

FinTech vs. Defi

FinTech

DeFi

  • more user-friendly UX
  • more customer-oriented
  • less squeezing/rent-extraction
  • more competive services
  • more innovative services
  • currently: horribly user-unfriendly
  • "blowing up the banks"
  • fundamental re-thinking of financial services
  • lots of scams, cowboy-attitude towards laws

innovation vs. salesmanship

main focus

Conclusion and final thoughts

blockchain is a transformative technology, but won't be used in practice overnight

many conceptual and technological challenges remain, but there are already various areas of application

legal, regulatory, and competitive changes are needed and then the opportunities are endless ...

it will open up the banking world further, foster international competition, and change how we pay and exchange value

My view: business development will happen in private/semi-public space; strong increase in recent activity; no more testing but re-engineering of processes.

@financeUTM

andreas.park@rotman.utoronto.ca

slides.com/ap248

sites.google.com/site/parkandreas/

youtube.com/user/andreaspark2812/

BlockchainTech: Hash-linked Databases and Consensus Protocols

By Andreas Park

BlockchainTech: Hash-linked Databases and Consensus Protocols

This is the slide deck that I use for a quick introduction to the Decentralized Finance class.

  • 287