Optimistic Virtual Machine Alpha

Optimism
Optimism PBC Blog
Published in
4 min readFeb 12, 2020

--

TL;DR We are open-sourcing the engine that powers a fully EVM compatible Optimistic Rollup, and we need your help to improve it.

Several months ago, we released a demo of Optimistic Rollup — the first Ethereum L2 scaling solution that scales smart contracts in addition to transactions. Since it was just a demo, we’d only written custom code to support our collaborator, Uniswap Exchange. There was no general support for the EVM. The next step was to build something that any developer could use to scale any Ethereum smart contract with ease. We love working out in the open with a community of peers, so this will be the first in a series of regular updates as we move towards our goal.

Today, we’re extremely excited to announce the alpha release of the Optimistic Virtual Machine (OVM) — the backend for Optimistic Rollup which enables full EVM support. The second major component that we have been working on over the past few months is a transpiler which converts L1 contracts to L2 contracts. Currently, the OVM supports all existing Ethereum dev tools and libraries including Solidity, Vyper, Truffle, Open Zeppelin, Metamask, and Web3.js just to name a few. However, our transpiler has only been tested with Waffle. We are in the process of adding other integrations like Truffle and look forward to hearing from the community on high priority integrations to add next. There is still much left to be done. Our next milestone will outfit an Optimistic Rollup chain with the OVM.

In the remainder of this post, we’ll describe how we are building the OVM at a high level, and what it enables for Ethereum.

What is the OVM?

The OVM is an optimistic implementation of the EVM. Each computational step is called a transition. These transitions can be evaluated client-side by individual users wishing to compute or verify the latest state, or on-chain in a contract to verify fraud proofs. This can be thought of as a containerized L2-compatible EVM inside of the EVM and is similar to how Docker works on your computer. In order to build this OVM virtual environment, we take advantage of the Turing completeness of the EVM to embed EVM sandbox functionality directly inside of it, with a virtual addressing layer and virtualized storage.

With the OVM as the virtual machine for Optimistic Rollup we are able to support Ethereum smart contracts exactly as they appear on Layer 1. In case of invalid state transitions in the OVM, we can spawn an OVM virtual environment which allows for an efficient stateless fraud proof.

Upgrade all the Things!

We put Uniswap on L2, but there are so many cool smart contracts on Ethereum — we need to support them all! Upgrading smart contracts to Optimistic Rollup / L2 should be as simple as a recompilation & redeployment.

We designed the OVM in a way that would make the upgrade process as smooth as possible not just for Eth1, but also for Eth2. The current Eth2 roadmap will require developers who currently rely on synchronous transactions to redesign their smart contracts… unless those contracts are on Optimistic Rollup!

Optimistic rollup on Eth2 is expected to become available earlier than Eth2 “native” contracts. Hence, the extremely high scalability gains (by some estimates well over 100,000 TPS) from combining sharding and rollup feel more within reach than ever.

Make your contracts optimistic!

…and report bugs!

With the alpha release of the OVM, you’ll be able to deploy and test smart contracts using the OVM.

If your tests pass, then that means your contracts should be ready for primetime use in Optimistic Rollup. However, as this is an alpha release, there were surely be bugs. We are working to make the upgrade process smooth, and for that we will need your help to find and squash those bugly bugs.

To get started testing Solidity contracts in the OVM, follow this tutorial to turn an ERC20 contract test suite optimistic. For the adventurous, you can test out your own Solidity contracts! If you find any bugs, get confused, or want to add some tooling check out the OVM source & say hi in our discord!

Thank you for reading,

Optimism

Thanks to Hudson Jameson and Vitalik Buterin for edits ❤

--

--