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
1.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
430
libp2p
wshino
7
1.3k
Superiority of Rust
wshino
3
360
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.3k
Truffle + Drizzle と、Ethereumの概況について
wshino
2
1.2k
Other Decks in Technology
See All in Technology
初めてのAzure FunctionsをClaude Codeで作ってみた / My first Azure Functions using Claude Code
hideakiaoyagi
1
190
Amazon S3標準/ S3 Tables/S3 Express One Zoneを使ったログ分析
shigeruoda
2
390
原則から考える保守しやすいComposable関数設計
moriatsushi
3
500
新卒3年目の後悔〜機械学習モデルジョブの運用を頑張った話〜
kameitomohiro
0
390
rubygem開発で鍛える設計力
joker1007
1
120
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
220
VISITS_AIIoTビジネス共創ラボ登壇資料.pdf
iotcomjpadmin
0
150
~宇宙最速~2025年AWS Summit レポート
satodesu
1
1.4k
PostgreSQL 18 cancel request key長の変更とRailsへの関連
yahonda
0
100
「Chatwork」の認証基盤の移行とログ活用によるプロダクト改善
kubell_hr
1
100
_第3回__AIxIoTビジネス共創ラボ紹介資料_20250617.pdf
iotcomjpadmin
0
140
UIテスト自動化サポート- Testbed for XCUIAutomation practice
notoroid
0
110
Featured
See All Featured
Docker and Python
trallard
44
3.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
We Have a Design System, Now What?
morganepeng
52
7.6k
Facilitating Awesome Meetings
lara
54
6.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Bash Introduction
62gerente
614
210k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
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と量子コンピュータについて対話できる人を募集しています 最後に