DEV Community

Cover image for Supersim: Simulating the Future of the Superchain Locally

Supersim: Simulating the Future of the Superchain Locally

There are moments when technology pulses as an extension of our own hearts, imploring us to share its possibilities. Today, my heart compels me to write about Supersim, a tool that promises to simplify development on the Superchain, allowing us to simulate complex environments locally. As a developer at Mode Network, I’ve had the opportunity to explore this tool and its potential, and I want to share how it can revolutionize development in the Superchain ecosystem.

What is Supersim?

Supersim is a lightweight tool designed to locally simulate the Superchain, a network that combines multiple L2s over a single L1. This allows developers not only to deploy contracts on multiple nodes simultaneously but also to test interoperability between different local blockchains. What makes this tool unique is that it facilitates communication between layers (L1 <> L2 and L2 <> L2) in a simple way, without needing to set up a complex network environment.

Key Features:

  • Multiple Anvil nodes: You can spin up multiple Anvil nodes with one command, allowing for quick testing in a local environment.
  • Predeployed OP Stack contracts: These contracts simulate how the Superchain infrastructure will work, such as bridges between layers and cross-chain messaging.
  • Interoperability support: Simulates message and asset transfers between L2 chains, testing key features such as deposits and token transfers.

How to Get Started with Supersim

If your heart is already beating to get started, here are the basic steps to set up Supersim:

1. Install Dependencies

Before starting, you need to install Foundry and make sure Anvil is correctly configured. This tool will serve as the base to run multiple nodes in your local environment. Once this is done, simply install Supersim:

brew install ethereum-optimism/tap/supersim
Enter fullscreen mode Exit fullscreen mode

2. Vanilla Mode

Supersim offers two main modes. In Vanilla mode, you can start three chains—one L1 and two L2—with OP Stack contracts already deployed. This is an ideal environment for basic interoperability tests and simulating message transfers between chains.

supersim
Enter fullscreen mode Exit fullscreen mode

3. Fork Mode

If you prefer to work with contracts already deployed on testnet or mainnet, you can use Fork mode. This allows you to fork any available chain in the Superchain network and simulate the current state of that chain in your local environment.

supersim fork --chains=op,base,zora
Enter fullscreen mode Exit fullscreen mode

Use Cases: The Power of Simulation

Supersim simplifies something that, for many of us, might seem overwhelming: interoperability between different layers and chains within the Superchain. There’s no longer a need to set up a complex environment to test how assets can move between L1 and L2 or how to transfer tokens from one L2 to another. Here’s an example:

Depositing ETH from L1 to L2:

cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9545
cast send 0xa01ae68902e205B420FD164435F299E07b0C778b "bridgeETH(uint32 _minGasLimit, bytes calldata _extraData)" 50000 0x --value 0.1ether --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Enter fullscreen mode Exit fullscreen mode

This process simulates a bridge between L1 and L2, allowing you to verify how the ETH balance changes once the process is completed. All in a local environment!

Transferring Tokens Between L2 Chains:

Similarly, Supersim allows you to test token transfers between two L2s with just a couple of commands. What’s most impressive is how the "autorelay" feature can be enabled to automatically send the cross-chain message without manual intervention.

supersim --interop.autorelay
Enter fullscreen mode Exit fullscreen mode

Why Use Supersim?

For those of us developing in the Superchain, Supersim allows us to iterate faster, test more complex contracts, and work on cross-chain flows without the complexity of setting up a full devnet. As a developer at Mode Network, I can say that this tool has made our testing easier and has accelerated development in environments where interoperability is key.

Contributing to the Future of the Superchain

At Mode Network, we strongly believe in open collaboration. If you have ideas, improvements, or simply want to contribute to the growth of this ecosystem, we invite you to get involved. The future of the Superchain depends on developers like you who dare to innovate. So don’t hesitate to join the project, contribute to Supersim, and stay tuned for updates from Mode Network.


My heart compelled me to write about this, and here I am, sharing this incredible tool with you. Don’t miss out on what’s coming, because we are just at the beginning of what Mode Network and the Superchain can achieve.

Let’s build together!


I hope this article inspires more developers to join the project and explore the incredible possibilities of Supersim.

Top comments (0)