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.8k
SwiftでBitcoinのscriptを書いてみよう
usatie
2
320
CustomCellのためのProtocol
usatie
0
470
Other Decks in Technology
See All in Technology
Datadog Cloud SIEMを使ってAWS環境の脅威を可視化した話/lifeistech-datadog-cloud-siem
gidajun
0
480
テスト・設計研修【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
170
[NIKKEI Tech Talk] KDDI/KAG Scrum & Community for Engineering Training
curanosuke
2
220
可視化プラットフォームGrafanaの基本と活用方法の全て
hamadakoji
0
230
Azure AI ことはじめ
tsubakimoto_s
0
130
推薦システムを本番導入する上で一番優先すべきだったこと~NewsPicks記事推薦機能の改善事例を元に~
morinota
0
120
DevIO2024_レガシー運用からの脱却 -クラウド活用の実践事例とベストプラクティス-
jun2882
0
210
成長期に歩みを止めないための創業期の開発文化形成
mayah
6
420
AWSでRAGを作る法方
sonoda_mj
1
140
LINE WORKSへ簡単通知!Incoming Webhookアプリの紹介
mmclsntr
0
110
Matterport を使ってクラスメソッド各拠点のバーチャルオフィスツアーを作成してみた
wakatsuki
0
160
What is DRE? - Road to SRE NEXT@広島
chanyou0311
3
620
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
423
64k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
34
1.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
15
4.9k
GitHub's CSS Performance
jonrohan
1026
450k
Imperfection Machines: The Place of Print at Facebook
scottboms
262
13k
Teambox: Starting and Learning
jrom
130
8.6k
Practical Orchestrator
shlominoach
185
10k
A designer walks into a library…
pauljervisheath
201
24k
Designing the Hi-DPI Web
ddemaree
276
34k
Large-scale JavaScript Application Architecture
addyosmani
506
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
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