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
Tokyo_reInforce_2025_recap_iam_access_analyzer
hiashisan
0
180
React開発にStorybookとCopilotを導入して、爆速でUIを編集・確認する方法
yu_kod
1
230
5min GuardDuty Extended Threat Detection EKS
takakuni
0
190
KiCadでPad on Viaの基板作ってみた
iotengineer22
0
290
20250707-AI活用の個人差を埋めるチームづくり
shnjtk
4
3.6k
生成AI時代の開発組織・技術・プロセス 〜 ログラスの挑戦と考察 〜
itohiro73
1
430
B2C&B2B&社内向けサービスを抱える開発組織におけるサービス価値を最大化するイニシアチブ管理
belongadmin
1
6.1k
Zephyr RTOSを使った開発コンペに参加した件
iotengineer22
1
200
KubeCon + CloudNativeCon Japan 2025 Recap by CA
ponkio_o
PRO
0
290
生成AI時代 文字コードを学ぶ意義を見出せるか?
hrsued
1
810
asken AI勉強会(Android)
tadashi_sato
0
180
United Airlines Customer Service– Call 1-833-341-3142 Now!
airhelp
0
160
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Become a Pro
speakerdeck
PRO
28
5.4k
The Cult of Friendly URLs
andyhume
79
6.5k
The Cost Of JavaScript in 2023
addyosmani
51
8.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Being A Developer After 40
akosma
90
590k
Making Projects Easy
brettharned
116
6.3k
Testing 201, or: Great Expectations
jmmastey
42
7.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
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と量子コンピュータについて対話できる人を募集しています 最後に