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.4k
DAppsを支えるバックエンド開発の話
jkcomment
2
960
Other Decks in Technology
See All in Technology
Point Cloud as a Foreign Language for Multi-modal Large Language Model
takmin
0
360
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
290
AIで開発は速くなったのに、なぜ現場は楽にならないのか 〜あなたの組織のボトルネックを突き止めるワークショップ〜
jacopen
1
130
「ミスを許さない手順書」を作ってみた 〜 個人的にはこれ以上できることはあまりなさそう/20260827-ssmjp-operation-procedure-update
opelab
17
17k
[RSJ26] Hierarchy-Aware Multimodal Retrieval-Augmented Generation for Embodied Question Answering
keio_smilab
PRO
1
140
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.5k
Jetpack Compose で挑む新聞紙面UI ─ 複合ジェスチャー・ポリゴン記事領域・適応的ページ構成という3つの壁/droidkaigi2026
nikkei_engineer_recruiting
0
120
DMMブックスのNext.js化を加速させるAI活用 / Migrating DMM Books to Next.js with AI
kentarom
1
300
会計事務所と顧問先の契約関係をOIDC・OAuthで表現する
terara
0
580
Introduction to Bill One Development Engineer
sansan33
PRO
0
490
【Oracle AI Spotlight ウェビナー】AWSか、Azureか、Google Cloudか。その議論にオラクルを含める意義。
oracle4engineer
PRO
1
190
Bet AI Day 2026丨AIによって本質に戻るシステムリスク管理
layerx
PRO
0
560
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
390
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
230
Bash Introduction
62gerente
615
220k
[SF Ruby Conf 2025] Rails X
palkan
2
1.3k
Designing for Performance
lara
611
70k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
490
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
Deep Space Network (abreviated)
tonyrice
0
280
Test your architecture with Archunit
thirion
2
2.4k
Exploring anti-patterns in Rails
aemeredith
3
490
Agile that works and the tools we love
rasmusluckow
331
22k
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 • 遊びに来てね 最後に
ご清聴ありがとうございました