Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SwiftでBitcoinのscriptを書いてみよう
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shun Usami
September 18, 2018
Programming
360
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SwiftでBitcoinのscriptを書いてみよう
Swiftで書かれたBitcoinKitを使用して、10行以内でBitcoinの受け取りから送金まで、そしてScriptを書いていく方法を説明しています。
Shun Usami
September 18, 2018
More Decks by Shun Usami
See All by Shun Usami
Let's Write Bitcoin Script #TokyoBitcoinHackathon
usatie
7
8.3k
Bitcoin Basic OP_CODEs
usatie
1
310
CustomCellのためのProtocol
usatie
0
490
Other Decks in Programming
See All in Programming
パーソナライズPodcastを作った話
repunit11
0
130
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
100
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
190
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
150
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
740
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
210
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
520
dotNET_vulnclicker_intro.pdf
deka_morita
0
130
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
610
Building the Perfect Custom Keyboard
takai
2
900
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Fireside Chat
paigeccino
43
4.1k
Skip the Path - Find Your Career Trail
mkilby
1
250
Designing Experiences People Love
moore
143
24k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
350
The Language of Interfaces
destraynor
162
27k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
980
Transcript
BitcoinͷscriptΛ ॻ͍ͯΈΑ͏ @usatie Yenom, Inc.
None
とびきりやさしいビットコイン・ウォレットアプリ
はじめてビットコインを使う 友達や家族にオススメなのが Yenomです!
なぜ初⼼者向き? ・セットアップなし ・秘密鍵を意識せずに使える ☺ ・専⾨⽤語なし #
どれくらいカンタンなの? DL後のフローを説明します。
1. 「同意して続ける」をタップ
✅ 完了
\ 最近リリースしました /
BitcoinKitのインストール FDIPHJUIVCZFOPN#JUDPJO,JU$BSUpMF DBSUIBHFVQEBUFQMBUGPSNJ04
今⽇はなすこと 3. ビットコインを送⾦する 1. ビットコインの鍵を⽣成する 2. ビットコインを受けとる 4. ビットコインスクリプトを書いてみる
今⽇はなすこと 3. ビットコインを送⾦する 1. ビットコインの鍵を⽣成する 2. ビットコインを受けとる 4. ビットコインスクリプトを書いてみる
そもそもビットコインとは? 2 ビットコインとは? P2Pタイムスタンプサーバー =改ざんできないDB 何を保存してる? 錠がかかったコイン 2 " "
+
ビットコインの鍵とアドレスの関係 秘密鍵 公開鍵 アドレス ‑ ‑ ੜͰ͖Δ ੜͰ͖Δ
ビットコインの鍵とアドレスの関係 秘密鍵 公開鍵 アドレス ‑ ‑ ٯແཧ ٯແཧ
秘密鍵、公開鍵、アドレスの⽣成
今⽇はなすこと 3. ビットコインを送⾦する 1. ビットコインの鍵を⽣成する 2. ビットコインを受けとる 4. ビットコインスクリプトを書いてみる
Walletの設定、残⾼の更新/確認
今⽇はなすこと 3. ビットコインを送⾦する 1. ビットコインの鍵を⽣成する 2. ビットコインを受けとる 4. ビットコインスクリプトを書いてみる
Bitcoinの送⾦
今⽇はなすこと 3. ビットコインを送⾦する 1. ビットコインの鍵を⽣成する 2. ビットコインを受けとる 4. ビットコインスクリプトを書いてみる
Bitcoin Script
BitcoinのScript Lock Script この2つだけ!✌ Unlock Script :コインに錠をかけるための スクリプト :コインの錠を外すための スクリプト
Bitcoinのアンロック 1. Unlock Script を実⾏ 結果、TRUE が返ってくれば そのコインはアンロック成功 ! 2.
Lock Script を実⾏
Bitcoinの所有権 ・所有権は存在しない ・あるのは 鍵 のみ(公開されている) ・もし@usatieにしかアンロックできない錠が あれば、 実質 @usatieが所有していると⾔える
Bitcoinの所有権 ・所有権は存在しない ・あるのは 鍵 のみ(公開されている) ・もし@usatieにしかアンロックできない錠が あれば、 実質 @usatieが所有していると⾔える @usatieにしかアンロックできない錠
Bitcoinの所有権 ・所有権は存在しない ・あるのは 鍵 のみ(公開されている) ・もし@usatieにしかアンロックできない錠が あれば、 実質 @usatieが所有していると⾔える @usatieにしかアンロックできない錠
= 秘密鍵と公開鍵で実現できる !!
コインの送⾦ @Yenomに送⾦する場合 あるコインに 「@Yenom にしか開けられない錠 」 をセット
Bitcoinはスタックマシン (Ethereumもそうです)
スタックマシンとは 1. 左から順番にコードを実⾏する 2 3 5 add
スタックマシンとは 2. スタックに値を⼊れたり出したりする 2 3 2 3 2
Ex. 2 3 5 Add 2 3 2 5 Add
Ex. 2 3 5 Add 2 3 2 3 2
5 Add
Ex. 2 3 5 Add 2 3 2 3 2
5 5 3 2 Add
Ex. 2 3 5 Add 2 3 2 3 2
5 5 3 2 Add 8 2
Ex. 3 20 8 Add 3 8 20 3 28
3 Mul 84 Mul 20 8 Add
Bitcoinのアンロック 1. Unlock Script を実⾏ 結果、TRUE が返ってくれば そのコインはアンロック成功 ! 2.
Lock Script を実⾏
Bitcoinのアンロック 1. Unlock Script を実⾏ 結果、TRUE が返ってくれば そのコインはアンロック成功 ! 2.
Lock Script を実⾏ TRUE が返ってくれば
Bitcoinのアンロック 1. Unlock Script を実⾏ 結果、TRUE が返ってくれば そのコインはアンロック成功 ! 2.
Lock Script を実⾏ TRUE が返ってくれば スタックの最後に 残っている値が TRUE であれば =
おさらい Unlock Script Lock Script スタックに TRUE が残ればコインの解錠成功! 次は具体例へ! ①
② の順に実⾏し、
5 Unlock Script 2 Lock Script 3 Add Equal 5
3 5 3 2 5 5 5 TRUE 2 Add Equal ① ②
5 Unlock Script 2 Lock Script 3 Add Equal ①
②
Scriptの実⾏
None
# ビットコインしろ
9/22 - 9/23 @渋⾕
# Congrats! " :yusho:
ありがとうございました。 ハッカソンの申し込みはこちらから!