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
Ethereumを支えるネットワークの話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
970
Other Decks in Technology
See All in Technology
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.1k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
Cloudflare Workers 向けアプリを C# で構築する ~WASM Native AOT への道~
nenonaninu
1
430
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
960
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
3
550
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
170
What the customer really needed
kawaguti
PRO
3
210
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
2.1k
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.3k
品質と信頼性を地続きにする
grimoh
2
790
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
320
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
160
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Done Done
chrislema
186
16k
The SEO Collaboration Effect
kristinabergwall1
1
570
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
810
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 • 遊びに来てね 最後に
ご清聴ありがとうございました