layer 2 optimism optimistic rollups optimistic virtual machine ovm

Exploring Optimism’s Optimistic Virtual Machine (OVM)

Written By Ivan on Tech

Apr 04, 2021

Optimism’s Optimistic Virtual Machine (OVM) potentially represents a monumental leap forward for Layer 2 solutions. In this article, we’ll take a closer look at what Layer 2 solutions are, why they’re so important, and why Optimism and their Optimistic Virtual Machine could constitute such an important breakthrough for Ethereum. In essence, the OVM environment theoretically allows developers to move their smart contracts onto this quicker and less expensive solution with only a few lines of code. 

That's good news for anyone involved in Ethereum. But before we get into everything it does, let's look at why the Optimistic Virtual Machine (OVM) is even necessary.

First off, there has never been more usage and excitement surrounding Ethereum than at this moment in its history. Cumulative transaction fees surpassed Bitcoin in 2020, Ethereum gas fees have seen historic highs recently, and presently, Ethereum is on top regarding daily transaction fee revenue. Even decentralized exchanges (DEXs) like Uniswap are beating their centralized counterparts in terms of usage, and that's despite the high gas fees.

Demand for Ethereum's ecosystem of dApps currently driven by decentralized finance (DeFi) and NFTs is undeniably massive. However, Ethereum's inability to support high throughput has driven its gas fees to unsustainable levels. There is little debate over whether scaling solutions are necessary, and this predicament typically gets framed as Layer 2 solutions (like Rollups) vs. Ethereum killers (faster, alternative Layer 1 solutions). The critical thing to understand, though, is that Ethereum scalability must improve to make Ethereum usable by the wider masses. 

The Rollup Roadmap

Rollups execute much like their name says - they roll up multiple transactions into a single transaction. Optimistic Rollups are the first Layer 2 solution to scale smart contracts and transactions. However, there is another daily well-known type called ZK Rollups. The main difference between the two is that the Optimistic version uses fraud proofs while ZK uses validity proofs.

Ethereum 2.0 promises scalability. However, base-layer scalability for dApps only happens in the last major phase, which is still years away. Ethereum 2.0's usability for Rollups, on the other hand, happens in Phase 1 - way before 2.0 becomes usable for ordinary Layer 1 dApps. Hence, Ethereum's ecosystem is likely to be heavily in Rollups (along with some plasma and state channels) as a scaling solution for the near to mid-term future. That makes Rollups key. 

If you want to learn more about Rollups before continuing, check out our article "Comparing Layer-2 Scaling Solutions."

Or, better yet, enroll in the Ivan on Tech Academy and become an expert on all things Ethereum. An excellent place to start is the Ethereum 101 course.

Ethereum base-layer scaling is focused primarily on how much data blocks can hold. It's not about the efficiency of on-chain computation. On the other hand, a Rollup's scalability is determined by how much data the chain can hold. That means any increase to the base layer beyond current levels will help further increase Rollups' scalability, which is already a vast improvement on its own.

Adapting Ethereum's Infrastructure to Rollups

Currently, users have accounts, Ethereum Name Service (ENS), and applications all on Layer 1. In the short term, this will have to change to where accounts, balances, and assets go on Layer 2. ENS is a system to replace long addresses with shorter, human-friendly names. To succeed, ENS will need to support names registered and transferred on Layer 2. 

Also, crypto wallets need Layer 2 protocols built into them. This result is preferable to web page-like dApps that require users to trust the dApp fully. In a perfect world, Layer 2 would arguably become part of the crypto wallet itself. More work is also needed on cross Layer 2 transfers to make assets moving across different Layer 2 protocols as seamless as possible.

Improving Ethereum's Transactions per Second (TPS)

Presently Ethereum can do roughly ~15 TPS, but when everything moves to rollups, that number will be more like ~1,000 to 5,000 TPS. Once Rollups move to sharded chains for their data storage, Ethereum’s TPS could go to ~100,000 TPS. Since Optimistic Rollups on Ethereum 2.0 are expected to become available sooner than native contracts, the combination of sharding and rollups could account for these extremely high scalability gains. 

Overall, it's not far-fetched to speculate that when Phase 2 finally launches, Rollups will be so prominent that everyone will have already adapted to them. Therefore, it may be easier to continue down that same road than to try to herd everyone back to the base chain - especially since that could mean a reduction in scalability.

As Ethereum co-founder Vitalik Buterin puts it, this could imply a "Phase 1.5 and done" approach to Ethereum 2.0. If you're not familiar with the Ethereum 2.0 phases, click the "Ethereum 2.0" link above. Vitalik is talking about the point where the base layer only needs to focus on getting a few things right like consensus and data availability, especially since "sharding data availability is much safer than sharding EVM (Ethereum Virtual Machine) computation." 

What Is the Optimistic Virtual Machine?

That leads us to Optimism, the company that invented the first Optimistic Rollup protocol compatible with the EVM. Formerly known as Plasma Group, Optimism's work on Plasma eventually led them to pioneer the development of Optimistic Rollups. 

After releasing a demo of Optimistic Rollup, the next step involved building something developers could use to quickly scale Ethereum smart contracts - the Optimistic Virtual Machine or OVM (we'll use the terms interchangeably), which is the backend for Optimistic Rollups. The OVM supports all Ethereum libraries and developer tools like Solidity, Vyper, OpenZeppelin, and MetaMask. However, the team is working on more integrations. 

With all the nifty smart contracts coming out on Ethereum, upgrading them to Optimistic Rollups should be made to be simple—and that's what the Optimistic Virtual Machine means to do. 

If you're not sure about smart contracts, think of them this way: The EVM defines a set of computer instructions. It also dictates what each should do during a transaction. So, an Ethereum smart contract is essentially a collection of these instructions, and the Optimistic Virtual Machine is an EVM-compatible execution environment built for Layer 2. 

The OVM allows Optimism to implement a rollup chain that's just like the Ethereum main chain. It will enable developers to write contracts in Solidity and deploy them to an OVM chain at will. 

Optimistic Virtual Machine, a Unified Language for Layer 2?

The Optimistic Virtual Machine supports all Layer 2 protocols, and that could unify all these scalability constructions under one virtual machine, which is a pretty big deal. 

Layer 1 gave us a trusted virtual machine, while Layer 2 provides the interface to use it efficiently. So, instead of updating transactions directly on the expensive Layer 1 virtual machine, the Optimistic Virtual Machine uses off-chain data as a guarantee of what will happen to the Layer 1 state. This guarantee is an "optimistic decision."

The Optimistic Decision Process

There are three steps to the optimistic decision process:

  1. Speculate about future Layer 1 possibilities.
  2. Figure out what off-chain messages guarantee if used in Layer 1.
  3. Restrict expectations of the future Layer 1 state based on those guarantees.

This process is all part of the Optimistic Virtual Machine's state transition function. Restricting future Layer 1 expectations starts with the following concepts:

  1. Ethereum Futures Cone

Think of future Ethereum states as an expanse containing everything that could happen on the blockchain (transactions etc.). However, we can gradually restrict those possible futures based on the EVM rules. You can visualize this process as a cone that restricts by shrinking from a wide end down to the tighter funnel. 

  1. Local Information

The Optimistic Virtual Machine makes optimistic decisions based on local information such as off-chain messages. For example, an OVM state transition would be considered a new decision. But before it can make decisions, the Optimistic Virtual Machine must first define the local assumptions it will use.

  1. Local Assumptions

The Optimistic Virtual Machine defines assumptions based on local information that determines possible future Ethereum states. For example, many Layer 2 solutions use a "dispute liveness assumption," and since channel participants "assume" they will dispute malicious withdrawals, they return "false" for any state that contains an undisputed, malicious withdrawal.

  1. Optimistic Decisions

Local assumptions do the job of eliminating "impossible" futures to make optimistic decisions regarding the possible future. 

What Is Optimism?

Optimism is the company that invented the first Optimistic Rollup, and it is a Layer 2 solution for scaling Ethereum applications. It looks and behaves like Ethereum, but it's an application that resides inside Ethereum, making transactions quicker and far less expensive. That's because it can publish transaction results without having to execute them on the Ethereum blockchain.

At its core, Optimism is nearly identical to Ethereum in the way developers create and interact with Solidity smart contracts. This factor makes it an easy transition. There are no new programming languages to learn, and it only requires some minor code tweaks to existing contracts.

Optimism seeks to get the Rollup's internal state transition rules Ethereum-like with only a few modifications required. 

Optimism vs. Sidechains

However, Optimism is not a Sidechain. If you read our article about Layer 2 Solutions for Ethereum (see above link), you'll remember that Sidechains are essentially blockchains that rely on their own separate consensus mechanisms for security. In contrast, Optimism is a series of smart contracts that reside inside Ethereum and uses Fraud Proofs that incentivize users to expose bad transaction results.

Optimism’s Withdrawal Delays

One of the downsides with the security is the withdrawal delays when transferring from Optimism back to Ethereum. They are necessary, however, to help secure user funds. Optimistic Rollups use what's called a "challenge period" that we mentioned earlier. This period follows a published transaction and gives users time to flag incorrect results. This period must be long enough to give users time to detect and revert an invalid result. Presently it takes about a week.

For now, community consensus wants to keep this challenge time frame "as is" to guarantee asset safety, hence, the one-week delay.

Do you think Optimistic Rollups and companies like Optimism will play a significant role in Ethereum's future? If so, start learning how to become a blockchain developer at Ivan on Tech Academy today!

Optimism's Rush to Mainnet

Optimism is presently embarking on a phased rollout, albeit hurriedly, readying itself for large-scale production. Earlier in March, the team announced a mad dash to public mainnet because gas prices had jumped to an all-time high, and users were screaming for relief. However, after the initial announcement, Optimism's community voiced its surprise and concern over not having ample notice to prepare for the launch. 

Optimism inadvertently ran roughshod over their partners' timelines in their zeal to provide users with speed and cost savings. Realizing that such an uncoordinated rush without preparation could be dangerous, they pulled back. After all, such actions have caused popular dApps to get "forked" by adversaries.

On March 25th, they opted for a more coordinated community launch and announced a delay in the official public mainnet. This decision gives community partners time to integrate, audit and test. This temporary point of contention also emphasized how Optimism listens to what its community has to say. They consider their community to be an integral part of their success. Additionally, they switched their communication style to that of giving more frequent updates on their Discord channel.

The rough estimate for the mainnet launch has been pushed back to July, but only if the ecosystem is ready. Whenever it happens, the launch will result from years of team effort, dating back to the days of their Plasma research.

Interest in Optimism

Earlier in the year, Optimism did a soft launch of its Optimistic Virtual Machine with Synthetix integrating the OVM in four phases to limit risk. Uniswap is also set to deploy on Optimism as well. 

Not to mention, back in February, Andreessen Horowitz (a16z) announced they were "leading a $25 million Series A investment in Optimism." Their investment decision came about because they like Optimism's use of Optimistic Rollups to achieve lower latency and greater throughput than Ethereum Layer 1 standalone. 

The a16z investment group also pointed to Optimism's "world-class developer and user experience," along with their exceptional team members and the years they've spent on research and testing.

On the flip side, Optimism credited the recent round of funding as the reason they could hire more of "the brightest minds and sharpest operators in the space."

Wouldn't you like to become one of the brightest minds shaping the future of crypto? There's no time like the present to get started. Enroll at Ivan on Tech Academy and learn to become a blockchain developer today! If you’re new to crypto, try the Crypto for Beginners Course.

Author: MindFrac

Like what you're reading?

Get to work in a fast growing industry. Start learning blockchain together with our 20,000+ students today.
Use coupon code BLOG20 for 20% off.

Become Blockchain Certified Today No Prior Knowledge Needed!
Close

Get our Free Ebook

Enter your email and we will send it to you!