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
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
950
Other Decks in Technology
See All in Technology
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
370
仕様駆動開発、導入半年。「本当に速くなってるの?」にデータで答える / AICon2026_hirakawa
rakus_dev
0
320
生成 AI 時代にいま一度「問い合わせ」について考えてみる
kazzpapa3
1
130
AI x 開発生産性を取り巻く予算戦略と投資対効果
i35_267
7
2.9k
Type-safe IaC for Dart
coborinai
0
180
AI時代の開発生産性を捉え直す — 経営と現場をつなぐ「開発組織のオブザーバビリティ」— / AI Dev Ex Conference 2026
tkyowa
1
1.3k
Webの技術とガジェットで子どもも大人も楽しめるワクワク体験を提供する / Qiita Tech Festa Day 2026
you
PRO
1
170
AICoEでAIネイティブ組織への進化
yukiogawa
0
220
OPENLOGI Company Profile for engineer
hr01
1
74k
「休む」重要さ
smt7174
6
1.6k
AI時代の開発生産性は、個人技からチーム設計へ
moongift
PRO
4
2.5k
Aurora MySQL 8.4リリース! Rubyistが備えること / what-rubyist-should-prepare-for-aurora-mysql-8-4
fkmy
0
750
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
KATA
mclloyd
PRO
35
15k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
How to Talk to Developers About Accessibility
jct
2
430
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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 • 遊びに来てね 最後に
ご清聴ありがとうございました