Optimistic Rollupとは何か?
2020/05/28
Shuhei Hiya@Cryptoeconomics Lab
L2 Meetup
Why Scaling
Increase Ethereum Capacity
Ethereum today
About 15 tps
Agenda
Rollupとは何か?
Optimistic Rollupとは何か?
Optimistic Rollupの仕組み
Gazelleの紹介
Scaling Research
● Sharding
● Optimistic Rollup
● zkRollup
● Plasma
● Channel
EthereumのLayer 2 スケーリング
トランザクション圧縮かトランザクションを送信するタイミングを減らす
tx1 tx2 tx3 tx4
H
0-0
H
0-1
H
1-0
H
1-1
H
0
H
1
Merkle Root
What’s Rollup?
Data Availabilityを保ちながらスケーリングする技術
トランザクションデータをブロックチェーンにCalldataとして投げるが、Stateとして保存す
るのはMerkleRootだけ
tx1 tx2 tx3 tx4
Hash(txs)
Plasmaはここだけブロックチェー
ンに投げる
Rollupはこれ全体を
Calldataとして投げる
Data Availabilityがない状態とは?
h = Hash(tx)
txの中身がわからない状態
もとのtxを知るために特別な仕組みが必要になってしまい、実現できる
ことも少なるなる。これを汎用的に解決できるのがRollup。
?
txが正しいのか不正
なのかがわからない
例)PlasmaのExit Game
What’s Rollup
Data Availabilityを保ちながらスケーリングする技術
Optimistic Rollup
問題が起こった場合のみブロックチェーンでトランザクションの検証を行う
ZK Rollup
zk-SNARKsにより毎回ブロックチェーンでトランザクションの検証を行う
トランザクションのCalldataとStateの違い
● 現在のEthereumのStateのサイズは、~45GB
● トランザクションとは異なり、Stateはフルノードで切り落とすことができない。
● トランザクションを検証するためには、Stateへの多くのランダムアクセスを実行しな
ければならないため、StateをRAMに保持する必要がある
要するにStateは高い、トランザクションのCalldataは安い
ERC20の例
ERC20のトランザクションとstate
● トランザクション: 受け取り手のアドレスと金額(=64bytes)
● ステート: アドレスごとの残高(=32bytes)
● 100アカウントあるとする
L1の場合
両方が人数分あるので、100人だと640 bytesのCalldataと320 bytesのState
例えばOptimistic Rollupの場合
トランザクションのみが人数分あるので、100人だと640 bytesのCalldataと32 bytesのState
Gasコスト削減の観点での比較
Ethereum
Transaction cost = State+コンピューテーョン+CallData
ZK Rollup
Transaction cost = State+コンピューテーョン+CallData
Optimistic Rollup
Transaction cost = State+コンピューテーョン+CallData
Plasma
Transaction cost = State+コンピューテーョン+CallData
下線の部分を削減できる
トランザクションあたりのGas cost比較(概算)
10 txs per block 100 txs per block 1000 txs per block
Ethereum 26000 26000 26000
ORU 10642 4664 4000
Plasma 6642 664 66
トランザクションのサイズは、シンプルな送金のケースを想定。
単位 gas
ZK Rollup & Optimistic Rollup
両方データはオンチェーン
zkSnarkによるverification vs optimistic verification
zkRollup & Optimistic Rollup
両方データはオンチェーン
zk-SNARKsによるverification vs optimistic verification
トランザクションをethereumに投げる時に全て検証する
(pessimistic)か、しない(optimistic)か。
Why Rollup
Data Availabilityを保ちながら、スケールさせ
ることで色々なメリットがある。
Why Optimistic Rollup
ethereumに対して
● 20x scalingする
Plasmaに対して
● トランザクションアグリゲータがパーミッションレスである
○ 誰でもトランザクションのバリデーションができる
● General Smart Contract
○ unipig
● L1の混雑耐性
○ non-interactive fraud proof
Fisherman's dilemma
from https://vitalik.ca/general/2019/08/28/hybrid_layer_2.html
Optimistic RollupはPlasmaの研究から生まれた
https://plasma.build/t/rollup-plasma-for-mass-exits-complex-disputes/90
Optimistic RollupはPlasmaの研究から生まれた
Plasmaの研究から、その欠点を補うように生まれた
How Optimistic Rollup works
How Optimistic Rollup works
Aggregator
Deposit 10 ETH to Rollup Contract
Alice
Collateral
10 ETH
Deposit
Aggregator
deposit
1 ETH
Alice
Alice
Collateral
10 ETH
Sending Transaction
Aggregator1 OETH to Bob 1.5 OETH to Alice
1 OETH Bob
1.5 OETH Alice
Alice Bob
Collateral
10 ETH
Sending Transaction
Aggregator
1 OETH Bob
1.5 OETH Alice
Alice Bob
Collateral
10 ETH
Invalid Transaction
Aggregator
1 OETH Bob
1.5 OETH Alice
2 OETH Aggregator
...
Alice Bob
Collateral
10 ETH
Invalid Transaction
Aggregator
1 OETH Bob
1.5 OETH Alice
2 OETH Aggregator
...
Alice Bob
Collateral
10 ETH
Invalid Transaction
Aggregator
1 OETH Bob
1.5 OETH Alice
2 OETH Aggregator
...
Alice Bob
Full node
Collateral
10 ETH
Infra ethscan
誰でも検証が可能
3 challenge rules
Skipped valid block
Invalid block Invalid parent
Products of ORU
名前 特徴
Optimism アカウント型、SolidityでSmart Contractが書
ける
FuelCore UTXO型
Interstate Network EVM Optimistic Rollup
Arbtrum AVMという独自のVM。二分法的な紛争解決
モデル
SKALE BLS signatureを使ったGas cost削減の研究
を行っている
ORU & OVMをsynthetixに適応した推計値
記事より抜粋
https://medium.com/ethereum-optimism/synthetix-exchange-meets-the-ovm-2de3a572d6df
Oracle update latency:
- Mainchain Ethereum: >15 seconds
- Optimistic Ethereum: ~400ms
Oracle update gas costs:
- Mainchain Ethereum: 394.2k gas
- Optimistic Ethereum: 14.5k gas (calldata usage can be optimized to < 3.5k gas)
Exchange gas costs
- Mainchain Ethereum: 472.2k gas
- Optimistic Ethereum: 3.3k gas
Exchange latency
- Mainchain Ethereum: >15 seconds
- Optimistic Ethereum: ~200ms
日本語であまり説明がない難しい単語の説明
OVM
● ORUのためのVirtual Machine
● SolidityでORUのアプリケーションが書ける
● Optimismがtranspilerを提供している
OGS
● Fraud Proofによる紛争ゲームの抽象化
● Layer 2やCross Chain Atomic Swapなどを表現できる
まとめ
Ethereumのスケーリング技術である、Optimistic Rollupについてお話ししました。
● Optimistic RollupはEthereumに対して、約20倍のスケーリングが期待できます
● 誰でもブロックバリデーションができます
● 汎用的なスマートコントラクトの実行ができます
Gazelleというプロダクトのα versionをリ
リースしました。
https://gzle.io/
Gazelleとは?
● OGS理論に従ったクライアントとスマートコントラクトの実装
● その基盤の上にPlasmaを実装
● Plasma ClientはAPIが生えている
● 先日α versionとして公開しました
ただのPlasma実装ではなく、開発フレームワーク!!
Why Plasma?
ORUに対して
Plasmaベースでトランザクションあたりのコストが安い
Channelに対して
参加者を限定しない
コンソーシアムチェーンに対して
独自コンセンサスアルゴリズムを持たない
Ethereumとのネイティブインターオペラビリティがある
Gazelleの今後
● α versionのテストネットとウォレットの公開
● マルチシグやSwapなどのAPIの公開
Gazelleは幅広くL2の仕組みを実装できるポテンシャルを持っています。α versionでは
Plasmaを利用することができます。
Why Gazelle?
OGSという抽象化理論の上にPlasmaプロトコルが実装されている。
第1にPlasmaのアプリケーションを汎用言語で状態遷移を記述して表現するのは難しい、しかし
fraud proofの合成であればかなり的確にPlasmaでできることを表すことができる。
第2に、この表現方法はfraud proofのmodulabilityがある。例えば「There exists a signature
which alice signed for the message」という記述がon-chainでもoff-chainでも、同じ記述で同じ意
味を持って評価できる。そしてこの述語はPlasmaの述語と組み合わせて使うことができるし、将来的
にはOptimistic RollupやChannelなど他のprotocolとも組み合わせられるだろう。
def MultisigPredicate(alice, bob) :=
OwnershipPredicate(alice)
and OwnershipPredicate(bob)

Optimistic Rollupとは何か