If you have been following Ethereum lately, you might have heard about the soaring gas prices on mainnet. Transactions that used to cost a few cents of gas now often require nearly a dollar to be processed by the miners in a timely manner. While the rapid growth of the number of on-chain transactions indicates a thriving Ethereum ecosystem, the escalating war of gas price greatly pains the average users. One example is that the emerging DeFi, which requires high throughput in order to ensure security and support large trading volume, is now being significantly bottlenecked by the layer-1 blockchain performance and cost.
As an expert team in blockchain scalability, Celer responds to the call of duty with our previously announced Coherent Layer-2 Platform. Our goal is to provide an infrastructure with strong performance, security, flexibility, and cost-efficiency guarantees for the next wave of demanding blockchain applications such as DeFi and interactive gaming.
Today, we are glad to announce that an alpha version of the Celer hybrid rollup testnet is live on Ropsten. You can check out the instructions in the repo to interact with it. We have also recorded a video demo to showcase the testnet in action:
The Celer Sidechain adopts a hybrid architecture offering sidechain security via a Delegated Proof of Stake (DPoS) consensus for general dApps and mainchain security via optimistic rollup for specific usages such as token transfers. The rationale is that not all dApps need to bear the cost and complexity of mainchain security, so the optimistic rollup part is better offered as an opt-in for the developers. For example, participants of many decentralized games do not particularly care about mainchain security for every state transition in the game. On the other hand, mainchain security does seem warranted for token transfers and high-value applications like DEXes. As a demonstration, the current implementation of the sidechain provides optimistic rollup for ERC-20 token transfers.
To facilitate developers and users in migrating from Ethereum mainchain, the sidechain remains fully EVM-compatible. Deploying and interacting with smart contracts is as easy as swapping out a JSON-RPC endpoint. Developers can still use their favorite Ethereum toolchain and users can still use wallets like MetaMask.
As a part of the Celer Coherent Layer-2 Platform, the rollup sidechain shares the same validator set with the state guardian network. The rollup sidechain validators and SGN validators will be elected and governed by the same layer-1 DPoS contract for staking, rewarding, and slashing.
Optimistic Rollup for Token Transfers
The optimistic rollup for ERC-20 token transfer is implemented with a set of smart contracts. A mainchain ERC-20 token can be mapped onto the sidechain via a token registry contract. Upon the completion of the mapping transaction, the sidechain validators will relay the mapping by deploying a modified ERC-20 contract on the sidechain.
We modified the standard ERC-20 contract to emit necessary data for rollup. In particular, we changed the transfer() function to require an extra signature parameter for generating rollup transactions. The contract also tracks nonce for each account to prevent double spending. The state storage in the rollup chain tracks the balances and nonces for the list of tokens owned by each account. We have implemented three types of state transitions: deposit, withdrawal and transfer.
A deposit transition is initiated when a user deposits into a deposit / withdraw bridge contract on the mainchain. The corresponding bridge contract on the sidechain collects the votes from the validators and relays the deposit once more than 2/3 votes are in. Note that we rely on a PoS voting by the validators to relay the deposits instead of modifying the state roots on the mainchain directly. We made this small trade-off about security to allow easier sequencing of transactions, to avoid having to pause token transfers, and to provide higher deposit throughput.
A withdrawal transition is initiated by the user on the sidechain to reduce the balance of a token. The reduced amount is burnt on the sidechain. After the rollup block containing the withdrawal transition is submitted to the mainchain and the challenge period has passed, the withdrawal is finalized. Now the user can submit a withdrawal transaction to the deposit / withdraw bridge contract on the mainchain to claim the funds.
A transfer transition reduces the balance of the sender and increases that of the recipient. Note that we provide rollup semantics for any transfers from registered external accounts, while transfers from contract accounts still have PoS security.
Breakdown of the Roles
The participants of the Celer Sidechain can be categorized into multiple roles:
- Rollup verifiers
Users interact with other users and smart contracts on the Celer sidechain much like how they interact with the Ethereum mainchain, except that they will enjoy short block confirmation time and cheap transaction fees payable in the form of CELR tokens. The fees are then shared by the validators and delegators as rewards.
Validators are elected by the delegators to run a group of customized Ethereum nodes forming a fast weighted Proof-of-Authority consensus. They process general EVM transactions and produce sidechain blocks. They will be required to stake a significant number of CELR tokens and will need to provide high availability and reliability. Validators keep one another in check via a governance process where malicious validators will be voted out and slashed.
The validators also serve in turn as rollup transaction aggregators. They listen to the rollup-related contract events emitted on the sidechain, construct rollup transactions from the events, and submit rollup blocks to the mainchain periodically. Note that we made the design choice of building rollup transactions from contract events instead of accepting transactions from users directly. This provides a seamless user and developer experience. For each batch of rollup transactions, the aggregating validator proposes a rollup block on the sidechain, which is committed to the mainchain after being signed-off by at least 2/3 voting powers.
Delegators are CELR holders who delegate their tokens on the mainchain to the validators and strengthen the sidechain security. They earn a part of the transaction fees as rewards.
Rollup verifiers can be anyone running a verifier node. They watch the submitted rollup blocks and try to find invalid state roots in them. A successful challenge will roll back the sidechain to a state before the invalid block and reward the verifier with half of the CELR deposits slashed from the validators.
Our alpha test supports the hybrid rollup functionalities described above with a Proof-of-Authority (PoA) sidechain. People can test account-to-account, account-to-contract token transfers under rollup security guarantee, and fast EVM contract execution under PoA security guarantee on the alpha testnet.
The alpha testnet has not been integrated with our layer-1 DPoS contract yet. Therefore, there is no test for staking or governance yet.
The immediate next step is to put everything together by integrating our hybrid rollup sidechain with the layer-1 DPoS contract.
After supporting rollup for token transfers, we are looking into making the design extensible and open for other types of state transitions such as non-custodial exchanges. We believe that supporting multiple rollups simultaneously on the same sidechain, as opposed to having to relay transactions across rollups on the mainchain, will be very beneficial to the composability of dApps.
We are also actively looking into technologies like the Optimistic Virtual Machine (OVM) and intend to support generalized optimistic rollup for all types of smart contracts in the future.
The Celer Sidechain is a much needed addition to the matrix of our comprehensive layer-2 scalability solution. Feel free to take a look at the instructions and play around with the testnet. Join our Discord server for technical discussions and questions.
About Celer Network
Celer Network is a leading layer-2 scaling platform that enables fast, easy and secure off-chain transactions for not only crypto payments, but also generalized smart contract executions. It enables everyone to quickly build, operate, and use highly scalable decentralized applications through innovations in off-chain scaling techniques and incentive-aligned cryptoeconomics.