OP Stack interop is in active development. Some features may be experimental.
This tutorial provides step-by-step instructions for how to send ETH from one chain in the OP Stack interop cluster to another.
For a conceptual overview,
see the interoperable ETH explainer.
Overview
Crosschain ETH transfers across OP Stack chains are facilitated through the SuperchainETHBridge contract. This tutorial walks through how to send ETH from one chain to another. You can do this on Supersim or production once it is released.What you’ll build
- A TypeScript application to transfer ETH between chains
What you’ll learn
- How to send ETH on the blockchain and between blockchains
- How to relay messages between chains
Prerequisites
Before starting this tutorial, ensure your development environment meets the following requirements:Technical knowledge
- Intermediate TypeScript knowledge
- Understanding of smart contract development
- Familiarity with blockchain concepts
Development environment
- Unix-like operating system (Linux, macOS, or WSL for Windows)
- Node.js version 16 or higher
- Git for version control
Required tools
The tutorial uses these primary tools:- Foundry: For smart contract development
- Supersim: For local blockchain simulation
- TypeScript: For implementation
- Viem: For blockchain interaction
1
2
Configure the network
You can run this tutorial either with Supersim running locally, or using the Interop devnet.
Select the correct tab and follow the directions.
- Supersim
- Interop Devnets
- Follow the Installation Guide to install Supersim for running blockchains with Interop.
-
Start Supersim.
-
Supersim uses Foundry’s
anvilblockchains, which start with ten prefunded accounts. Set these environment variables to access one of those accounts on the L2 blockchains. -
Specify the URLs to the chains.
3
Transfer ETH using Foundry
Run these commands:
4
Create the TypeScript project
Messages are relayed automatically in the interop devnet.
1
Create a new TypeScript project
2
Download the SuperchainETHBridge ABI
3
Create src/transfer-eth.mts
5
Run the example
-
Run the example.
-
Read the results.
The initial state. Note that the address depends on your private key; it should be different from mine.After the initiating message the balance on the source chain is immediately reduced. Notice that even though we are sending 0.001 ETH, the balance on the source chain is reduced by a bit more (here, approximately 67 gwei). This is the cost of the initiating transaction on the source chain. Of course, as there has been no transaction on the destination chain, that balance is unchanged.Now the balance on the destination chain increases, by slightly less than 0.001 ETH. The executing message also has a transaction cost (in this case, about 180gwei).
Next steps
- Check out the SuperchainETHBridge guide for more information.
- Review the OP Stack interop explainer for answers to common questions about interoperability.