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

Smart Contract Design Pattern

yamarkz
August 30, 2018

Smart Contract Design Pattern

blockchain.tokyo #11

yamarkz

August 30, 2018
Tweet

More Decks by yamarkz

Other Decks in Technology

Transcript

  1. σβΠϯύλʔϯͱ͸ ίϯτϥΫτ։ൃʹ͓͍ͯɺԿ౓΋܁Γฦ͠ݱΕΔ࣮૷ߏ଄ʹܕ ύλʔϯ Λݟग़͠ɺ ͦͷܕ ύλʔϯ ͔Βந৅తͳॲཧͷઃܭ σβΠϯ Λ࡞Γग़͠ɺಛఆͷ՝୊Λղܾ͢ Δ൚༻తͳॲཧͷઃܭܕ

    σβΠϯύλʔϯ ͱͯ͠ఆٛͨ͠΋ͷɻ ݫີʹσβΠϯύλʔϯΛఆٛ͢Δͱ ͭ·Γɺ සग़͢Δ՝୊ղܾͷϕετϓϥΫςΟε ࠷ྑͷղܾखஈ ͕ɺ σβΠϯύλʔϯ
  2. ՝୊ղܾ࣮૷" ՝୊ղܾ࣮૷# ՝୊ղܾ࣮૷# ۩৅ ந৅ ҟͳΔΞϓϩʔνͰͷ՝୊ղܾ ҟͳΔղܾΞϓϩʔν͔Βڞ௨ͨ͠ղܾΞϓϩʔνΛநग़ ڞ௨ͷ࣮૷՝୊ ϕετϓϥΫςΟε ڞ௨͢ΔղܾΞϓϩʔν

    σβΠϯύλʔϯͱ͸ ֓೦ਤ ڞ௨ͷ࣮૷՝୊ͱϕετϓϥΫςΟεΛఆٛ ࣍ʹɺ͜ͷσβΠϯύλʔϯΛֶͿҙٛʹ͍ͭͯ֬ೝ͍͖ͯ͠·͢
  3. σβΠϯύλʔϯΛֶͿཧ༝͸େ͖ͭ͋͘Δ  ղܾࡦͷ࠶ར༻ ઌਓୡͷܦݧͱ࣮੷ʹΑཱͬͯ֬͞ΕͨσβΠϯύλʔϯʹଇΓɺطग़ͷ՝୊Λૉૣ͘ղܾ ͢Δ͜ͱͰɺσβΠϯύλʔϯΛ༻͍ͯ͸ղܾͰ͖ͳ͍ຊ࣭తͳ՝୊ղܾʹूத͢Δɻ ·ͨɺϕετϓϥΫςΟεʹଇΔͨΊ৽ͨͳόάΛੜΈग़ͮ͠Β͘ͳΔɻ ڞ௨༻ޠɾڞ௨ೝࣝͷཱ֬ σβΠϯύλʔϯͷཧղʹΑΓɺ։ൃऀؒͷίϛϡχέʔγϣϯʹڞ௨ͷޠኮ ղܾ՝୊໊ ύλʔϯ໊

    ͱڞ௨ͷೝࣝ ந৅֓೦ ཱ͕֬͞Εɺઃܭͱ։ൃͷٞ࿦͕ԁ׈ʹਐΉ༷ʹͳ Δɻ݁Ռɺ։ൃ଎౓ͷ޲্ͱɺ՝୊ղܾͷີͳٞ࿦͕Ͱ͖Δ༷ʹͳΔɻ ઃܭɾ։ൃྗͷ޲্ ༏Εͨ՝୊ղܾΞϓϩʔνΛֶͿ͜ͱͰɺૺ۰͢Δ՝୊Λந৅తʹଊ͑ΒΕΔΑ͏ʹͳΓɺ ݁ՌɺίϯτϥΫτ։ൃʹ͓͚Δ՝୊෼ੳ՝୊ղܾྗ͕޲্͢Δɻ
  4. ղܾࡦͷ࠶ར༻ ઌਓୡͷܦݧͱ࣮੷ʹΑཱͬͯ֬͞ΕͨσβΠϯύλʔϯʹଇΓɺطग़ͷ՝୊Λૉૣ͘ղܾ ͢Δ͜ͱͰɺσβΠϯύλʔϯΛ༻͍ͯ͸ղܾͰ͖ͳ͍ຊ࣭తͳ՝୊ղܾʹूத͢Δɻ ·ͨɺϕετϓϥΫςΟεʹଇΔͨΊ৽ͨͳόάΛੜΈग़ͮ͠Β͘ͳΔɻ ཁٻ ՝୊ ղܾࡦ ؔ਺"͸ঝೝ͞ΕͨΞΧ΢ϯτ͚͕ͩ ݺͼग़ͤΔΑ͏ʹ͍ͨ͠ ࣌ؒܦաʹΑͬͯίϯτϥΫτͷৼΔ෣͍Λมߋ͍ͨ͠

    σϙδοτϩοΫҾ͖ग़͠ ίϛοτ͢Δσʔλ͸ൿಗੑΛ୲อ͠ɺ໌Β͔ʹ͢Δ λΠϛϯάͰίϛοτσʔλͷ੔߹ੑ͕อͨΕ͍ͯΔ ͜ͱΛূ໌͍ͨ͠ "DDFTT3FTUSJDUJPO1BUUFSO 4UBUF.BDIJOF1BUUFSO $PNNJUBOE3FWFBM1BUUFSO සग़͢Δ՝୊͸ཱ֬͞ΕͨղܾࡦͰղܾ͢Δ
  5. ڞ௨༻ޠɾڞ௨ೝࣝͷཱ֬ σβΠϯύλʔϯͷཧղʹΑΓɺ։ൃऀؒͷίϛϡχέʔγϣϯʹڞ௨ͷޠኮ ղܾ ՝୊໊ύλʔϯ໊ ͱڞ௨ͷೝࣝ ந৅֓೦ ཱ͕֬͞Εɺઃܭͱ։ൃͷٞ࿦͕ԁ׈ ʹਐΉ༷ʹͳΔɻͦͷ݁Ռɺ։ൃ଎౓ͷ޲্ͱɺ՝୊ղܾͷີͳٞ࿦͕Ͱ͖Δ༷ʹ ͳΔɻ ؔ਺"ͷૢ࡞ಛఆͷΞΧ΢ϯτʹݶఆ͍ͨ͠Μ͚ͩͲ

    ΞΧ΢ϯτ੍ޚͳΒNPEJpFSఆ੍ٛ͠ޚ͢Δʁ NPEJpFSͰ੍ޚ͠Α͏ͱࢥͬͯͨ ͳΔ΄ͲɻΞΧ΢ϯτͷૢ࡞ΛڐՄ͢Δؔ਺΋ඞཁʹͳΔͳ ՝୊ղܾʹɺձ࿩ͷΩϟονϘʔϧΛඞཁͱ͢Δ ͲͷΞΧ΢ϯτʹڐՄ͍ͨ͠Μ͚ͩͬʁίϯτϥΫτΦʔφʔͷΈʁ Φʔφʔͱ,:$௨ͬͨΞΧ΢ϯτ͔ͳ ձ࿩ͷྫ
  6. ΧςΰϦʔ෼ྨͱσβΠϯύλʔϯ $BUFHPSZ 1BUUFSO "DUJPOBOE$POUSPM 1VMM1BZNFOU1BUUFSO
 4UBUF.BDIJOF1BUUFSO
 $PNNJUBOE3FWFBM1BUUFSO
 0SBDMF1BUUFSO "VUIPSJ[BUJPO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