Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Bitcoin Basic OP_CODEs
Search
Shun Usami
June 23, 2018
Technology
1
280
Bitcoin Basic OP_CODEs
Let's enjoy Bitcoin OP_CODEs!
Shun Usami
June 23, 2018
Tweet
Share
More Decks by Shun Usami
See All by Shun Usami
Let's Write Bitcoin Script #TokyoBitcoinHackathon
usatie
7
7.9k
SwiftでBitcoinのscriptを書いてみよう
usatie
2
330
CustomCellのためのProtocol
usatie
0
470
Other Decks in Technology
See All in Technology
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
【LT】ソフトウェア産業は進化しているのか? #Agilejapan
takabow
0
110
AGIについてChatGPTに聞いてみた
blueb
0
130
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
790
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
Terraform Stacks入門 #HashiTalks
msato
0
360
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
670
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
190
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
The Rise of LLMOps
asei
9
1.8k
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Six Lessons from altMBA
skipperchong
27
3.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
A designer walks into a library…
pauljervisheath
204
24k
Bash Introduction
62gerente
608
210k
Docker and Python
trallard
40
3.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Writing Fast Ruby
sferik
627
61k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
The Language of Interfaces
destraynor
154
24k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Transcript
BITCOIN BASIC OP_CODES @usatie
WHAT IS BITCOIN? WHAT IS BITCOIN? ▸ Q1 : Bitcoinͱʁ
▸ A1 : վ᜵Ͱ͖ͳ͍σʔλϕʔε ▸ Q2 : ԿΛอଘ͍ͯ͠Δʁ ▸ A2 : ৣ͕͔͔ͬͨίΠϯ
LOCK & UNLOCK BITCOIN LOCK & UNLOCK BITCOIN ▸ Lock
Script : ίΠϯʹ伴Λ͔͚ΔͨΊͷεΫϦϓτ ▸ Unlock Script : ίΠϯͷ伴Λղৣ͢ΔͨΊͷεΫϦϓτ ▸ [Unlock Sceript] [Lock Script]ͷॱ൪ʹ࣮ߦͨ݁͠ՌɺTrue ͕ฦͬͯདྷΕͦͷίΠϯ༻Մೳʂ ʢʹScriptPubkeyʣ ʢʹScriptSigʣ
WHAT IS STACK MACHINE? WHAT IS STACK MACHINE? ▸ BitcoinͷεΫϦϓτελοΫϚγϯ্Ͱ࣮ߦ͞ΕΔ
▸ ελοΫϚγϯͱԿ͔ɺҎԼͷྫΛݟͯΈ·͠ΐ͏ʂ ▸ ex. [3] [20] [8] [ADD] [MUL] 8 20 3 28 3 84
SUCCESSFUL UNLOCK SUCCESSFUL UNLOCK ▸ [Unlock script] [Lock script]ͷॱ൪ʹ࣮ߦ͠ɺελοΫͷ࠷ޙʹTRUE͕ ΕίΠϯͷղৣޭʂ
▸ Lock script : [2] [3][ADD] [EQUAL] ▸ Unlock script : [5] 3 2 5 5 5 TRUE
UNLOCK FAILURE UNLOCK FAILURE ▸ Lock script : [19] [2]
[SUB] [EQUAL] ▸ Unlock script : [8] 2 19 8 17 8 FALSE
P2PK SCRIPT PAY TO PUBLIC KEY ▸ OP_CHECKSIG : (sig
pubkey) -> TRUE/FALSE ▸ pubkeyʹରԠ͢Δൿີ伴Ͱॺ໊͞Εͨsig͔Ͳ͏͔ݕূ
P2PKH SCRIPT PAY TO PUBLIC KEY HASH ▸ OP_DUP :
x -> x x ▸ OP_HASH160 : pubkey -> pubkeyHash ▸ OP_VERIFY : Ұ൪্͕TRUE͡Όͳ͔ͬͨΒଈ࠲ʹFail
LOCK UNTIL SCRIPT LOCK UNTIL ▸ OP_CHECKLOCKTIMEVERIFY : time ->
time/Fail ▸ ͠ݱࡏ࣌ࠁ͕timeΑΓલͩͬͨΒଈ࠲ʹFail ▸ OP_DROP : Ұ൪্ͷσʔλΛআ
M-OF-N MULTISIG SCRIPT M-OF-N MULTISIG ▸ OP_CHECKMULTISIG : <sig1>…<sigN> M
<pub1>… <pubN> N -> TRUE/FALSE ▸ Nݸͷpubkeyͷ͏ͪɺͦΕΒʹରԠ͢ΔMݸͷൿີ伴Ͱ ॺ໊Ͱ͖͍ͯΔ͔ݕূ
REFERENCE DOCUMENT AND SOURCECODE ▸ https://en.bitcoin.it/wiki/Script ▸ Bitcoin’s Source code
src/script/interpreter.cpp