Plasma を理解するための Ethereum Protocol のキホン

Plasma を理解するための Ethereum Protocol のキホン

050ef01445d9f0e493b2683e13f57381?s=128

Akinori Machino

April 26, 2018
Tweet

Transcript

  1. Plasma Λཧղ͢ΔͨΊͷ Ethereum Protocol ͷΩϗϯ ˏamachino 2018.04.26 Plasmaษڧձ

  2. • ౦ژେֶ෺ཧֶՊଔۀɾಉେֶӃதୀ • ࣗ਎ͰͷىۀɺҎདྷελʔτΞοϓാͰԿͰ΋԰ • Ethereum ʹڵຯΛ΋ͪ҉߸௨՟ʗϒϩοΫνΣʔϯք۾΁ • τʔΫϯΤίϊϛʔ࣮ݱͷͨΊʹࠓͰ͖Δ͜ͱΛ໛ࡧத •

    ΤϯδχΞίϛϡχςΟͷඞཁੑΛײͯ͡ Hi-Ether Λ։ઃ ܦྺ @amachino Akinori Machino
  3. ϓ ϥ ζ Ϛ

  4. ϓ ϥ ζ Ϛ Ethereum ͷϨΠϠʔٕ̎ज़ͷ̍ͭͰ͋Δ Plasma Λɺཧղ͢ΔͨΊͷ Ethereum Protocol

    ͷجຊ ࢲ͕࿩͢͜ͱ Plasma ʹ͍ͭͯ͸ޙͷઌੜํ͔Βฉ͜͏ʂ
  5. “Ethereum is a World Computer”

  6. “Ethereum is a World Computer” ≠ Super Computer

  7. ETHEREUM: A SECURE DECENTRALISED GENERALISED TRANSACTION LEDGER EIP-150 REVISION DR.

    GAVIN WOOD FOUNDER, ETHEREUM & ETHCORE GAVIN@ETHCORE.IO Abstract. The blockchain paradigm when coupled with cryptographically-secured transactions has demonstrated its utility through a number of projects, not least Bitcoin. Each such project can be seen as a simple application on a decentralised, but singleton, compute resource. We can call this paradigm a transactional singleton machine with shared-state. Ethereum implements this paradigm in a generalised manner. Furthermore it provides a plurality of such resources, each with a distinct state and operating code but able to interact through a message-passing framework with others. We discuss its design, implementation issues, the opportunities it provides and the future hurdles we envisage. “Transactional Singleton Machine with Shared-State”
  8. World State Account State ͷू߹ͱͯ͠ද͞ΕΔ ੈքͷ”ঢ়ଶ” ʮA͞Μ͸10ETH͍࣋ͬͯΔʯ ʮ͜ͷೣͷࣂ͍ओ͸B͞ΜͰ͋Δʯ ʮ͜ͷυϝΠϯʹ͸1ETHͷ஋ஈ͕͍͍ͭͯΔʯ ộ

    ‣ Externally Owned Accountʢਓؒʣ ‣ Contract AccountʢϓϩάϥϜʣ
  9. ࠁʑͱมΘΔʮੈքͷঢ়ଶʯʹ͍ͭͯ ଟ਺ʹ෼ࢄͨ͠ࢀՃऀؒͰ߹ҙΛऔΓଓ͚Δ άϩʔόϧͳγϯάϧτϯϚγϯ

  10. State Database World State ͸ϚʔΫϧύτϦγΞ໦ͱͯ͠ه࿥͞ΕΔ ‣ World State ͸ 20

    byte ͷ Ethereum ΞυϨεΛ Key ͯ͠ɺ ͦͷΞυϨεͷ Account State Λ Value ʹ࣋ͭσʔλͷू߹ ‣ Account State ʹ͸ɺNonce, Balance, Code, Storage ͷ ̐छྨͷσʔλؚ͕·ΕΔʢEOA ͸ Nonce, Balance ͷΈʣ ‣ ͜ΕΒΛϚʔΫϧύτϦγΞ໦Ͱදݱ͠ɺRLP ͰγϦΞϥΠζ ͨ͠΋ͷ͕ State Databaseʢgeth Ͱ͸ LevelDB Λ࢖༻ʣ ‣ State Database ͸ϒϩοΫνΣʔϯʹ͸ؚ·Εͣɺϧʔτͷ ϋογϡ஋ͷΈ͕ϒϩοΫνΣʔϯϔομʔʹه࿥͞ΕΔ
  11. Transaction τϥϯβΫγϣϯʹΑͬͯঢ়ଶ͸มԽ͢Δ State 14c5f8ba:
 - 1024 eth bb75a980:
 - 5202

    eth if !contract.storage[tx.data[0]]: contract.storage[tx.data[0]] = tx.data[1] [0, 235235, 0, ALICE … 892bf92f:
 - 0 eth send(tx.value / 3, contract.storage[0]) send(tx.value / 3, contract.storage[1]) send(tx.value / 3, contract.storage[2]) [ALICE, BOB, CHARLIE] 4096ad65:
 - 77 eth State’ 14c5f8ba:
 - 1014 eth bb75a980:
 - 5212 eth if !contract.storage[tx.data[0]]: contract.storage[tx.data[0]] = tx.data[1] [0, 235235, CHARLIE, ALICE … 892bf92f:
 - 0 eth send(tx.value / 3, contract.storage[0]) send(tx.value / 3, contract.storage[1]) send(tx.value / 3, contract.storage[2]) [ALICE, BOB, CHARLIE] 4096ad65:
 - 77 eth Transaction From: 14c5f88a
 To: bb75a980 Value: 10 Data: 2, CHARLIE
 Sig: 30452fdedb3d f7959f2ceb8a1 ộ ộ
  12. Transaction-Based State Machine n൪໨ͷϫʔϧυεςʔτ n+1൪໨ͷϫʔϧυεςʔτ ঢ়ଶભҠؔ਺ n൪໨ͷτϥϯβΫγϣϯ S[n+1] = APPLY(S[n],

    Tx[n]) τϥϯβΫγϣϯϕʔεͷεςʔτϚγϯ S[1] Tx[1] APPLY S[0] Tx[0] APPLY S[2] Tx[n-1] APPLY … S[n] S[n-1]
  13. Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

  14. Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ Tx ᶃ5Yͷૹ৴

  15. Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ Tx ᶄ5Yͷݕূ

  16. Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶅ5Yϓʔϧʹ௥Ճ

  17. Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶆ5YΛϐΞʹૹ৴ Tx Tx

  18. Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

  19. Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ Tx Tx Tx

  20. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

  21. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

    Tx
  22. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

    Tx
  23. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

    Tx Tx Tx Tx
  24. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

    Tx Tx Tx Tx ֤ϊʔυʹະ࣮ߦτϥϯβΫγϣϯ͕ཷ·͍ͬͯ͘
  25. B Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ͋Δϊʔυ͕τϥϯβΫγϣϯΛଋͶͯϒϩοΫΛ࡞੒͢Δ ᶃϒϩοΫͷ࡞੒

  26. B Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶄ5Yͷ࣮ߦ

  27. B Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶅϒϩοΫΛϐΞʹૹ৴ B B B B

  28. B Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶆϒϩοΫͷݕূ B B B B

  29. B B B B B Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ᶇ5Yͷ࣮ߦ

    τϥϯβΫγϣϯ͕࣮ߦ͞ΕΔ͜ͱͰঢ়ଶ͕มԽ͢Δ
  30. B B B B B B B B Propagation of

    Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ϒϩοΫ͕ਁಁ͠৽ͨͳʮੈքͷঢ়ଶʯ͕߹ҙ͞ΕΔ
  31. “Ethereum is a World Computer” ≠ Super Computer

  32. “Ethereum is a World Computer” ≠ Super Computer ̍ඵ͋ͨΓʹॲཧՄೳͳτϥϯβΫγϣϯ͸ߴʑ15ఔ౓

  33. “Ethereum is a World Computer” ≠ Super Computer ̍ඵ͋ͨΓʹॲཧՄೳͳτϥϯβΫγϣϯ͸ߴʑ15ఔ౓

  34. Scalability Problem ͳͥϒϩοΫνΣʔϯ͸ॲཧੑೳ͕௿͍ͷ͔ Tx Tx Tx Tx Tx Tx Tx

    Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx Tx શͯͷϊʔυ͕શͯͷτϥϯβΫγϣϯΛॲཧ͍ͯ͠Δ
  35. Blockchain’s Trilemma ϒϩοΫνΣʔϯͷτϦϨϯϚ Decentralization Scalability Security εέʔϧ͢ΔͨΊʹ͸τϨʔυΦϑ͕ൃੜ͢Δ

  36. Scalability Solutions ͲΜͳղܾࡦ͕ߟ͑ΒΕ͍ͯΔ͔