Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Blockchain

Aaron Li
November 19, 2017

Introduction to Blockchain

The technologies behind Bitcoin, Ethereum, ICOs.

Beginner level lecture for blockchain. Topics covered: the history and technologies behind Bitcoin, trading, ICO, applications, job opportunities, and more. These are the slides accompanying my online live lecture at BitTiger (Nov 15, 2017).
Video (Chinese): https://www.youtube.com/watch?v=lVVCu_Pxshk
Event page: https://www.bittiger.io/events/2SS4xnfKzKYvwBpPQ

Aaron Li

November 19, 2017
Tweet

More Decks by Aaron Li

Other Decks in Technology

Transcript

  1. 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
  2. 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/
  3. 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, …
  4. 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, …
  5. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    2008 - Bitcoin Paper Satoshi Nakamoto image from: Google Image
  6. 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/Gc2en3nHxA4 https://www.weusecoins.com/
  7. 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
  8. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    2009 - Early days Open Source Software & early supporters
  9. 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
  10. 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
  11. 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
  12. 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.)
  13. 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
  14. 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, …)
  15. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    2012 - 2015 https://bitcoincharts.com/charts/ bitstampUSD#czsg2012-10-29zeg2015-10-30ztgSzm1g10zm2g25zvzcv
  16. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    2015 - Now The Biggest Thing “Decentralised Turning Complete Virtual Machine” image from: ethereum.org
  17. 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/
  18. 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 …
  19. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Trading Coinbase: 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!)
  20. 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
  21. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Trading Bitstamp: Professional exchange, low fees (0% - 0.3%) Supports BTC, XRP, LTC, ETH and many fiat currencies
  22. 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
  23. 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
  24. 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
  25. 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!
  26. 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?
  27. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Career Opportunities Friends’ companies with successful ICO hiring engineers, etc. • Orchid ($4.7M, a16z, etc.) • WeTrust ($>10M) • doc.ai • many more…
  28. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Blockchain Goal: 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
  29. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Blockchain Solution: Store transactions distributively as a chain of blocks (“blockchain”) Issues: How to (efficiently) define create verify store transactions? track
  30. 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?
  31. 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
  32. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Address: an object for receiving Bitcoins Address = Hashes of public key See 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
  33. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Transaction: 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
  34. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain verify 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”)
  35. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Transactions Example: 1 Bitcoin transferred through owner 0, 1, 2, 3, … 1 Bitcoin …. track transactions image from: [Nakamoto, 2008] (Bitcoin paper)
  36. 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)
  37. 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?
  38. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain blockchain = 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)
  39. 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
  40. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Goal: minimise information needed to verify a transaction Solution: Merkle tree image from: [Nakamoto, 2008] (Bitcoin paper)
  41. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Bitcoin Merkle tree construction: 1. Compute hashes of transactions in a block 2. Compute hashes of each pair of hashes recursively 1. Load / verify root hash R 
 2. Load H, the hash of T
 P(H), the ancestors of H
 S(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)
  42. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain More 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
  43. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Bitcoin block chain, with Merkle Tree Miners generate blocks, and validate transactions image from: [Nakamoto, 2008] (Bitcoin paper)
  44. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain Proof-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 chain 3. 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)
  45. 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
  46. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain If 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?
  47. 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)
  48. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Bitcoin Blockchain incentives? 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
  49. 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)
  50. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Ethereum Instead 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
  51. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Ethereum Resources: 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/
  52. Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected])

    Litecoin Based 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

  53. 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