reinvent2018: Cryptocurrency 101 & 201

文字内容
2. SessionID Cryptocurrency 101 & 201 Kristen Stone Product Manager Coinbase Jake Craige Senior Engineer Coinbase © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
3. Agenda Cryptocurrency 101: • Why do blockchains matter? • A short history of Blockchain Technology Cryptocurrency 201: • Crash course in blockchain technology • Consensus Algorithms • Data models • Programmability © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
4. Decentralizing currency provides new opportunities
5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
6. 110M Records 143M Records © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 76M Records
7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
9. A short history of Crypto © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
10. 2008: Bitcoin white paper © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
11. 2012: Coinbase founded 2008: Bitcoin white paper © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
12. 2012: Coinbase founded 2008: Bitcoin white paper 2014: Merchant Payments © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
13. 2012: Coinbase founded 2008: Bitcoin white paper 2015: Private Blockchain initiatives 2014: Merchant Payments © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
14. 2012: Coinbase founded 2008: Bitcoin white paper 2015: Private Blockchain initiatives 2014: Merchant Payments © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2016: Emerging asset class
15. 2012: Coinbase founded 2008: Bitcoin white paper 2015: Private Blockchain initiatives 2014: Merchant Payments © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2016: Emerging asset class 2017: Smart Contracts
16. Cryptocurrency 201 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
17. What makes up a blockchain? © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
18. What makes up a blockchain? Economic Incentives Distributed Consensus Algorithms © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Cryptography
19. Cryptography: Hashing Hello world SHA256 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 64ec88ca00b268e5 ba1a35678a1b5316 d212f4f366b24772 32534a8aeca37f3c
20. Cryptography: Hashing 300 bits HashFn © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. 256 bits
21. Cryptography: Hashing 300 bits HashFn 256 bits 3M bits HashFn 256 bits © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
22. Cryptography: Hashing 00000000 00000100 SHA256 5feceb66ffc86f38d952786c 6d696c79c2dbc239dd4e91b 46729d73a27fb57e9 SHA256 2c624232cdd221771294dfb b310aca000a0df6ac8b66b6 96d90ef06fdefb64a3 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
23. Cryptography: Hashing Cryptographically Secure © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
24. Cryptography: Public-key Cryptography • Asymmetric cryptography • Private & public key pair • Public key uses • Hiding data with encryption • Verifying signatures © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
25. Cryptography: Signatures Sign(data, private key) Verify(data, signature, public key) © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Signature Is valid?
26. So what’s a blockchain? © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
27. Blocks and Transactions Block 1 Hash Previous Block Hash Transaction Transaction Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
28. Blocks and Transactions Block 1 Block 2 Hash Hash Previous Block Hash Previous Block Hash Transaction Transaction Transaction Transaction Transaction Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
29. Blocks and Transactions Block 1 Block 2 Block 3 Hash Hash Hash Previous Block Hash Previous Block Hash Previous Block Hash Transaction Transaction Transaction Transaction Transaction Transaction Transaction Transaction Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
30. Blocks and Transactions Block 1 Block 2 Block 3 Hash Hash Hash Previous Block Hash Previous Block Hash Previous Block Hash Transaction Transaction Transaction Transaction Transaction Transaction Transaction Transaction Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
31. Sending a Transaction Signed Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
32. Sending a Transaction Signed Transaction Node Tx © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
33. Sending a Transaction Miner Tx Signed Transaction Node Node Tx Tx Node Tx © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
34. Sending a Transaction Miner Block Tx Signed Transaction Node Node Tx Tx Node Tx © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
35. Sending a Transaction Miner Block Tx Signed Transaction Node Node Block Block Tx Tx Node Block Tx © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
36. Consensus Protocols © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
37. Consensus Protocols • Proof of Work • Proof of Stake • And more… © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
38. Consensus Protocols: Proof of Work • Computationally expensive to create a block • Verifying the computation is efficient • Chain with “most work” is the canonical chain • Probabilistic finality © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
39. Consensus Protocols: Proof of Work Difficulty: A value determined by the network selected to make creating a block take T time on average Nonce: An arbitrary value used to change the block hash © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
40. Consensus Protocols: Proof of Work Difficulty = 3 Block 1 Nonce Previous Block Hash Transactions © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
41. Consensus Protocols: Proof of Work Difficulty = 3 Block 1 Set Nonce = 0 Hash(block) Nonce Previous Block Hash Transactions © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. a8h36v37
42. Consensus Protocols: Proof of Work Difficulty = 3 Block 1 Set Nonce = 0 Hash(block) a8h36v37 Set Nonce = 1 Hash(block) 7y91h81g Nonce Previous Block Hash Transactions © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
43. Consensus Protocols: Proof of Work Difficulty = 3 Block 1 Set Nonce = 0 Hash(block) a8h36v37 Set Nonce = 1 Hash(block) 7y91h81g Set Nonce = 3 Hash(block) 000cja01 Nonce Previous Block Hash Transactions © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
44. Consensus Protocols: Proof of Work Height 3 Height 2 Height 1 Height 0 oa912 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
45. Consensus Protocols: Proof of Work Height 3 Height 2 Height 1 Height 0 k19bc oa912 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
46. Consensus Protocols: Proof of Work Height 3 Height 2 Height 1 Height 0 k19bc 9sl18 oa912 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
47. Consensus Protocols: Proof of Work Height 3 o19bf Height 2 Height 1 Height 0 k19bc 9sl18 oa912 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
48. Consensus Protocols: Proof of Work Height 3 8djb1 Height 2 o19bf Height 1 Height 0 k19bc 9sl18 oa912 © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
49. Consensus Protocols: Proof of Work • Benefits • Simple • Battle-tested • Problems • Uses a lot of energy • Probabilistic Finalization • Security dependent on decentralized hash rate • Slower blocks © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
50. Consensus Protocols: Proof of Stake • Participants deposit and lock up funds in the system. This is called “staking” • A participant is randomly selected from this pool to produce a block and publish it • Other nodes receive it and validate it • The block producer is punished for attempting to cheat and rewarded for good blocks © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
51. Consensus Protocols: Proof of Stake • Multiple versions of Proof of Stake • Popular • Delegated PoS (EOS, Tezos, Steem) • Casper FFG/CBC PoS (Ethereum) © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
52. Consensus Protocols: Proof of Stake • Benefits • Faster blocks • More energy efficient • Punishments explicitly defined • Problems • Less-battle tested © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
53. Data Models © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
54. Data Models: UTXOs • Transaction Inputs & Outputs • UTXO is an “Unspent Transaction Output” • No in-protocol concept of a “balance” for an address • Used by: • Bitcoin • Monero • Zcash • Cardano © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
55. Data Models: UTXOs Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
56. Data Models: UTXOs Inputs 5 BTC Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
57. Data Models: UTXOs Inputs Outputs 5 BTC 3 BTC Transaction Destination 1 BTC Change © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
58. Data Models: UTXOs Inputs Outputs 5 BTC 3 BTC Transaction Destination 1 BTC Change 1 BTC fee © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
59. Data Models: Accounts • Like a bank account • Account balance is changed over time from transactions • Used by: • Ethereum • EOS • Tezos • Stellar © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
60. Data Models: Accounts Transaction © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
61. Data Models: Accounts Transaction Account Miner Alice Bob Balance 0 ETH 5 ETH 0 ETH © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
62. Data Models: Accounts Transaction Account Miner Alice Bob Balance 0 ETH 5 ETH 0 ETH From To Value Fee Alice Bob 3 ETH 1 ETH © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
63. Data Models: Accounts Transaction Account Miner Alice Bob Balance 0 ETH 5 ETH 0 ETH From To Value Fee Alice Bob 3 ETH 1 ETH © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Account Miner Alice Bob Balance 1 ETH 1 ETH 3 ETH
64. Programmability © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
65. Programmability: Bitcoin Script • Script is simple, stack-based, and processed from left to right. It is intentionally not Turing-complete, with no loops. • Outputs include a partially complete script • Inputs include the other half to complete it • Script must evaluate to true for the output to be spent • Protocol defines standard supported scripts © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
66. Programmability: Bitcoin Script (P2PKH) Type: pay-to-pubkey-hash (p2pkh) scriptPubKey: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG scriptSig: © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
67. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
68. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
69. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
70. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
71. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. OP_EQUALVERIFY OP_CHECKSIG
72. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG OP_CHECKSIG © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
73. Programmability: Bitcoin Script (P2PKH) Stack Empty Script OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG OP_EQUALVERIFY OP_CHECKSIG OP_CHECKSIG true © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
74. Programmability: Ethereum VM • Turing complete virtual machine • Stateful “smart contracts” are deployed to the network • Operations are metered and cost “gas” to prevent DoS attacks • Complex computations cost more • Higher level languages (Solidity, Vyper) © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
75. Programmability: Ethereum VM (ERC-20) interface IPartialERC20 { function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); // other details omitted } © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
76. Programmability: Ethereum VM (ERC-20) contract PartialERC20 { mapping (address => uint256) private _balances; function transfer(address to, uint256 value) public returns (bool) { _balances[msg.sender] = _balances[msg.sender].sub(value); _balances[to] = _balances[to].add(value); return true; } } © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
77. Programmability: Ethereum VM (ERC-20) contract PartialERC20 { mapping (address => uint256) private _balances; function transfer(address to, uint256 value) public returns (bool) { _balances[msg.sender] = _balances[msg.sender].sub(value); _balances[to] = _balances[to].add(value); return true; } } © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
78. Programmability: Ethereum VM (ERC-20) contract PartialERC20 { mapping (address => uint256) private _balances; function transfer(address to, uint256 value) public returns (bool) { _balances[msg.sender] = _balances[msg.sender].sub(value); _balances[to] = _balances[to].add(value); return true; } } © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
79. And more… © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
80. Thank you! Kristen Stone Jake Craige Please join our Coinbase Crypto Happy Hour starting right after this! We’ll have hor d’oeuvres and a fully hosted bar. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.