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
470
libp2p
wshino
7
1.3k
Superiority of Rust
wshino
3
380
Try Cross Compile Then Fail
wshino
0
160
GORMOS - A high performance and scalable design for decentralized applications -
wshino
4
1.9k
DAppのデプロイ戦略 / DApp Deployment Strategy
wshino
3
1.8k
Plasma Debit
wshino
2
2k
ブロックチェーン技術の登場とスマートコントラクト化する社会
wshino
5
5.4k
Truffle + Drizzle と、Ethereumの概況について
wshino
2
1.2k
Other Decks in Technology
See All in Technology
脳内メモリ、思ったより揮発性だった
koutorino
0
380
(Test) ai-meetup slide creation
oikon48
3
460
SRE NEXT 2026 CfP レビュアーが語る聞きたくなるプロポーザルとは?
yutakawasaki0911
1
440
VLAモデル構築のための AIロボット向け模倣学習キット
kmatsuiugo
0
260
エンジニアリングマネージャーの仕事
yuheinakasaka
0
110
AI時代のSaaSとETL
shoe116
1
190
AWS CDK「読めるけど書けない」を脱却するファーストステップ
smt7174
3
190
ソフトバンク流!プラットフォームエンジニアリング実現へのアプローチ
sbtechnight
1
200
ReactのdangerouslySetInnerHTMLは“dangerously”だから危険 / Security.any #09 卒業したいセキュリティLT
flatt_security
0
320
進化するBits AI SREと私と組織
nulabinc
PRO
1
250
Go 1.26 Genericsにおける再帰的型制約 / Recursive Type Constraints in Go 1.26 Generics
ryokotmng
0
130
Claude Code のコード品質がばらつくので AI に品質保証させる仕組みを作った話 / A story about building a mechanism to have AI ensure quality, because the code quality from Claude Code was inconsistent
nrslib
13
8.6k
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
260
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
From π to Pie charts
rasagy
0
150
Designing for Timeless Needs
cassininazir
0
170
Building a Scalable Design System with Sketch
lauravandoore
463
34k
My Coaching Mixtape
mlcsv
0
78
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Rails Girls Zürich Keynote
gr2m
96
14k
Test your architecture with Archunit
thirion
1
2.2k
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と量子コンピュータについて対話できる人を募集しています 最後に