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
Ethereumを支えるネットワークの話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
jkcomment
July 24, 2018
Technology
5.3k
11
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ethereumを支えるネットワークの話
blockchain.tokyo #10登壇資料
jkcomment
July 24, 2018
More Decks by jkcomment
See All by jkcomment
なぜBlockchainはRustを選ぶのか #roppongirs / why-blockchain-chooses-rust
jkcomment
2
2.3k
DAppsを支えるバックエンド開発の話
jkcomment
2
940
Other Decks in Technology
See All in Technology
トークン数だけでは測れない — Claude Code 組織展開の効果検証から学んだこと
makikub
0
130
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
260
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
310
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
510
はじめてのDatadog
kairim0
0
290
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
4
810
「速く作る」から「正しく作る」へ ─ 生成AI時代の開発フロー改革の ロードマップと実行 ─
starfish719
0
8.2k
Unlocking the Apps
pimterry
0
250
AI Engineering Summit Tokyo 2026 AIの前に、やることがある 〜医療データ企業の4フェーズ〜
dtaniwaki
0
2k
Claude Codeを組織で使いこなす— サーバサイドAIエージェント運用の実践知
techtekt
PRO
0
210
Sony_KMP_Journey_KotlinConf2026
sony
2
210
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/3 - 2026/5
oracle4engineer
PRO
1
200
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
260
The Invisible Side of Design
smashingmag
302
52k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
WENDY [Excerpt]
tessaabrams
11
38k
Mind Mapping
helmedeiros
PRO
1
240
Making Projects Easy
brettharned
120
6.7k
How to make the Groovebox
asonas
2
2.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
How to Talk to Developers About Accessibility
jct
2
220
Agile that works and the tools we love
rasmusluckow
331
21k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
210
Transcript
Ethereumを支える ネットワークの話 BLOCKCHAIN.TOKYO #10 2018.7.24 DMM.comラボ スマートコントラクト事業部 金志京
自己紹介 2016年9月 株式会社DMM.comラボ(現 合同会社DMM.com)入社 2017年まではWebRTCの人でした。が、2018年からはBlockchainの人です。 趣味: 育児、ロードバイク、最近はスニーカー 金 志京(きむ じぎょん)
Twitter: @jkcomment
本日のアジェンダ • ちょっとだけP2Pの話 • Ethereumのネットワークの話 • まとめ
入る前に • 外部勉強会は初登壇です • go-ethereumの実装&wikiベース(ほぼ) • ソースコードと各プロトコルの 細かいスペックは出ません(ほぼ)
本日のゴール 1. ノードを生成して 2. どのように他のノードを探索して 3. どのように他のノードと接続して 4. どのようにデータのやり取り(同期とか)をするか ...をわかっていただければ
ちょっとだけP2Pの話 Ethereumのネットワークの話 まとめ Section01 Section02 Section03
P2Pとは Peer to Peer(ピア・トゥ・ピア または ピア・ツー・ピア)とは、 複数の端末間で通信を行う際のアーキテクチャのひとつで、 対等の者(Peer、ピア)同士が通信をすることを特徴とする通信方式、通信 モデル、あるいは通信技術の一分野を指す。 wikipediaより
P2Pの種類 - ① Hybrid • Peerの位置情報およびデータ保存情報を Indexサーバに保存し、個別のPeerの接続を 管理する方式 • メ:
Indexサーバがノード探索を担当するため 設計と管理が安易 • デ: Indexサーバが攻撃されると、 新規Nodeは参加できなくなる
P2Pの種類 - ② Pure • ノード探索も、情報の保持もノード自分で 行う方式 • メ: 耐障害性高さ
• デ: 実装が難しい、セキュリティ制御も難 しい
ちょっとだけP2Pの話 Ethereumのネットワークの話 まとめ Section01 Section02 Section03
EthereumのProtocol
EthereumのProtocol
EthereumのProtocol
ÐΞVp2p • Transport Layer(Network Layer & Presentation Layer) • Kademlia-like
DHT • 全てのデータはRLPでエンコードする(RLPx) • データのやり取りはTCP、ネットワークの維持(探索・確認)はUDP • 使用ポートは30303
ノード探索(Node Discovery)
ノード探索(Node Discovery) • Kademliaベースのノード探索アルゴリズム • Node ID = secp256k1 Public
key • Node間(n₁, n₂)の距離 = keccak256(n₁) XOR keccak256(n₂)
ノード探索(Node Discovery)
ノード探索(Node Discovery)
接続(RLPx Protocol)
接続(RLPx Protocol) 2種類のHandshakeを行う • Encrypted handshake • Protocol handshake
接続(RLPx Protocol) Encrypted handshake • Node A ◦ 認証メッセージの初期化(主に署名に関する処理) ▪
メッセージの内容: • 公開鍵、署名、Nonceなど ◦ 認証メッセージをRLPでエンコード ◦ Node Bの公開鍵で暗号化し、EIP8フォーマットのpacket に変換 ◦ コネクションに書き込む(Write)
接続(RLPx Protocol) Encrypted handshake • Node B ◦ 受信したパケットを自分の秘密鍵で復号化し、 内容を検証
◦ Response用認証メッセージ生成 ▪ メッセージ内容 • 公開鍵、署名、Nonceなど ◦ 認証メッセージをRLPでエンコード ◦ Node Aの公開鍵で暗号化し、EIP8フォーマットのpacket に変換 ◦ コネクションに書き込む(Write)
接続(RLPx Protocol) Protocol handshake • Helloメッセージを送り合う • Helloメッセージのやり取りが終わるまで packetの送・受信はできない •
Helloメッセージを送って、5秒以内に返信がな いとTimeOut処理が走る
Ethereum Wire Protocol
Ethereum Wire Protocol • Application Layer • Ethereum(eth)、Whisper(shh)、Swarm(bzz) etc. •
シンプルな識別コード
識別コード メッセージ 説明 0x00 Status Ethereum状態情報を伝送 0x01 NewBlockHashes 新しいブロックヘッダを伝送 0x02
Transactions トランザクションを伝送 0x03 GetBlockHeaders ブロックヘッダ要求 0x04 BlockHeaders ブロックヘッダ応答 0x05 GetBlockBodies ブロックボディ要求 0x06 BlockBodies ブロックボディ応答 0x07 NewBlock 新しいブロックボディを伝送 0x08 BlockHashesFromNumber ブロックハッシュと番号を要求 0x0d GetNodeData ノードデータ要求 0x0e NodeData ノードデータ応答 0x0f GetReceipts レシート要求 0x10 Receipts レシート応答 Ethereum Wire Protocolメッセージ一覧
ノード間同期処理 1. Node Aは、自分の状態情報を送信 (Total Difficulty, Block hash) 2. Node
Bは、自分の状態情報を返信 3. TDとBlock hashを比較 4. Get Block Headers 5. Block Headers 6. 情報をダウンロード
ちょっとだけP2Pの話 Ethereumのネットワークの話 まとめ Section01 Section02 Section03
まとめ
まとめ • EthereumにはÐΞVp2pプロトコルと Ethereum Wire Protocolがある。 • ÐΞVp2pプロトコルでノード探索を行い、 P2Pオーバーレイネットワークを形成する。 •
Ethereum Wire Protocolで実際のブロックチェーンの データのやりとりを行う。(送・受信手段はRLPx)
• DMMでは様々な人材を募集しています ◦ https://dmm-corp.com/recruit/top • 遊びに来てね 最後に
ご清聴ありがとうございました