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
なぜBlockchainはRustを選ぶのか #roppongirs / why-blockc...
Search
jkcomment
July 30, 2019
Technology
2
1.7k
なぜBlockchainはRustを選ぶのか #roppongirs / why-blockchain-chooses-rust
2019/07/30 Roppongi.rs #1 登壇資料
jkcomment
July 30, 2019
Tweet
Share
More Decks by jkcomment
See All by jkcomment
DAppsを支えるバックエンド開発の話
jkcomment
2
770
Ethereumを支えるネットワークの話
jkcomment
11
4.8k
Other Decks in Technology
See All in Technology
「家族アルバム みてね」における運用管理・ オブザーバビリティの全貌 / Overview of Operation Management and Observability in FamilyAlbum
isaoshimizu
4
160
watsonx.ai Dojo 環境準備について
oniak3ibm
PRO
0
340
プログラム検証入門
riru
6
880
PDF Viewer作成の今までとこれから
hunachi
0
480
QAに対する超個人的な解釈 / Personal Take on QA
toma_sm
1
130
LLVM/ASMを使った有限体の高速実装
herumi
0
120
Oracle Autonomous Database:サービス概要のご紹介
oracle4engineer
PRO
1
7.1k
【株式会社ELYZA】|GENIAC成果報告会 自社開発モデルプレゼンテーション
elyza
1
320
Jetpack Compose Modifier 徹底解説 / Jetpack Compose Modifier
wiroha
0
200
DevRelの始め方
moongift
PRO
2
400
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
140
JEP 480: Structured Concurrency
aya_ebata
0
130
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
125
16k
Web Components: a chance to create the future
zenorocha
309
42k
In The Pink: A Labor of Love
frogandcode
139
22k
From Idea to $5000 a Month in 5 Months
shpigford
379
46k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
5
480
Documentation Writing (for coders)
carmenintech
65
4.3k
Code Reviewing Like a Champion
maltzj
517
39k
Building an army of robots
kneath
302
42k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
Navigating Team Friction
lara
183
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
190
16k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
89
16k
Transcript
Powered by DMM Blockchain Labs 1 なぜBlockchainは Rustを選ぶのか
自己紹介 - About me @ DMM.com Jikyung Kim(金 志京) ・DMM.com
Blockchain Engineer ・Blockchain研究・開発 ・スニーカー、ロードバイク @jkcomment 2
書籍紹介 - Publishing @ DMM.com 3
Agenda @ DMM.com • Rustの現状 • なぜBlockchainはRustを選ぶのか • まとめ 4
Rustの現状 5
Rust? @ DMM.com • Rustとは? ◦ システムプログラミング言語 ◦ 安全性(型安全、メモリ安全) ◦
速度(C, C++並) ◦ コンパイラが優秀 ◦ FireFox, Dropbox, Dwango etc... 6
Rust? @ DMM.com • Stack Overflow 2018年の調査結果でRustが一番好きな言語に! 7
Rustの現状 @ DMM.com 8
Rustの現状 @ DMM.com 9 Rustやめますか!
Rustの現状 @ DMM.com • Rust実装の有名なサービスがまだない(少ない) • Rust実装の有名なOSSプロジェクトがまだない • システム系 +
組み込み系はC言語1強 • 学習コストが高い • なんか難しそうー 10
なぜBlockchainは Rustを選ぶのか 11
Blockchainとは @ DMM.com • Blockchain? ◦ P2Pで形成されたネットワーク上で動作する分散型台帳システム ◦ 「ブロック」と呼ばれるデータの単位を一定時間ごとに生成し、チェーン のように連結していくことによりデータを保管する
◦ 取引情報やブロックはハッシュ関数で暗号化される 12
Blockchain Nodeの実装例 @ DMM.com • C++: bitcoin, EOS, Zilliqa •
Go: Ethereum, Klaytn, Quorum 13
Blockchain Nodeの実装例 @ DMM.com • C++: bitcoin, EOS, Zilliqa •
Go: Ethereum, Klaytn, Quorum • Rust: Ethereum(Parity), Polkadot(Substrate), Holochain, NEAR, Grin, Conflux, CodeChain, Purple Protocol, Enigma(core), zero-chain, Plasm, Edgeware… 14
なぜRustなのか @ DMM.com • なぜ!? 15
なぜRustなのか @ DMM.com • なぜ!? 16 特に理由はない
なぜRustなのか① - 性能 @ DMM.com • 理由は様々 ◦ Memory Safety
◦ Concurrency ◦ Fast 17
なぜRustなのか② - モジュール @ DMM.com • Blockchainにおける必要な処理 ◦ Networking(P2P) ◦
Cryptography ◦ Consensus ◦ Storage ◦ etc 18
なぜRustなのか② - モジュール @ DMM.com • Blockchainにおける必要な処理 ◦ Networking(P2P) ◦
Cryptography ◦ Consensus ◦ Storage ◦ etc 19
なぜRustなのか② - モジュール(Networking) @ DMM.com • Networking(P2P) ◦ BlockchainはP2Pでネットワークを形成する ◦
P2P(Peer to Peer)? ▪ 対等の者同士が対等な立場で相互にやり取りをおこなう ▪ 実現するために必要な機能が多い • Transport, Discovery, Peer Routing, NAT越えなど 20
なぜRustなのか② - モジュール(Networking) @ DMM.com • libp2p ◦ p2pアプリケーションを実現するために必要なモジュールを提供 21
なぜRustなのか② - モジュール(Cryptography) @ DMM.com • Cryptography ◦ 暗号化関連のモジュールが豊富 22
なぜRustなのか③ - wasm @ DMM.com • wasmとは? ◦ WebAssembly •
他の言語でも書けるじゃん? ◦ Go/C#の場合、runtimeのライブラリが大きすぎてバイナリのサイズが 大きくなるし、C/C++の場合、wasmへのプロセスが面倒 ◦ Rustはバイナリが小さい、楽、wasmにしてもメモリ安全 23
なぜRustなのか④ - Substrate @ DMM.com 24
なぜRustなのか④ - Substrate @ DMM.com • Substrateとは? ◦ Parity社が開発したBlockchain Framework
◦ 誰でも簡単(?)に独自のBlockchainが作れる ◦ Substrateベースのプロジェクトが増えている ▪ zero-chain, Plasm, Edgeware, shasper, ChainX... 25
BlockchainにおけるRustの悪い使い方 @ DMM.com • マクロが便利なのはわかりますが、、、 ◦ コードが理解しづらい ◦ コンパイルエラーは展開後のコードで起こり原因が分かりづらい •
トレイト地獄 • match地獄 26
Blockchain以外のRustの使い道 @ DMM.com • システムプログラミング言語なのでOSが作れる • Webアプリケーション開発もイケる ◦ Rocket, Iron,
actix-webなど • フロントエンド開発もできるぞ!(feat. wasm) 27
番外編① - 個人的にRustが良いと思う理由 @ DMM.com • オブジェクト指向言語好きじゃない • 速さ =
正義 • 堅牢さ = 正義 28
番外編② - 個人的にRustで苦労した話 @ DMM.com • 関数型言語がわからず。。。 ◦ Haskellを勉強しますた •
国内だと情報が少ない ◦ 最近本が色々出始めてますね!嬉しい! 29
まとめ 30
まとめ @ DMM.com • BlockchainでRustが選ばれる理由は特にない ◦ RustはBlockchainでよく選ばれているのは事実 ▪ RustはBlockchainと相性が良い!(かも) •
Blockchain以外でもRustは全然イケる! • ものづくりは楽しむべき。Rustで楽しんで行きましょう! ◦ Blockchain楽しいですよ:D 31
参考 @ DMM.com 32 https://insights.stackoverflow.com/survey/2018#most-loved-dreaded-and-wanted https://www.parity.io/why-rust/ https://lib.rs/cryptography https://www.parity.io/wasm-smart-contract-development/ https://github.com/WebAssembly/meetings/blob/master/2018/CG-04.md#webassembly-in-blockchain https://github.com/paritytech/substrate
https://grin-tech.org/ https://libp2p.io/implementations/ https://github.com/libp2p/specs https://github.com/rust-in-blockchain/awesome-blockchain-rust https://github.com/klaytn/klaytn https://github.com/libra/libra https://github.com/substrate-developer-hub/awesome-substrate https://github.com/darwinia-network/darwinia-appchain https://github.com/servo/servo https://github.com/actix https://github.com/SergioBenitez/Rocket https://github.com/libp2p/rust-libp2p https://github.com/rust-lang/book
Thank you for the attention. Powered by DMM Blockchain Labs
33