General purpose and application-specific Optimistic rollups are widely used now-a-days as efficient Layer2 scaling solution because of their high throughput, lower costs and high degree of security from the base chain, in this case Ethereum. But how do Optimistic rollups actually work, how businesses can build one easily? These are some of the questions we will talk about in this edition of rollups.
So, without a further ado, lets dive deep into the topic.
What are Optimistic Roll-ups?
Optimistic roll-ups are an off-chain scaling solution with the potential to scale the Ethereum base layer by a significant magnitude. Through the help of the optimistic roll-ups, the transcations can be bundled as one and posted on the mainchain. Such a practice will reduce the gas costs dramatically to support new use-cases to build on top of the Ethereum Network. This is because the total gas cost for that entire one bundle is now divided among many.
As the name suggests, OP Rollups assumes all transactions are valid by default. But have a 7 days challenger period, for raising objections. And in case there is any fraud, the OP rollup ecosystem can perform the transaction again and fix the issue. In this case, the last valid state is restored. More on this is discussed in the later section.
Since Optimistic rollups are EVM equivalent, they can easily integrate with the EVM ecosystem. The tools, smart contracts can also work seamlessly with OP rollups ecosystem with minor changes.
How Does Optimistic Roll-ups Work?
The user has to submit the transaction to the operator who passes the same to the sequencer for sequencing the transactions. Once the transcations are sequenced, they aggregate them for insertion to the main chain as a calldata. And on the Ethereum chain a series of smart contracts store and track the state of rollup blocks.
On the Optimistic ecosystem, the validators verify the transactions by bonding tokens against the same. In the event that validators’ final state of the transactions are different from operators’ proposed state as verified by the OVM, a challenge period will be triggered which shall validate the transcations through a Merkle Hash proof from the OVM to include them in the L1 block. If the challenger is found correct, the validator loses the fund, whereas, if the challenger is found at fault, the validator shall receive the funds from the challenger.
Architectural Engineering of Optimistic Roll-Ups to Scale Dapps?
The way rollups make the blockchain faster is by breaking down separate parts of the transaction processes between multiple layers.
Transaction Handling: In this layer, the receiver shall be accepting the transcations and verifying its validity. If they are complying with the rules of the blockchain, the transaction handling operator shall push it forward to the sequencer.
Block Creators/ Sequencers: The sequencer is the next important entity in the architecture responsible for arranging the transcations in sequence. He/she will be using time-stamp hashes to arrange all the transcations in order of time and place them in the roll-up blocks as blocks of transaction. Responsible for sequentially placing the blocks protected by a hash-function that time-stamps and places the blocks in order.
Batching: In this stage of transaction handling, similar to in a typical L1 block, the batcher shall be batching the transcations in batch as per the block sizes allowed. If the op-batches are overburdened, the batcher shall move transcations to another batch to reduce computational burden and link the same with the next batch to restore security.
Data Delivery: Since every batch is separately handled, the batcher posts the data on the Op-VM. The Op-VM helps the main-chain, which is the L1 to verify the data as call-data which reduces the load on the L1 chain increasing scalability and lowering the gas fees to scale dapps.
Challengers: If the data posted on Op-VM doesn’t meet a challenge within a specific challenger period because all transcations are labeled correctly, they are posted on the mainchain and included in the blocks of transcations of the main chain.
How Does Optimistic Roll-ups Verify a Fraud?
The roll-up environment revolves around a pre and post state based on time locking. Using the Merkle Root Function, the roll-up environment helps in encoding a large amount of data, which should ideally be a part of a larger data for validation. Now, if at any point in time, a validator tries to compromise the network, the state root shall verify the same with the Merkle Root Function for a pre and post state of the network. If any discrepancies are found based on a challenger period, the network shall roll-back all transcations that have happened post that timeline. In the above image, as you can see, the flow of funds between A to B and from For example, as per the below given image;
If Alice sends 20$ to Bob which makes Bob’s balance $110, Bob sends additionally 60$ to Charlie which makes Charlie’s balance which was 110 to 170 and Bob’s balance, which was $110 to $50, but Charlie wishes to send 200$ to David, which the validator shall validate with the state root function. If the validator finds any discrepancies in the pre and post state root, all the transcations happening post a specific point of fraud/failure will be rolled back to the original state and validated through a cryptographic hash function.
Start Building on Optimistic Rollups using Zeeve platform:
Okay, so a lot has been discussed and it’s time to take an action towards building your application on a Optimistic Rollup chain. If you want to leverage a public, general purpose Optimistic Rollup chain, like Optimism or Arbitrum, you need access to validator and full nodes for them.
Zeeve provides dedicated infrastructure for both Arbitrum and Optimism with low-code and a few-click deployment access with in-depth monitoring, alerts and analytics. In case, your need is application-specific OP rollups chain, with lots of customization, use Zeeve’s Rollups-as-aservice (RaaS) to launch your rollup chain with a few clicks using OP Stack framework. Aside from getting into production faster with all necessary infrastructure component like faucets, explorers, data indexers etc, using Zeeve RaaS platform can save you a lot on your deployment and recurring management costs. Plus, you get an unified dashboard for all your deployment and management needs, 24/7 monitoring, and alerts.
If you need more details regarding how Zeeve can help you launch your first application on a L2 Rollup or maybe help you migrate from an existing blockchain, get in touch with our experts and see how Zeeve simplifies the rollup deployment and management for all its clients.