This textbook focuses on distributed ledger technology (DLT) and its potential impact on society at large. It aims to offer a detailed and self-contained introduction to the founding principles behind DLT accessible to a well-educated but not necessarily mathematically oriented audience. DLT allows solving many complicated problems arising in economics, banking, and finance, industry, trade, and other fields. However, to reap the ultimate benefits, one has to overcome some of its inherent limitations and use it judiciously. Not surprisingly, amid increasing applications of DLT, misconceptions are formed over its use. The book thoroughly dispels these misconceptions via an impartial assessment of the arguments rooted in scientific reasoning. Blockchain and Distributed Ledgers: Mathematics, Technology, and Economics offers a detailed and self-contained introduction to DLT, blockchains, and cryptocurrencies and seeks to equip the reader with an ability to participate in the crypto economy meaningfully.
Author(s): Alexander Lipton, Adrien Treccani
Edition: 1
Publisher: World Scientific Publishing
Year: 2021
Language: English
Pages: 480
Tags: DLT; distributed ledger technology; blockchains; cryptocurrencies;
Blockchain and Distributed Ledgers: Mathematics, Technology, and Economics
Half Title Page
Title Page
Copyright Page
About the Authors
Contents
List of Figures
List of Tables
List of Abbreviations
Preface
Chapter 1: Background
1.1 Introduction
1.2 Distributed ledgers in a nutshell
1.3 A retrospective view
1.4 A perspective view
1.5 Book’s structure
1.6 Summary
1.7 Further reading
Chapter 2: The Global Financial System and its Pain Points
2.1 Introduction
2.2 Money in retrospective and perspective
2.2.1 The role of money
2.2.2 Money as objects
2.2.3 Paper money
2.2.4 Anti-counterfeiting measures
2.2.5 Money as records
2.2.6 Money and inflation
2.2.7 BIS taxonomy of money
2.2.8 Where does money come from?
2.3 How the financial system operates at the moment
2.3.1 Current situation
2.3.2 Challenges faced by the current financial system
2.3.3 Detailed analysis of money creation
2.3.4 Negative interest rates
2.3.5 Banking regulations and monetary stability
2.3.6 The pros and cons of the current system
2.4 Domestic payments
2.4.1 The protagonists
2.4.2 Settlement
2.4.3 Credit card payments
2.5 Cross-border payments
2.5.1 Cross-border transactions and correspondent banking
2.5.2 Forex trading
2.5.3 Informal funds transfer systems
2.6 Blockchain payments
2.7 Summary
2.8 Exercises
Chapter 3: A Primer on Cryptocurrencies and Distributed Ledgers
3.1 Introduction
3.2 Distributed identity
3.2.1 Legal identification
3.2.2 Digital identification and wallets
3.3 Decentralized network
3.3.1 Client-server model
3.3.2 Peer-to-peer model
3.3.3 Network nodes
3.3.4 Bootstrapping of a node
3.4 Distributed ledger
3.4.1 Permissioning framework
3.4.2 Blockchain data structure
3.5 Double spending
3.5.1 Illustration in a centralized setup
3.5.2 Illustration in a decentralized setup
3.6 Network consensus
3.6.1 Sybil attacks
3.6.2 Digital work with a proof-of-work
3.6.3 Building the chain
3.6.4 Block rewards and miners
3.6.5 A computational power race
3.6.6 Difficulty under competition
3.6.7 Forks and consensus chain
3.6.8 The 51% attack
3.6.9 Confirmations and finality
3.6.10 The limits of proof-of-work
3.6.11 Staking as an alternative to working
3.7 Path to the after-Bitcoin
3.7.1 Pizza day
3.7.2 Silk Road
3.7.3 Altcoins
3.7.4 Ethereum and smart contracts
3.7.5 Tokenization
3.7.6 Initial coin offerings
3.7.7 Decentralized finance and autonomous organizations
3.8 Summary
3.9 Exercises
Chapter 4: Essential Cryptographic Tools
4.1 Introduction
4.2 Symmetric key cryptography
4.2.1 Introduction
4.2.2 Caesar’s cipher
4.2.3 Affine cipher
4.2.4 A simple substitution cipher
4.2.5 The Vigenère cipher
4.2.6 The Enigma machine
4.2.7 A one-time pad
4.2.8 A stream cipher
4.2.9 Data encryption standards
4.3 Asymmetric key cryptography
4.3.1 Introduction
4.3.2 Cryptographic one-way functions
4.3.3 Abstract encryption-decryption algorithm
4.3.4 Abstract digital signature algorithm
4.3.5 Abstract secret-sharing algorithm
4.4 Elements of number theory
4.4.1 The set of integers modulo
4.4.2 The Euclidean algorithm
4.4.3 The extended Euclidean algorithm
4.4.4 Fermat’s little theorem
4.4.5 Euler’s theorem
4.5 Finite ring cryptography
4.5.1 Modular exponentiation
4.5.2 A good trapdoor function?
4.5.3 A good trapdoor function!
4.5.4 RSA encryption-decryption algorithm
4.5.5 RSA digital signature algorithm
4.5.6 Blind digital signature algorithm
4.5.7 Chaum’s anonymous cash
4.6 Finite field cryptography
4.6.1 Definitions
4.6.2 Primitive roots
4.6.3 ElGamal encryption algorithm
4.6.4 ElGamal digital signature algorithm
4.6.5 Schnorr digital signature algorithm
4.6.6 Diffie-Hellman key exchange
4.7 Elliptic Curve Cryptography
4.7.1 Continuous elliptic curves
4.7.2 Historical aside
4.7.3 Addition on elliptic curves
4.7.4 Projectivization of elliptic curves
4.7.5 Multiplication on elliptic curves
4.7.6 Discrete elliptic curves
4.7.7 The discrete log problem on elliptic curves
4.7.8 The standard elliptic curve secp256r1
4.7.9 Elliptic curve digital signature algorithm
4.7.10 Elliptic curve Schnorr digital signature algorithm
4.7.11 Diffie-Hellman key exchange
4.8 Comparison of different digital signature algorithms
4.9 Cryptographic hash functions
4.9.1 Hash functions
4.9.2 Collision-resistant hash functions
4.9.3 Signatures and hash functions
4.9.4 Signatures and birthday attacks
4.9.5 The random oracle hash
4.9.6 A practical hash function
4.9.7 Search puzzles and hash functions
4.9.8 Other uses of cryptographic hash functions
4.9.9 Iterative hash function with padding
4.10 Secure hash algorithms
4.10.1 Background
4.10.2 MD5
4.10.3 SHA-256
4.10.4 RIPEMD-160
4.11 Merkle trees and hash pointers
4.11.1 Merkle trees
4.11.2 Hash pointers and chain signatures
4.11.3 Chain signatures combined with Merkle trees
4.12 Quantum-resistant cryptography
4.13 Summary
4.14 Exercises
Chapter 5: Bitcoin — A Deep Dive
5.1 Introduction
5.2 Bitcoin addresses
5.3 Transactions
5.3.1 Distributed ledger accounting
5.3.2 Bitcoin transactions and mathematical induction
5.3.3 Transaction structure
5.3.4 Transaction scripts
5.3.5 Transaction verification
5.3.6 Representative transactions
5.3.7 Transaction broadcast
5.3.8 The Coinbase transaction
5.4 The Bitcoin ecosystem
5.4.1 Full node
5.4.2 Simplified payment verification node
5.4.3 Wallet
5.4.4 Solo miners
5.4.5 Mining pools
5.4.6 Exchanges
5.4.7 Bitcoin tumblers or mixers
5.5 Mining
5.5.1 Consensus
5.5.2 How Bitcoin rewards miners?
5.5.3 How do miners mine?
5.5.4 Mining difficulty
5.5.5 Pooling of resources
5.5.6 Malicious attacks
5.5.7 Soft and hard forks
5.5.8 Growing blockchain by induction
5.6 Anatomy of Block 600,000
5.7 Bitcoin pros and cons
5.8 Summary
5.9 Exercises
Chapter 6: Ethereum — A Distributed World Computer?
6.1 Introduction
6.2 Similarities and differences between Bitcoin and Ethereum
6.3 A more centralized protocol?
6.4 Ethereum account types
6.5 The Ethereum Virtual Machine
6.6 Transfers and smart contract calls
6.7 Consensus
6.8 Smart contracts
6.8.1 Definitions
6.8.2 Example — A forward contract
6.8.3 Advantages and disadvantages of smart contracts
6.8.4 Oracles
6.9 Applications of Ethereum smart contracts
6.9.1 Potential use cases
6.9.2 Tokens and token standards
6.9.3 Crowdfunding via initial coin offerings
6.9.4 Stablecoins
6.9.5 Automated market makers
6.9.6 Decentralized autonomous organizations
6.10 Summary
6.11 Exercises
Chapter 7: Ripple — A Simple Solution to a Complex Problem?
7.1 Introduction
7.2 Ripple protocol
7.3 Applications
7.4 Summary
7.5 Exercises
Chapter 8: Central Bank Digital Currencies and Stablecoins
8.1 Introduction
8.2 Narrow banks
8.2.1 A brief history
8.2.2 Possible designs of a narrow bank
8.3 CBDC
8.3.1 Central banks as issuers of CBDC
8.3.2 Narrow banks as issuers of CBDC
8.3.3 Technical considerations
8.4 Stablecoins
8.4.1 Background
8.4.2 Stablecoins fully collateralized with fiat
8.4.3 Coins partially collateralized with fiat
8.4.4 Coins (over)collateralized with crypto
8.4.5 Dynamically stabilized coins
8.5 Digital trade coins collateralized with assets
8.5.1 General considerations
8.5.2 How to build a DTC
8.6 Summary
8.7 Exercises
Chapter 9: Wallets and Key Management
9.1 Introduction
9.2 General wallet architecture
9.2.1 Necessary components
9.2.2 Network node
9.2.3 Blockchain indexer
9.2.4 Wallet application
9.2.5 Keystore
9.3 Wallet genesis
9.3.1 Key space
9.3.2 Brain wallet
9.3.3 The need for entropy
9.3.4 A concrete collision attack
9.3.5 True random number generators
9.4 Deterministic key derivation
9.4.1 The need for multiple keys
9.4.2 The original Bitcoin Core approach
9.4.3 BIP32
9.4.4 BIP44
9.4.5 Extensions to BIP32
9.5 From mnemonic to seed
9.5.1 Export and human-readability
9.5.2 BIP39
9.6 The relativeness of security
9.6.1 Custodial wallet services
9.6.2 A practical example
9.6.3 The Binance hack
9.6.4 The QuadrigaCX fraud
9.7 Key isolation and transaction approval
9.7.1 Security ingredients
9.7.2 Hot and cold storage
9.7.3 Four-eyes principle
9.7.4 Off-chain validation
9.7.5 On-chain validation
9.7.6 Multi-party computation
9.8 Summary
9.9 Exercises
Chapter 10: Cryptocurrencies and Quantitative Finance
10.1 Introduction
10.2 Can cryptocurrencies be viewed as money?
10.3 Do fair prices of cryptocurrencies exist?
10.4 Distribution of daily BTC returns
10.5 Distribution of yearly BTC returns
10.5.1 The Fourier transform
10.5.2 Monte Carlo simulations
10.6 Distribution of daily ETH, XRP, and MRKT returns
10.7 Comparative statistics of cryptocurrency returns
10.8 Cryptocurrency ecosystem and its ecology
10.9 BTC valuation models
10.10 Bitcoin dominance index
10.10.1 The SIR model
10.10.2 The SIS model
10.11 Automated market makers
10.12 Summary
10.13 Exercises
Chapter 11: Current Research Topics
11.1 Introduction
11.2 Intraand interoperability
11.2.1 Background
11.2.2 Intraoperability
11.2.3 Interoperability
11.3 Privacy
11.3.1 Background
11.3.2 Payment channels
11.3.3 Coin mixing
11.3.4 Built-in cryptographic obfuscation
11.4 Scalability trilemma
11.4.1 Background
11.4.2 Current transactional banking model: scalable + secure
11.4.3 Current crypto model: decentralized + secure
11.4.4 Future fintech model: decentralized + scalable + secure
11.5 Summary
11.6 Exercises
Chapter 12: Present and Future of DLT
12.1 Introduction
12.2 Financial Services
12.2.1 Accounting and audit
12.2.2 Global payments
12.2.3 Progammable money
12.2.4 Regulations
12.2.5 Trade execution, clearing and settlement
12.3 Government
12.3.1 Identity
12.3.2 Voting
12.4 Healthcare
12.4.1 Electronic health records system
12.4.2 Research
12.4.3 Supply chain
12.5 Supply chain
12.5.1 Supply chain management
12.5.2 Trade finance
12.6 Tokenization of real assets
12.7 Summary
12.8 Exercises
Bibliography
Name Index
Subject Index