Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to Blockchain - And, by the way, what the heck is proof-of-work?

645 views

Published on

An overview of bitcoin and the blockchain with a more in-depth description of proof of work (POW). Conde samples used to demonstrate the concepts behind POW are available at http://jamespflynn.com.

Published in: Technology
  • I pasted a website that might be helpful to you: ⇒ www.WritePaper.info ⇐ Good luck!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Intro to Blockchain - And, by the way, what the heck is proof-of-work?

  1. 1. Intro to Blockchain And, by the way, what the heck is proof-of-work? By Jim Flynn
  2. 2. About Jim Flynn ● Started built & sold tech companies ● Jobs: – Software engineer – Hardware engineer – Sales executive, CEO, etc. ● More at jamespflynn.com ● www.linkedin.com/in/jamespeterf
  3. 3. Agenda Blockchain Overview1 Blockchain/bitcoin Overview1 Blockchain Overview1 Understanding Proof of Work2 Blockchain Overview1 Proof of Work Demo3
  4. 4. In the beginning... ..or rather 2008
  5. 5. Bitcoin’s Techno-Libertarian Roots ● Skeptical of authority ● Dislike centralized power ● Protective of privacy ● Alarmed about surveillance ● Oh yeah, hates taxes
  6. 6. Enter Satoshi Nakamoto J ? “A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.”
  7. 7. Satoshi’s Crypto-Currency Commandments Thou Shalt NOT: Thou Shalt: 1. worship centralized authorities 2. covet they neighbor’s bitcoin (except with the right private key) 3. alter completed transaction 4. inflate 5. double spend 1. govern thyselves by cons 2. rely’th on incentives 3. have faith in cryptograph for the geeks shall inherit th earth
  8. 8. Blockchain Defined ● Distributed database ● Good for time-ordered data ● Not owned or controlled by one entity (bitcoin’s case) ● Each block connected to previous block ● Anyone can validate the ledger, which contains a record of every transaction.
  9. 9. Traditional Way Our Business Our DB We did pay! Your Business Your DB They didn’t pay! Bank Bank DB Did they pay?
  10. 10. Blockchain Way Our Business TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block N Blockchain - Distributed Ledger Transaction Block shows if they paid. Your Business
  11. 11. Blockchain Way Our Business TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block N Your Business Business 1 Business 2 Business 3 Business 4 Business 5 Business 5 Business 6 Business 7 Business 8 Business 9 Business 10 Business 3 Business Business Business Business Business Business Business Business Business Business Business Business Business Business Business
  12. 12. Blockchain = Shared Distributed Truth My database says X. My database says Y.
  13. 13. Blockchain = Shared Distributed Truth My database says X. My database says Y. The blockchain says Z.
  14. 14. What does “hash” mean to you? ● Creates a “fingerprint” of data – Ex: Hash(“123”) = c74b6bd9a2f7648a ● SHA256 (used in bitcoin) – Easily-verified from data – Cannot recreate the data
  15. 15. Hashes Ensure Blockchain Integrity TX Block 0 hash TX Block 1 hash TX Block 2 hash ... TX Block N hash 2009 2017 hash hash hash
  16. 16. Hashes Ensure Blockchain Integrity TX Block 0 hash TX Block 1 hash TX Block 2 hash ... TX Block N hash 2009 2017 hash hash hash
  17. 17. Hashes Ensure Blockchain Integrity TX Block 0 hash TX Block 1 hash TX Block 2 hash ... TX Block N hash 2009 2017 hash hash hash
  18. 18. Bitcoin Identity ● You get paid to your public key – 02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc ● You pay with your private key ● No issuing authority
  19. 19. Is Bitcoin Anonymous? Dread Pirate Roberts NobDeath from Above French Maid Flush Number13
  20. 20. Is Bitcoin Anonymous? Dread Pirate Roberts NobDeath from Above French Maid Flush Number13
  21. 21. Adding Blocks in Bitcoin ● Uses “proof-of-work” ● “Miners” compete to add blocks – More hash power = higher probability to win – Reward: 12.5 bitcoins and transaction fees – Puzzle solved (new block) about every 10 minutes – Puzzle difficulty adjusted ever two weeks ● Nodes recognize the longest valid chain
  22. 22. Mining TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 Miner 1 Miner 2 Prop. TX Block 7 Prop. TX Block 7 1. Miners race to solve puzzle. 2. Whoever wins, gets to set the next block & gets a reward. TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6
  23. 23. Mining TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 Miner 1 Miner 2 Prop. TX Block 7 Prop. TX Block 7 TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6
  24. 24. Mining TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 Miner 1 Miner 2 Prop. TX Block 7 TX Block 7 TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 TX Block 0 TX Block 1 TX Block 2 TX Block 3 TX Block 5 TX Block 6 TX Block 7 TX Block 7
  25. 25. ASIC Application Specific Integrated Circuit Mining Pools Bitcoin Mining Now
  26. 26. “On a high-end desktop...it would take you several hundred thousand years on average at the early-2015 difficulty level (267 ) to find a valid block.” Don’t try this at home. Bitcoin and Cryptocurrency Technologies Princeton University Press, 2016 Page 112
  27. 27. What the fork? ● Forks happen when nodes disagree about the longest valid chain. ● Forks can cause havoc. ● Built-in incentives to discourage forks.
  28. 28. Scripting ● Very basic in bitcoin ● Far more advanced in Ethereum
  29. 29. Simplified Smart Contract Example parentState = SSA.lookupState(‘055051805’) kidMaried = MA.lookupMarriageLic(‘055051805’) publicKey = ‘02a1633cafcc01ebfb6d78e39f6’ If parentState = “Dead” then If kidMarried = “True” then Pay(kid.publicKey) Marriage Licenses Death Records
  30. 30. Beyond Cryptocurrency ● Supply chains ● Decentralized organizations ● Tracking physical assets ● eVoting ● Sharing economy – IoT & micropayments
  31. 31. Crypto-coins Galore Bitcoin Ether Litecoin Dogecoin Dash NEMPeercoin Primecoin Gridcoin MoneroRipple
  32. 32. Ready to dive in? Proof of Work (POW) ● Look at some code ● Run some tests
  33. 33. POW = Solve a Puzzle Find a number that, when combined with the transaction data, hashes to a value that’s less than a given tolerance.
  34. 34. 1 10 trillion Probability that a hash will be any one number on continuum that is within the tolerance is 50% of 1/10 trillion. 50% change of winning in one try. Tolerance = 5T Losing hashes Winning hashes Half the Time You’re a Winner! Range of possible hash values
  35. 35. 10% change of winning in one try. 10% of the Time You’re a Winner. 1 10 trillion Losing hashes Winning hashes Range of possible hash values Tolerance = 1T
  36. 36. for ( $nonce = 1; $nonce <= $maxTries; $nonce++ ) { $hash = hash('sha256', $transaction . $nonce); $start = substr($hash, 0, $zeros); if ( $start === $lead ) { echo "<br/>Success! Puzzle solved with nonce = $nonce $end"; echo "Try #" . number_format($nonce) . ": Hash("$transaction.09$nonce")=$hash $end"; break; } elseif ($details == "yes") echo "Try #" . number_format($nonce) . ": Hash("$transaction.$nonce")=$hash $end"; } Solving the Puzzle in Php Code
  37. 37. Loop through nonce values from 1 to the max times you want to try End Loop Solving the Puzzle in Pseudo Code Compute hash of transaction text concatenated with the nonce If the hash starts with the minimum number of zeros then Display a success message Stop
  38. 38. Let’s play!
  39. 39. POW Alternative: Proof of Stake ● Does not waste as much electricity ● Vulnerable to a “rewriting history” attack ● e.g., Peercoin
  40. 40. POW Alternative: Proof of Burn ● Prove the you made coins unspendable ● Sometimes used to transfer to new currency
  41. 41. https://assets.kpmg.com/content/dam/kpmg/pdf/2016/06/kpmg-blockchain-consensus-mechanism.pdf Google: kpmg blockchain consensus
  42. 42. Thanks! Don’t forget to check my blog for code and this presentation. http://jamespflynn.com

×