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.

How BitCoin works?

509 views

Published on

How bitcoin works

Published in: Technology
  • Be the first to comment

How BitCoin works?

  1. 1. BitCoin Moein Hosseini
  2. 2. 2 / 59 Table Of Contents ● History of Money ● Introduction to BitCoin ● Keys, Addresses, Wallets ● Transactions ● The Blockchain ● Mining
  3. 3. 3 / 59 History Of Money
  4. 4. 4 / 59 History Of Money ● Barter – Needs double coincidence of wants ● Commodity Money – Portable & Divisible ● Use of Tokens – Backed By Deposits Of Gold – Fiat Money
  5. 5. 5 / 59 Uses Of Tokens ● Representative Money – The value of the token is baked by a commodity, eg: Gold, Silver – Was in use until 1971 (Gold Backed Dollar) ● Fiat Money – The value of the token is based on the confidence on Issuer, eg: Governments – National Debt – Economic Crisis
  6. 6. 6 / 59 Cash Payment ● Quite Portable ● No Charge For Transactions ● No Audit ● CASH IS NOT FREE – Replaced with newly printed ones – Heavy insurance – Counterfeiters
  7. 7. 7 / 59 Digital Money ● Credit Cards ● Debit Cards ● Stored Value Cards ● Electronic Cash ● Electronic Checks ● etc.
  8. 8. 8 / 59 Digital Currencies ● Is Authentic and Not Counterfeit ● Double Spending
  9. 9. 9 / 59 Yap Stone Money
  10. 10. 10 / 59 Solution ● Decentralized P2P Network (BitCoin Protocol) ● Public Ledger (Blockchain) ● Decentralized Mathmatical Currency Issuance (Distributed Mining) ● Decentralized Transaction Verification (Transaction Script)
  11. 11. 11 / 59 Byzantine Generals Problem
  12. 12. 12 / 59 Who Created BitCoin? ● October 31, 2008 – Satoshi Nakamoto Published paper: “A peer-to- peer electronic cash system“ ● Januray 3, 2009 – Satoshi released BitCoin Source Code ● April 23, 2011 – Satoshi said “Moved onto other things“
  13. 13. 13 / 59 BitCoin Overview
  14. 14. 14 / 59 Buying a Cup of Coffee
  15. 15. 15 / 59 Transaction
  16. 16. 16 / 59 Transaction Chain
  17. 17. 17 / 59 Transaction
  18. 18. 18 / 59 Mining
  19. 19. 19 / 59 Asymmetric Encryption
  20. 20. 20 / 59 Elliptic Curve Cryptography
  21. 21. 21 / 59 Elliptic Curve Cryptography PubKey = PrivKey * G
  22. 22. 22 / 59 BitCoin Address
  23. 23. 23 / 59 Public Key Compression
  24. 24. 24 / 59 BitCoin Wallet
  25. 25. 25 / 59 Nondeterministic Wallets
  26. 26. 26 / 59 Deterministic Wallets
  27. 27. 27 / 59 Mnemonic Code Words ● Create Random Sequence (128 to 256 Bit) ● Create Checksum (First Few Bits of SHA256) ● Add the Checksum ● Divide The Sequence Into Sections Of 11 Bits ● Produce 12 to 24 Words (mnemonic code)
  28. 28. 28 / 59 Mnemonic Code Words
  29. 29. 29 / 59 Creating Master Key
  30. 30. 30 / 59 Creating Child Key
  31. 31. 31 / 59 Extended Keys–Public Key
  32. 32. 32 / 59 Extended Keys–Private Key
  33. 33. 33 / 59 Keys Path
  34. 34. 34 / 59 Vantiy Address
  35. 35. 35 / 59 Transactions ● Creating Transactions – Like a Check – Submit for execution – Need Signature – Online / Offline ● Broadcasting – About 300~400 Bytes – Unlike Credit Card, Just Needs Propagation
  36. 36. 36 / 59 Transactions ● Peer-To-Peer Network – Valid transactions sends to three or four peers – In few seconds every nodes know it ● Prevent Spamming, DoS Attack – Validate transaction before sending
  37. 37. 37 / 59 Transaction Structure
  38. 38. 38 / 59 Locktime ● Defines the earliest time that a transaction can be added to the blockchain ● Set to ZERO : Immediatly ● NonZero and Below 500 million : Block Height ● Above 500 million : Timestamp
  39. 39. 39 / 59 UTXO ● Unspend Transaction Output ● No Account ● No Balances ● Only Unspend Transactions – I have 5$ – A cup of coffee is 1.5$ – 3.5$ as exchange
  40. 40. 40 / 59 Output Structure
  41. 41. 41 / 59 Input Strcutre
  42. 42. 42 / 59 More About Transaction ● Transaction Fee – Sum(Inputs) – Sum(Outputs) ● Orphan Transaction – Depends on unrecieved transaction – MAX_ORPHAN_TRANSACTIONS
  43. 43. 43 / 59 Transaction Scripts ● Programmble Money ● Pay to Hash Address – Locking: scriptPubKey – Unlocking: scriptSig ● Pay to Script Hash – Multi Signatures Transactions
  44. 44. 44 / 59 Evaluate A Script
  45. 45. 45 / 59 Evaluate A Script
  46. 46. 46 / 59 Evaluate A Script
  47. 47. 47 / 59 Pay to Script Hash ● Any payments need M signature of N ● Cons: – Five times larger – More transaction fee ● Solution – Pay to script matching this hash, a script will be present later when this output is spent
  48. 48. 48 / 59 Pay to Script Hash ● MultiSig With Out P2SH ● MultiSig With P2SH
  49. 49. 49 / 59 Blockchain
  50. 50. 50 / 59 Header Structure
  51. 51. 51 / 59 Gensis Block
  52. 52. 52 / 59 Merkle Tree
  53. 53. 53 / 59 Node Types
  54. 54. 54 / 59 Node Types
  55. 55. 55 / 59 Mining
  56. 56. 56 / 59 Mining
  57. 57. 57 / 59 BitCoin Hash Rate
  58. 58. 58 / 59 Difficulty and Retargeting ● Every two weeks (2016 blocks) ● As bug its 2015 blocks ^_^
  59. 59. 59 / 59 Thanks

×