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
Sharding
Search
wshino
June 26, 2018
Technology
4
1k
Sharding
6/26のビットコインとか勉強会#19の発表資料です。
wshino
June 26, 2018
Tweet
Share
More Decks by wshino
See All by wshino
Past, Present and Future
wshino
1
410
libp2p
wshino
7
1.2k
Superiority of Rust
wshino
3
350
Try Cross Compile Then Fail
wshino
0
140
GORMOS - A high performance and scalable design for decentralized applications -
wshino
4
1.8k
DAppのデプロイ戦略 / DApp Deployment Strategy
wshino
3
1.7k
Plasma Debit
wshino
2
1.9k
ブロックチェーン技術の登場とスマートコントラクト化する社会
wshino
5
5.2k
Truffle + Drizzle と、Ethereumの概況について
wshino
2
1.2k
Other Decks in Technology
See All in Technology
Goで作って学ぶWebSocket
ryuichi1208
3
1.6k
2/18/25: Java meets AI: Build LLM-Powered Apps with LangChain4j
edeandrea
PRO
0
130
急成長する企業で作った、エンジニアが輝ける制度/ 20250214 Rinto Ikenoue
shift_evolve
3
1.3k
人はなぜISUCONに夢中になるのか
kakehashi
PRO
6
1.7k
リアルタイム分析データベースで実現する SQLベースのオブザーバビリティ
mikimatsumoto
0
1.4k
JEDAI Meetup! Databricks AI/BI概要
databricksjapan
0
150
君も受託系GISエンジニアにならないか
sudataka
2
440
RSNA2024振り返り
nanachi
0
590
一度 Expo の採用を断念したけど、 再度 Expo の導入を検討している話
ichiki1023
1
170
Swiftの “private” を テストする / Testing Swift "private"
yutailang0119
0
130
ハッキングの世界に迫る~攻撃者の思考で考えるセキュリティ~
nomizone
13
5.2k
スタートアップ1人目QAエンジニアが QAチームを立ち上げ、“個”からチーム、 そして“組織”に成長するまで / How to set up QA team at reiwatravel
mii3king
2
1.5k
Featured
See All Featured
The Language of Interfaces
destraynor
156
24k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
Testing 201, or: Great Expectations
jmmastey
42
7.2k
Designing for humans not robots
tammielis
250
25k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Practical Orchestrator
shlominoach
186
10k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.8k
KATA
mclloyd
29
14k
4 Signs Your Business is Dying
shpigford
182
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Transcript
sharding ビットコインとか勉強会 2018.6 DMM.comラボ スマートコントラクト事業部 篠原航
本日のアジェンダ • スケーラビリティ問題 • shardingとは • sharding phase 1
自己紹介 篠原航 DMMスマートコントラクト事業 部テックリード。計算リソース の効率化、継続的デリバリや デプロイの開発を支える仕組 み作り、ウォレットの実装を担 当。最近ヨーヨーにはまってい て、ループザループを習得し たい。
https://www.amazon.co.jp/dp/4839965137/
Caution! 6/24に発表された Casper + Shardingの同時実装の話ではありません。 こちらはまた追って解説します。 https://ethresear.ch/t/convenience-link-to-full-casper-chain-v2-spec/2332
スケーラビリティ問題 Shardingとは Sharding Phase 1 Section01 Section02 Section03
スケーラビリティ問題 • 全てのノードが同じ処理をする • 全てのノードが同じ状態を持つ • ハッシュパワーが上がってもtxスピードは変わらない Node 10tx/s Node
10tx/s New! DatabaseでいうとMulti-Masterの状態 タスク、みんなと一緒。。
スケーラビリティの解決方法 • Raiden ◦ 家の外で遊ぶ • Plasma ◦ 隣の部屋で遊びながら都度報告してくれる
Raiden • Off Chainのスケーリングソリューション ◦ Lightning NetworkのEthereum版 • 状態遷移をオフチェーンでやり取りする •
State(Payment) Channelと言われる On-Chain Off-Chain ここでのやり取りは記録さ れない
Plasma • Side Chainのスケーリングソリューション • Main ChainにPlasma Chainを接続 • Plasmaに処理を移譲
On-Chain Plasma-Chain ここでのやり取りは Plasma Chainに記録。適 宜Merkle RootをMain Chainに公開する
Plasmaの現状 • 2017年に公開 • 様々な提案がなされている ◦ Plasma ◦ Minimal Viable
Plasma ◦ More Viable Plasma ◦ Plasma Cache, Plasma XT, Plasma Debit
スケーラビリティ問題 Shardingとは Sharding Phase 1 Section01 Section02 Section03
データベースのSharding • MySQLであれば、PartitioningとかSpider Engineとか ◦ データを水平に分割してデータ容量と処理性能をかせぐ Alice Bob Charlie Dave
EthereumのSharding • On Chainのスケーラビリティソリューション • Off Chain, Side Chainではなく、Main Chain(Ethereum本体)を改良
◦ ハードフォークの必要性がある • PoSに移行することが前提
Shardingの構成 • Main ChainをK個の断片に分割する ◦ アドレスごとに分割する • 各断片では全体のtxを並列に処理する • 理論値
= Main Chainの処理性能 x K
Shardingのロードマップ Phase 1 ◦ 基本的なshard ◦ EVMなし Phase 2 ◦
EVM実装 Phase 3 ◦ Executor ◦ ライトクライアントの実装 Phase 4 ◦ Shard間のコミュニケーション Phase 5 ◦ Main Chainのセキュリティと密結合 Phase 6 ◦ Shard内でのShard ◦ ロードバランシング
スケーラビリティ問題 Shardingとは Sharding Phase 1 Section01 Section02 Section03
用語の解説 • Collation ◦ Collation Header • Period • Proposer
• Collator • Sharding Manager Contract • Lookahead Period • Executor (Phase3)
Collation, Collation Header • Main Chainと異なる用語を使う
Collation内部構造 shard_id : Collationの番号 parent_hash : 前のCollationのハッシュ chunk_root : txをmerklizeしたroot
period : Collationが入るPeriodの番号 proposer_address : Collationを提出したユーザーアドレス proposer_bid : Collatorに渡す報酬 proposer_signature : Proposerの署名 Collation Header Collation Body collation_body : txを32byteのchunkにしたもの Collation
Period • Main Chainで決めている周期の単位 ◦ PERIOD_LENGTH = 5であればMain Chainの5blockごとにPeriod が切られている
Period 1 Period 2
Proposer • blob(tx)を拾いchunkにエンコードする • chunkをchunk treeにしてchunk rootをcollation headerに入れる blob 1
blob 2 ... blob i chunk 1 chunk 2 ... chunk j 32byte単位 chunk 1 chunk 2 chunk 3 chunk 4 chunk root
Proposer • collationを作成してCollatorに渡す collation Proposer Collator
Collator • Proposerから受け取ったcollationを検証する • 検証後、shard内のチェーンにcollationを繋げる Collator collation Validate collation collation
collation New! chaining
Collator • Periodごとにcollation headerをMain Chainに送信する Collator collation header Main Chain(SMC)
Sharding Manager Contract(SMC) • PeriodごとにCollatorを各shardに割り振る
Sharding Manager Contract(SMC) • PeriodごとにProposerを登録する • Collatorのdepositを管理し、collationを検証し、不正なら提出した Collatorからdepositを没収する Collator invalid
collation header SMC No!
Lookahead Period • Collatorが先にどこのShardに配属されるかを教える ◦ LOOKAHEAD_PERIODS = 4 ◦ 4Period前にStateをダウンロード
◦ Collatorは準備期間が持てる
Executor • Phase3で実装予定 ◦ ProposerがExecutorを兼ねる • txの処理を行う • コントラクトのコードを実行する(EVMはphase2で実装予定) •
状態遷移の結果を提示する
流れ Proposer Main Chain(SMC) Collator 1. Proposer -> SMCにdeposit 2.
Collator -> SMCにdeposit Shard 1 ... Shard 2 Shard n
流れ Main Chain(SMC) Collator 3. Collator -> SMC、どこのShard に割り振られているのか定期的 に確認
4. 割り当てられていたら Lookahead Period期間に ShardのStateをダウンロードす る どこのShard? Shard 1 ... Shard 2 Shard n Download Shard 2 Proposer
流れ Collator 5. Proposer -> Collator、 Proposal Bidと署名を入れて collationを提出 6.
Collator、collationを検証して Proposal bidをもらう 7. 前のcollationに5で受け取った collcationを繋げる Proposer collation Validate collation collation collation New! Get bid Shard 2
流れ Collator 5. PeriodごとにCollation Header をSMCに送る Proposer collation
悪意のあるCollatorがいた時は • シャッフルされた後のCollatorがheadのCollationの不正を見つける • 遡って検証してフォークする • フォークした正しいcollation headerをMain Chainに送信する
• PeriodごとにSMCでCollatorを入れ替える ◦ 入れ替え作業はMain Chainで行う Phase1の問題 入れ替えはtxの承認を待つので、 その間shard側の処理ができない
Phase1の問題 • Shardは常にCollatorによって処理をしつつ、適切なタイミングでMain Chainから値を受け取るようなcross-linkにできないか? • S2MC link
ZilliqaのSharding • ZilliqaではShardingを実現している • Ethereumとの違い ◦ ネットワークの分割で並行処理する ◦ 状態ごとに分割していない(Full State)
• 特定のアドレスを処理するShardは固定している • Shard内でブロックを生成し、特権ノードに送信 • 特権ノードが各Shardにブロックをブロードキャスト
KyberNetworkのSharding • Gormos ◦ KyberNetworkが用意する独自のPlasma Chain ◦ Plasma Chainの中でShardingする ◦
テクニカルペーパーがそろそろ出る
• DMMでは様々な人材を募集しています ◦ https://dmm-corp.com/recruit/top • 私はブロックチェーンと AIと量子コンピュータについて対話できる人を募集しています 最後に