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

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

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

Akinori Machino

April 26, 2018
Tweet

More Decks by Akinori Machino

Other Decks in Technology

Transcript

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

    ͷجຊ ࢲ͕࿩͢͜ͱ Plasma ʹ͍ͭͯ͸ޙͷઌੜํ͔Βฉ͜͏ʂ
  2. ETHEREUM: A SECURE DECENTRALISED GENERALISED TRANSACTION LEDGER EIP-150 REVISION DR.

    GAVIN WOOD FOUNDER, ETHEREUM & ETHCORE [email protected] 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”
  3. 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 ͸ϒϩοΫνΣʔϯʹ͸ؚ·Εͣɺϧʔτͷ ϋογϡ஋ͷΈ͕ϒϩοΫνΣʔϯϔομʔʹه࿥͞ΕΔ
  4. 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 ộ ộ
  5. 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]
  6. Tx Tx Tx Tx Tx Tx Propagation of Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻

    Tx Tx Tx Tx ֤ϊʔυʹະ࣮ߦτϥϯβΫγϣϯ͕ཷ·͍ͬͯ͘
  7. B B B B B B B B Propagation of

    Transactions τϥϯβΫγϣϯͷωοτϫʔΫ΁ͷ఻೻ ϒϩοΫ͕ਁಁ͠৽ͨͳʮੈքͷঢ়ଶʯ͕߹ҙ͞ΕΔ
  8. 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 શͯͷϊʔυ͕શͯͷτϥϯβΫγϣϯΛॲཧ͍ͯ͠Δ