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

bitcoinトランザクション総復習 #blockchainkyoto

bitcoinトランザクション総復習 #blockchainkyoto

blockcahin勉強会@kyoto #2 発表資料

Yusuke Egami

April 26, 2018
Tweet

More Decks by Yusuke Egami

Other Decks in Technology

Transcript

  1. #5$ #5$ #5$ */165 065165 #5$ #5$ ߹ܭɹ#5$ ߹ܭɹ#5$ ࠩ෼ɹ#5$ʢख਺ྉʣ

    w ̍ͭ·ͨ͸ෳ਺ͷ*/165ͱ̍ͭ·ͨ͸ෳ਺ͷ065165͔Β੒Δ w */165065165ख਺ྉͱͳΔ w τϥϯβΫγϣϯͷதʹख਺ྉΛ໌͍ࣔͯ͠ΔՕॴ͸ͳ͍ τϥϯβΫγϣϯͷ֓ཁ
  2. τϥϯβΫγϣϯͷ֓ཁ w JOQVUͱPVUQVUͷ૊Ͱߏ੒ w JOQVU͸ৗʹผͷτϥϯβΫγϣϯͷPVUQVU 6590 Λࢀর 5Y JOQVU PVUQVU

    PVUQVU 5Y JOQVU PVUQVU PVUQVU JOQVU JOQVU 5Y JOQVU PVUQVU PVUQVU JOQVU 6590 6590 6590 6590 6590ʢະ࢖༻τϥϯβΫγϣϯΞ΢τϓοτʣͱ͸ τϥϯβΫγϣϯΞ΢τϓοτͷ͏ͪɺ·ͩΠϯϓοτͱͯ͠࢖༻͞Ε͍ͯͳ͍΋ͷ
  3. τϥϯβΫγϣϯͷ֓ཁ JOQVU PVUQVU <>Ϙϒʹ#5$ 5Y˛ग़ྗ ΞϦε JOQVU PVUQVU <>Ωϟϩϧʹ#5$ Ϙϒ

    JOQVU PVUQVU <>Ϙϒʹ#5$ φϯγʔ <>δϣϯʹ#5$ 5Y 5Y 5Y 5Yग़ྗ<> 5Yग़ྗ<> ߹ܭ#5$ ߹ܭ#5$ 5Y˔ग़ྗ τϥϯβΫγϣϯͷΠϯϓοτ͸ 6590΁ͷϙΠϯλͦͷ΋ͷ w JOQVUͱPVUQVUͷ૊Ͱߏ੒ w JOQVU͸ৗʹผͷτϥϯβΫγϣϯͷPVUQVU 6590 Λࢀর
  4. bitcoin script w τϥϯβΫγϣϯͰ༻͍ΒΕΔεΫϦϓτݴޠ w ελοΫͱݺ͹ΕΔσʔλߏ଄ w νϡʔϦϯάෆ׬શੑ w ϧʔϓ΍෼ذ͕ͳ͍

    w ෳࡶͳ͜ͱΛग़དྷͳ͘͢Δ͜ͱͰCJUDPJOωοτϫʔΫʹର͢ Δ߈ܸΛ੍ݶ͢Δ w εςʔτϨε w ঢ়ଶΛ࣋ͨͳ͍ͷͰͲΜͳγεςϜͰ΋ಉ͡ϓϩηεɺݕূ ݁ՌͱͳΔ
  5. bitcoin script Locking Script ͱ Unlocking Script w -PDLJOH4DSJQU͸τϥϯβΫγϣϯΞ΢τϓοτʹؚ·ΕΔɺͦͷΞ΢τϓο τͷ࢖༻৚݅ͷTDSJQU

    w 6OMPDLJOH4DSJQU͸τϥϯβΫγϣϯΠϯϓοτʹؚ·ΕΔɺΞ΢τϓο τͷMPDLΛຬͨ͢TDSJQU w -PDLJOH4DSJQUͱ6OMPDLJOH4DSJQU͸ͭܨ͛ͯҰͭͷϓϩάϥϜʹͳΔ w ϊʔυ͕ϓϩάϥϜΛCJUDPJOTDSJQUͱ࣮ͯ͠ߦͯ͠ਖ਼͍͔͠ݕূ w ਖ਼͍͠ͱ͸εΫϦϓτͷ࣮ߦ݁Ռ͕536&Ͱ͋Δ͜ͱ -PDLJOH4DSJQU 6OMPDLJOH4DSJQU 0, ϊʔυ ݕূ /(
  6. P2PKH (Pay-to-Public-Key-Hash) w 01@)"4)ɿ5IFJOQVUJTIBTIFEUXJDFpSTUXJUI4)"BOEUIFOXJUI3*1&.% w 01@&26"-7&3*':ɿ4BNFBT01@&26"- CVUSVOT01@7&3*':BGUFSXBSE w 01@7&3*':ɿ.BSLTUSBOTBDUJPOBTJOWBMJEJGUPQTUBDLWBMVFJTOPUUSVF5IFUPQTUBDLWBMVFJT SFNPWFE

    w 01@$)&$,4*(ɿ5IFFOUJSFUSBOTBDUJPOTPVUQVUT JOQVUT BOETDSJQU GSPNUIFNPTUSFDFOUMZ FYFDVUFE01@$0%&4&1"3"503UPUIFFOE BSFIBTIFE5IFTJHOBUVSFVTFECZ01@$)&$,4*( NVTUCFBWBMJETJHOBUVSFGPSUIJTIBTIBOEQVCMJDLFZ*GJUJT JTSFUVSOFE PUIFSXJTF IUUQTCJUDPJOCPPLJOGPXQDPOUFOUUSBOTMBUJPOTKBCPPLQEGϖʔδʹελοΫͷڍಈͷਤ 1VCMJD,FZ)BTI͸CJUDPJOΞυϨε͔Β#FTFEFDPEFͯ͠ಘΒΕΔ τϥϯβΫγϣϯશମΛϋογϡͨ͠΋ͷ΁ͷॺ໊ CJUDPJOϊʔυͰ࣮ߦ͞ΕΔ
  7. Ϛϧνγάωνϟ Ϣʔεέʔε w /ݸͷެ։伴ͱ.ݸͷॺ໊͕ೖ͍ͬͯΔTDSJQU w .PG/ͱදݱ w /͸Ωʔͷ૯਺ɺ.͸ඞཁͳॺ໊ͷ਺Ͱ͢ w ྫ͑͹PGͳΒݸͷެ։伴ʹରͯ͠ݸͷॺ໊Λ༻͍ͳ͍ͱ͍͚·ͤΜ

    w ෳ਺ਓͰ؅ཧ͢ΔΞυϨεͰҰఆ਺Ҏ্ͷڐՄ͕ͳ͍ͱಈ͔ͤͳ͍ΞυϨε w ඞཁͳΩʔΛ૿΍͢͜ͱͰ࿙Ӯʹର͢Δ଱ੑΛ͚ͭΔ w $ࣾͷ/&.ࣄ݅ͰϚϧνγάϚϧνγά࿈ݺ͞Εͯ·ͨ͠Ͷ w ݸਓͰPG/ͷΞυϨεΛ؅ཧ͢ΔͱҰͭΩʔΛͳͯ͘͠΋όοΫΞοϓͱͯ͠ಇ͘
  8. P2SH (Pay-to-Script-Hash) w ΑΓ୹͍ϑΟϯΨʔϓϦϯτͰෳࡶͳTDSJQUΛஔ͖׵͑Δ͜ͱͰɺτϥϯβΫγϣϯͷσʔλαΠζΛ খ͘͢͞Δ w TDSJQU͕ΞυϨεͱ࣮ͯ͠૷͞ΕΔ͜ͱͰɺૹΓओͱૹΓओͷ΢ΥϨοτ͸14)ʹؔ͢Δෳࡶͳ࣮૷ Λ͢Δඞཁ͕ͳ͍ w 14)͸ɺTDSJQUΛߏ੒͢Δෛ୲ΛૹΓखͰ͸ͳ͘ड͚खଆʹҠ͍ͯ͠Δ

    w 14)͸ɺΞ΢τϓοτ͕࣋ͭ௕͍TDSJQU ͜Ε͸6590ηοτʹؚ·ΕΔͨΊϝϞϦΛѹഭ͢Δ ΛΠϯ ϓοτଆ ϒϩοΫνΣʔϯ্ʹͷΈอଘ͞ΕΔ ʹҠ͢͜ͱͰσʔλετϨʔδͷෛ୲ΛΠϯϓοτଆ ʹҠ͍ͯ͠Δ w 14)͸ɺࢧ෷͍࣌఺ʹੜ͡Δ௕͍TDSJQUΛࢿ͕ۚ࢖ΘΕΔ࣌఺Ͱੜ͡ΔΑ͏ʹ͢Δ͜ͱͰɺσʔλε τϨʔδͷෛ୲͕ੜ͡Δ࣌ࠁΛະདྷʹҠ͍ͯ͠Δ w 14)͸ɺૹΓख͕௕͍TDSJQUΛ൐ͬͯࢿۚΛૹΔͱ͖ʹෛ୲͢ΔτϥϯβΫγϣϯख਺ྉΛɺड͚ख ͕SFEFFNTDSJQUΛ࢖ͬͯࢿۚΛ࢖͏ͱ͖ʹෛ୲͢ΔΑ͏ʹมߋ͍ͯ͠Δ 14)͸MPDLJOHTDSJQUΛෳࡶͳ··௚઀ѻ͏͜ͱʹൺ΂ͯҎԼͷར఺͕͋Γ·͢ɻ