Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected]) Blockchain The technologies behind Bitcoin, Ethereum, ICOs… Aaron Li [email protected] Oct 28, 2017
Jan 22, 2018
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
BlockchainThe technologies behind Bitcoin, Ethereum, ICOs…
Aaron [email protected]
Oct 28, 2017
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Me & Blockchain
• Miner 2011-2012• Built several mining clusters and tools
• Evangelist / supporter 2011 -
• Investing / trading occasionally
• Interested in core tech / products / apps
https://www.linkedin.com/in/aaronqli/
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
What is
Bitcoin?
Ethereum?
ICO?
Blockchain?
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
History: 2008 - Present
Tech: P2P Distributed Cryptographic Ledger
Coins: Bitcoin, Ethereum, Litecoin, …
Applications: Finance, Law, Businesses, Computing, …
Jobs: Security, Infrastructure, Trading, Applications, …
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Basic Technical Topics
• Blockchain Overview• Proof of Work, Transactions, Consensus
• Bitcoin• Mining: Hardware, Pools, Mechanism…
• Ethereum• Ether, Smart Contract, Applications
• Others: Litecoin, ICO, …
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2008 - Bitcoin Paper
Satoshi Nakamoto
image from: Google Image
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
https://bitcoin.org/bitcoin.pdf
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
• Decentralised digital currency• Backed by math & algorithms• No government / company control
• Low fee P2P international transfer
• “Anonymous” & verifiable transactions
What is Bitcoin?https://youtu.be/Gc2en3nHxA4https://www.weusecoins.com/
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
What is Bitcoin?
• 1 Bitcoin = 1 BTC = 1 (Ƀ, ฿, …)
• BTCs are stored in an address• e.g. 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy
• Max circulation: 21 millions (by ~2033)
• Minimum unit: 0.00000001 (1e-8) = 1 satoshi
• Transaction = one address send BTC to another
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])image from: weusecoins.com
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])image from: weusecoins.com
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2009 - Early days
Open Source Software & early supporters
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])bitcoin.org July, 2009
image from: archive.org
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])image from: archive.org
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin in 2009 - 2011• No applications
• People just doing it for fun
• Almost no one accepts Bitcoin
• First community: bitcointalk.org
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin in 2009 - 2011
• 10,000 Bitcoins = 2 pizzas
• Alpaca Socks • First vendor accepting Bitcoin
image from: Google Image search
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2011: Tipping Point
https://bitcoincharts.com/charts/mtgoxUSD#czsg2010-10-29zeg2012-10-30ztgSzm1g10zm2g25zvzcv
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
What happened in 2011?
GPU Mining
Mass Media Reports
Alternatives & Forks (Litecoin, etc.)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2011: My first miner
15 GPUs (HD5850)
Power: 4kWh
Cooling: Water / Fan
@ Balcony & Tent
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2012 - 2015+ Speculators (non-tech people)
+ Exchanges (- MtGox)
+ Merchants (Shipito, Overstock, …)
+ Services (POS, Wallets, …)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2012 - 2015
https://bitcoincharts.com/charts/bitstampUSD#czsg2012-10-29zeg2015-10-30ztgSzm1g10zm2g25zvzcv
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2015 - NowThe Biggest Thing
“Decentralised Turning Complete Virtual Machine”
image from: ethereum.org
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
What is Ethereum?
• Decentralised Computer• Run “Smart Contracts” (programs)• Turing-complete machine
• Use Ether (ETH) to operate
• Not a currency, but is treated as one
https://ethereum.org/
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
2015 - Now: Other Big Things
ICOs
Ripple, Tether, BitGo, Qtum, …
Coinbase & GDAX
Regulations: SEC, China, US Laws …
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Nowhttps://coinmarketcap.com/
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
TradingCoinbase: Good for starters. Easiest to setup. High fees (1-5%)
Use credit card / banks. Need ID verification.
Support BTC, ETH, LTC
in USA, Canada, Australia, Singapore, most Europe
USA based (reports earning to IRS!)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
GDAX: Professional version of Coinbase; Low fees (0% - 0.3%)
limit/stop orders, depth graph, order book, history, …
margin trading (temporarily unavailable)
USA based (reports earning to IRS!)
Trading
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
TradingBitstamp: Professional exchange, low fees (0% - 0.3%)
Supports BTC, XRP, LTC, ETH and many fiat currencies
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Others
See bitcoincharts.com
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Initial Coin Offering (ICO)
• Similar benefits compared to IPO:
• Allow general public to participate
• Raise large sum of money ($1M’s - $100M’s)
• Public trust, public audit & examination
New way to raise money for a project / company
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
• Better than IPO in some areas:
• Much less complicated legal paperwork
• Can be started by any person / team
• Much easier for the public participate & trade
Initial Coin Offering (ICO)
Successes: Ethereum, Filecoin, Bancor, Tezos, BAT
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Initial Coin Offering (ICO)
• Issues, compared to IPO:
• Many projects are scams / impossible to deliver
• No regulations exist to sue / recoup damages
• No supervision to project owners
Failures: DAO, and many others
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Initial Coin Offering (ICO)
• Usual Process:
• Get a team
• Write a white paper
• Get people to talk about it
• Set up a beautiful website
• ICO!
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Initial Coin Offering (ICO)
• Future talks:
• What is expected in whitepapers?
• Open source tools for designing / launching ICO
• Case studies
• For startups: Future of ICOs v.s. VC?
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Career OpportunitiesFriends’ companies with successful ICOhiring engineers, etc.
• Orchid ($4.7M, a16z, etc.)
• WeTrust ($>10M)
• doc.ai
• many more…
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
BlockchainGoal: Design a distributed ledger such that
• All transactions are recorded and verifiable
• Owners can remain anonymous
• No central authority required (“trustless”)
• Resistant to malicious attacker
• Participants are incentivised and rewarded
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
BlockchainSolution: Store transactions distributively as
a chain of blocks (“blockchain”)
Issues: How to (efficiently)
definecreateverifystore
transactions?
track
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Blockchain
Issues: How do we make sure the transactions are
respecting every participant’s privacy?
resilient to attackers?robust against malicious users?
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchain• Fully decentralised network
• Each node is a user
• Some nodes are miners
• Miners: nodes that verify transactions between users
• Miners are incentivised by two types of rewards• Transaction fees• Validating a new block (hard)
image from: Google Image Search
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainAddress: an object for receiving Bitcoins
Address = Hashes of public keySee this article of details
• Controlled by corresponding private key
• Key pairs can be arbitrarily generated (address too)
• Intended to be used only once
define and create transactions
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainTransaction: A sends some X coins to B
Process: 1. A controls an address P with X coins
2. A obtain an address Q controlled by B (B could generate Q with a new private key)
3. A creates a transaction T transfer X Bitcoins from P to Q
4. A signs T using private key of P
Define and create transactions
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchainverify transactions
• What about all transactions before that?
• How do we know A did not spend his Bitcoin twice?
• How do we know A has X Bitcoins before sending them to B?
Single transaction: verifiable using hashes / public key
(To be discussed later in “blocks”)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin TransactionsExample: 1 Bitcoin transferred through owner 0, 1, 2, 3, …
1 Bitcoin ….
track transactions
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Transactions• Can have multiple in/out
• Combine fractions / divide coins
• Unspent coins are stored in new address
0.1 BTC
1.3 BTC
….
0.5 BTC
…
track transactions
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchain
1. Store transactions in blocks
2. Simplify the blocks (just enough to verify things)
3. Store blocks to all nodes in network
How to efficiently store and verify transactions?
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchainblockchain = A chain of blocks
Bitcoin Block = Block Header + (Hashes of) Transactions
Header = Last Block’s Hash + Nounce + (Root Hash of Transactions)
Nounce = a sequence of bytes to show proof-of-work
track transactions
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchain
Issue: Most nodes don’t want to store all transactions
They only want to verify a transaction is in the blockchain
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainGoal: minimise information needed to verify a transaction
Solution: Merkle tree
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainBitcoin Merkle tree construction:
1. Compute hashes of transactions in a block2. Compute hashes of each pair of hashes recursively
1. Load / verify root hash R
2. Load H, the hash of TP(H), the ancestors of HS(P(H)), the siblings of P(H)
3. Reproduce and verify R and P(H) using these
To verify a transaction T is in the blockchain:
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainMore on Merkle tree
A Certified Digital Signature, R. Merkle (written in 1979) Proceeding CRYPTO '89 Proceedings on Advances in cryptology
Protocols for public key cryptosystems, R. Merkle, 1980 IEEE Symposium on Security and Privacy
Used in a wide range of applications• version controls (Git, …)• file systems (IPFS, ZFS, …)• databases (Cassandra, Dynamo, …)• P2P systems (BitTorrent, …)• and many more
image from: Google Search
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainBitcoin block chain, with Merkle Tree
Miners generate blocks, and validate transactions
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainProof-of-work:
1. a block is valid iff hash (SHA2) of block header has N leading zero bits(miners must find it by solving the value of nounce by brute-force)
2. longest block chain is the only valid block chain3. once a valid block is found, it is propagated to all nodes
controls generation speed of new blocks (~1 block / 10 minutes)
A valid nounce is (artificially made) hard to compute
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchain
Blocks and transactions are immutable
Transactions are secured by private/public keys
resilient to attackers?
resilient to forgery:
resilient to DDOS: Miners can charge transaction fees
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin BlockchainIf someone wants to alter their own past transactions (using private keys), and create fake history, he must….
1. Find the blocks which contain those transactions
2. Change the transactions and recompute Merkle trees
3. Re-compute all blocks on his own until his chain is longest
In the meantime, other nodes continue to produce new blocks…
Impossible to catch up unless he has >50% CPU of whole network!
robust against malicious users?
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
respecting every participant’s privacy?
Bitcoin Blockchain
image from: [Nakamoto, 2008] (Bitcoin paper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
Bitcoin Blockchainincentives?
Miners are rewarded with…
1. X Bitcoins, for each valid new block found (manifested by attaching a reward transaction in new block)
2. Transaction fees, for all transactions in the new block
Bitcoin has controlled supply, so X is halved every 210000 blocks
Year 2008: X = 50
210000 blocks ~= 4 years
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
General Blockchain
: State of blockchain at timestamp t
: The block, containing all (general) transactions: State transition function: Block finalisation function
See details in Ethereum yellow paper
image from: [Wood, EIP-150 2017] (Ethereum Yellowpaper)
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
EthereumInstead of wasting CPUs for computing hashes of proof-of-work, let nodes do some useful work!
• Introduced new concepts: accounts, contracts, messages, …
• Transactions: define function calls, execution model, data, …
• Proof-of-work: still rely on nounce, but deprecating soon
• (Theoretically) much broader applications
• Not meant to be a currency, but people got crazy
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
EthereumResources:
Ethereum Wallet + Mist Browser & Serverless app tutorial
White paper: https://github.com/ethereum/wiki/wiki/White-Paper
Yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf
Programming: Build Helloworld DApp (decentralised app)
DApps for Beginners: https://dappsforbeginners.wordpress.com/
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
LitecoinBased on Bitcoin. Designed to make GPU/FPGA/ASIC ineffective
• 2.5 minutes per new block, instead of 10 minutes
• Proof-of-work: use scrypt hashing algorithm, instead of SHA256
scrypt:
• time-memory tradeoff: parallelisation becomes ineffective
• fast with large memory, and slow with little memory
• See paper for details
Copyright 2017 Aaron Li ([email protected])
Copyright 2017 Aaron Li ([email protected])
More
• Mining: history, hardware, future alternatives
• Ethereum: technical design, programming, applications
• ICOs: applications and technical advancements
• Blockchain: enterprise applications
• and more…
Topics for future talks