Slides from my intro course:
- mapping the digital asset ecosystem (as of August 2019)
- how bitcoin works - step-by-step primer?
- hashrate, dollar value transferred, transaction rate and other metrics (as of August 2019)
- hard money, uncorrelated asset and other use cases
- proof-of-stake and proof-of-identity
- horizontal and vertical scaling
- how ethereum smart contracts work?
- ERC20 token standard
- boom and bust of the ICO market (as of August 2019)
- intro into #DeFI (as of August 2019)
- stablecoins
- MarkerDAO, Compound, Uniswap and other cool decentralized finance protocols
- Cryptokitties, Storj, Peepeth and examples of non-financial dapps
8. "I think that the Internet is going to be one
of the major forces for reducing the role of
government. The one thing that’s missing,
but that will soon be developed, is a
reliable e-cash, a method whereby on the
Internet you can transfer funds from A to
B, without A knowing B or B knowing A"
Milton Friedman, a Nobel Prize Laureate in
Economics (1999)
9. • You are not able to physically give a coin or a bill to two
people at the same time
• Electronic payment system should be able to prevent
double spending, because it is easy to copy electronic
records
• The centralized payment system is based on a trusted
middleman (bank, central bank, PSP, etc.)
The double spending problem
10. The challenge:
• Develop a secure and reliable method for updating a
public ledger of which there are myriad copies
distributed throughout the world
• Create the necessary incentives for users to
contribute resources to verifying transactions
The double spending problem
14. Step 1 — Agreement on transaction
Alice is a private person who has bitcoins
Bob is an entrepreneur who sells digital content online and
accepts bitcoins
Alice agreed with Bob to purchase a digital art object for 0.05 BTC
How it works…
16. Step 2 — Creating a transaction message
Alice creates a message that contains:
• A link to previous transactions in which she received bitcoins
• Recipient address (Bob's address) and
• The amount to be paid
...and may contain other conditions (e.g. time delay)
How it works…
19. Step 2 — Creating a transaction message
Inputs:
• 0.1 BTC from Alice.
Outputs:
• 0.05 BTC to Bob
• 0.0001 BTC is a fee for transaction validation
• 0.0499 BTC is a change back to Alice's address
How it works…
22. Step 3 — Signing a transaction
As soon as the message is created, Alice signs it to prove that she
manages the sender's address.
Alice encrypts the message with her private key.
This message can be decrypted with a public key, which is also
sent with the transaction.
How it works…
24. Step 4 — Broadcasting
Alice distributes her message over the network to validate.
How it works…
https://blockchain.info/address/1DgM5xyFxUyAVrAhxR1KY2r5uyiGXrKmGc
25. Validating nodes (miners) are organized into a peer-to-peer network.
The message propagates along the fastest path from the node to its
closest neighbors…
How it works…
26. On average, 8-10 thousand full nodes are active daily
How it works…
27. The first 1,000 nodes receive a transaction in 2 seconds on the average…
How it works…
29. The number of transactions in the mempool can be up to 20,000 or more
How it works…
https://www.blockchain.com/charts/mempool-count
30. Step 5 — Transaction verification (mining)
Miners receive Alice's transaction and add it along with other
transactions to the candidate block.
Miners compete with each other who will verify the new block
faster.
Verification of the block means:
• Validation of transactions in the block
• Reaching consensus
How it works…
31. Reaching consensus is a time-consuming process and requires
from each miner to demonstrate computing resources, the so-
called work (Proof of Work, PoW).
How it works…
Hashrate ~80 . 1018 H/s
500x top supercomputer
32.
33. How it works…
Mining allows you to reach consensus on what transactions took place
and in what order.
When branching (forking), the
chain will be selected, which has
the largest amount of work for
the verification, i.e. the longest
one
34. Step 6 — Success
Clara is a miner, who successfully verified the block with Alice's
transaction, receives a reward for the extracted block (12.5 BTC),
as well as a commission for the block's transactions.
Clara spreads her output among other miners and they add this
block to the chain.
Bob receives confirmation that the payment has been sent by Alice
and initiates the delivery.
How it works…
35. How it works…
The first 1,000 nodes receive a block in 1.1 seconds on the average…
40. 12.5 BTC is a block award, 6 blocks
per hour => 1,800 BTC are issued daily
($18m)
Halving every ~4 years, maximum of
21 million BTC
17.89 million BTC issued =>
Mcap = $10k * 17.89 million = $178b
Mining
44. Use cases
Alternative payment system: ~600k daily active addresses
https://bitinfocharts.com/comparison/bitcoin-activeaddresses.html
45. Use cases
Store of value
Bitcoin Gold Cash Bank deposit
Durable
Portable
Fungible
Verifiable
Divisible
Scarce
Established history
Censorship resistant
50. Use cases
Purchase of illegal goods (~10% of payments)
https://papers.ssrn.com/abstract=3102645
Foley, Sean et al. Sex, Drugs, and Bitcoin: How Much Illegal Activity Is Financed
Through Cryptocurrencies? (January 15, 2018).
51. Use cases
Gateway to crypto + unit of measure for crypto-assets
https://coinlib.io/exchange/bittrex
54. • Killer app – money
• Open protocol, everyone can participate
• Operates without trusted parties, censorship is not possible
• Strong cryptography and PoW energy secure network
• Transactions are (pseudo-)anonymous
• Fungible, divisible, portable, scarce (!)
• High price volatility: >3% / day
• Poorly scalable: <10 tps
Summary
58. Proof-of-Stake
• NXT (2012)
• Ouroboros (Cardano)
• Casper (Ethereum)
• Algorand
• Based on staking
• Lower energy consumption
• Wider attack surface
59. Proof-of-Identity
• Idena (2019)
• Time-synced Turing test
• 1 human = 1 vote
• Use cases: governance,
serverless messenger, direct
marketing
Filter for Live Intelligent People (flip)
61. Permissioned blockchains
Permissionless Permissioned
Bitcoin, Ethereum, ZCash,… Fabric, Quorum, Corda, Libra
Open access (PoW, PoS, …) Membership (consortium)
Many validators Few validators
Wide range of users Small range of users (B2B)
Relatively low performance Relatively high performance
Managed by ecosystem Managed by stakeholders
“Internet” “Intranet”
The subject of this course is open (public) protocols and crypto markets
62. Vertical scaling
Lightning Network
• Micro-payment channel network (Level 2)
• Many hubs with many open channels
• A channel is a multisig address with a frozen collateral
• Micro-payments are made as the exchange of commitment transactions
(off-chain), payments can be locked between hubs
• Any party can close the channel by publishing the last transaction and
receiving the balance to his or her address
Joseph Poon, Thaddeus Dryja. The Bitcoin Lightning Network:
Scalable Off-Chain Instant Payments, 14 Jan 2016
https://lightning.network/lightning-network-paper.pdf
63. Vertical scaling
Advantages:
• The transactions are carried out in milliseconds
• Safety is guaranteed by blockchain
• Does not require trust between the participants
• Scalability is up to 1 million per second or more
• Low transaction costs
• The possibility to carry out micro-transactions (<$1)
• Crosschain atomic swaps, non-custodial DvP trading
66. Vertical scaling
Disadvantages:
• Opening and re-opening channels requires transaction costs
• The hub needs to keep the frozen capital in the channels
https://www.trustnodes.com/2019/08/20/guy-makes-20-a-month-for-locking-5-
million-worth-of-bitcoin-on-the-lightning-network
• The average amount of collateral in the channels is small ($20), payments
over $5 can be a problem
• "Sending payments using the Lightning Network is cheaper than the regular
Bitcoin network, but suffers from routing errors and wallet bugs that make it
impractical even for highly technical users” https://news.bitcoin.com/a-look-
at-what-it-was-like-to-operate-the-lightning-networks-largest-node/
67. • Bank of England – The emergence of digital currencies (2014)
http://www.bankofengland.co.uk/publications/Documents/quarterlybulletin/2014/
qb14q3digitalcurrenciesbitcoin1.pdf
• WEF – The future of financial infrastructure (Aug 2016)
http://www3.weforum.org/docs/WEF_The_future_of_financial_infrastructure.pdf
• D.Fantazzini, E.Nigmatullin, V.Sukhanovskaya, S.Ivliev. "Everything you always
wanted to know about bitcoin modelling but were afraid to ask". Applied
Econometrics (2017) https://mpra.ub.uni-muenchen.de/71946/
• European Parliament. “Virtual currencies and central banks monetary policy:
challenges ahead” (2018)
http://www.europarl.europa.eu/cmsdata/149900/CASE_FINAL%20publication.pdf
• J.Song. “Why blockchain is hard” (2018) https://medium.com/@jimmysong/why-
blockchain-is-hard-60416ea4c5c
• http://www.mas.gov.sg/News-and-Publications/Speeches-and-Monetary-Policy-
Statements/Speeches/2018/Crypto-Tokens-The-Good-The-Bad-and-The-Ugly.aspx
Useful links
69. Smart contracts
Unlike Bitcoin, which stores only the
transaction log (UTXO = Unspent
Transactions Output), Ethereum stores
both transactions and ledger states.
In addition to ledger state (balances),
Ethereum can store the state of smart
contract variables.
Technical details
https://hackernoon.com/getting-deep-
into-ethereum-how-data-is-stored-in-
ethereum-e3f669d96033
70. Smart contracts
Smart contracts are created in a high-
level language (Solidity),
they are then compiled into low-level
machine code (bytecode).
Bytecode is loaded into Ethereum by
sending a transaction of a special type
using "Contract creation".
The loaded smart contracts can be
performed on the Ethereum Virtual
Machine (EVM).
https://etherscan.io/addres
s/0xbdf6a89f7c50b15d6b9
b6f35dba58fc240c1bb89#
code
71. Smart contracts
The Ethereum Virtual Machine
(EVM) is a decentralized
computer that can process
smart contracts, confirming the
changed state of variables on
the blockchain.
All EVM nodes perform smart
contract and validate a definite
output.
72. Smart contracts
The code is executed up to 100
times slower than locally
The cost of using memory and
storage is at the level of 50-ies of
the 20th century
The outputs can be changed in the
first 60 seconds
73. Smart contracts
It is the world's first single
computer for the entire planet
It cannot be stopped and it is
independent of states and
corporations
Available wherever there is
Internet
It can perform any calculation that
is possible to perform (Turing
completeness), including infinite
loops
74. Smart contracts
Gas is a metric to evaluate and limit the use of resources for the EVM. Each
operation (command, variable, etc.) requires a certain amount of gas.
The more there are calculations and storage use, the more gas is required.
When calling any smart contract function, the sender should specify GasLimit and
GasPrice.
If the transaction goes out of GasLimit, it will fail, but a fee will be charged to the
sender:
Fee = Amount of Gas * GasPrice
77. #DeFi
Decentralized Finance (#DeFi) is the
movement that leverages open source
software and decentralized networks to
transform traditional financial products into
trustless and transparent protocols that
operate without unnecessary intermediaries.
Among its core principles are transparency,
accessibility and financial inclusion.
Decentralized Finance participants are able to
reduce counterparty risk via cryptographic
verification on public blockchains.
79. Tokens
ERC20 Tokens
ERC = Ethereum Request for
Comment
Standard interface to call
such functions as checking
balance, transfer and
withdrawal of tokens
https://github.com/ethereum/ei
ps/issues/20
The vast majority of
Ethereum tokens is
compatible with this
standard
Matrix of balances:
{0x1, 100; 0x2, 250; 0x3, 0,….}
Token transfer function:
transferFrom (0x2, 0x3, 100) will change the state
of the balances variable as follows:
It was {0x1, 100; 0x2, 250; 0x3, 0,….}
It is now {0x1, 100; 0x2, 150; 0x3, 100,….}
Balance inquiry function:
balanceOf(0x2) will give 250 back
89. Dai: Stablecoin + Borrowing
MakerDAO
$78 mln Dai issued
1.3 mln ETH locked in
collateral (1.29% of ETH)
Collateral ratio 320%
13.9k CDPs
105k Dai Holders
~20% lending rate
https://mkr.tools/system
90. xDai: Stablecoin Payments
xDai
Sidechain with 4 validators
2-way bridge to Ethereum (POA)
5s block time
Capacity up to 1500 tps
13k xDai addresses
<$0.001 fee per tx paid in Dai
ZK for privacy (AZTEC)
https://poa.network/xdai
91. Borrowing & Lending
Compound, InstaDapp,
Dharma, dYdX, Nuo
$129m value locked
396k ETH locked in
compound as collateral
(0.37% of ETH)
92. Borrowing & Lending
Compound
Deposits are tokenized
as cTokens (e.g.cDai)
Rate of cToken to
underlying asset varies
with the interest rate
Interest rate varies
dynamically with supply
& demand
Interest accrued ~15s
99. Summary
• Bitcoin wholesale payment and SoV (aka digital gold) is a strong use case
• Ethereum DeFi is vibrant, but still a proof of concept
• Advantages:
- Inclusive (zero KYC, no censorship)
- Non-custodial (no counterparty credit risk)
- Transparent and price efficient
- Global, low cost, fast finality
• Disadvantages:
- Overcollateralized (doesn’t help unbanked to get loans)
- Technical barrier (e.g. Metamask, keys, …)
- Bridge problem
- Still in beta
100. Useful links
A curated list of awesome decentralized finance projects, software, and resources.
https://github.com/ong/awesome-decentralized-finance
DeFi metrics
https://defipulse.com/
Binance Research report on DeFi
https://info.binance.com/en/research/marketresearch/defi-1.html
102. Collectibles
Cryptokitties
Digital collection
Slowed down the Ethereum
network: 14k DAU, $12
million (11.12.17)
The collection includes over
900 thousand tokens
The ERC-721 standard (Non-
fungible token, NFT) for
digital assets created
VC (2018): $12 million (a16z)
Dragon
600 ETH
(~$170,000)
103. Markets
> 1.2 million token cryptocollectibles (game characters, digital art, etc.)
VC (2018): $2 million (YC)
104. Prediction markets
Augur, Stox
Betting on the outcome of
sports, political and
economic events
Bets and payouts in tokens
and ETH
Competitors: Augur, Gnosis
ICO (2018): 147k ETH
(~$33m, 34 hours)
106. Fog Computing
SONM
p2p-marketplace of computing
capacity
Machine learning
Video rendering
Web hosting service
Scientific computing
and so on
Payment in SONM tokens
ICO (2017): $42 million (4 days,
8,774 participants)
107. Decentralized storage
STORJ
p2p-marketplace of disk space
Backups, archives
Media content
Transfer of large files
Logs
19k farmers, 20k API users
Payment in STORJ tokens
ICO (2017): $30 million (7 days)
109. Digital identity
uPort
Self-sovereign identity (SSID)
Claims are stored on the
blockchain
Recovery in case of key loss
Integration with the state ID
(Zug)
Similar projects:
Civic, Self-Key
110. Decentralized applications
Summary:
• 2,000 dapps and several millions of smart contracts on Ethereum alone
• Most popular dapps are DeFi, collectibles, games and gambling
• The total audience of dapps is not very significant yet (~10-50k /day)
• Biggest issues poor user experience, poor token economy, poor
scalability