Using Remix
How to deploy with Remix IDE on MODE
Last updated
How to deploy with Remix IDE on MODE
Last updated
Mode is an OP Stack Layer-2 designed for hyper-growth. Since MODE is built with the OP Stack, it is EVM compatible, allowing you to easily port your existing Ethereum-based smart contracts without modifying the code.
Letâs see how to deploy a smart contract on MODE using the Remix IDE.
This guide assumes you have got Sepolia ETH and bridged to the Mode Testnet Network.
First of all you will need to have Mode network added to your Metamask. Follow for the step-by-step on how to add Mode testnet to Metamask.
We are ready to get started!
Remix is a no-setup tool with a graphical interface for developing smart contracts. Itâs easy to get started allowing a simple deployment process, debugging, interacting with smart contracts, and more. Itâs a great tool to test quick changes and interact with deployed smart contracts.
For the sake of this tutorial, we will be deploying the â1_Storage.solâ smart contract that comes as an example in Remix, but you can use any of your code. Here is the sample code, you can paste this in any .sol file:
To compile your smart contract, go to the Solidity Compiler tab and select the contract you want to compile. Click on "Compile", you can also enable "Auto Compile" for automatic compilation whenever you change the contract code.
Make sure to open the advanced configurations and setting the EVM version to London. This is to avoid an issue with the PUSH0 opcode. You can read more on the issue with all the Optimism chains here.
Once the smart contract is compiled successfully, switch to the "Deploy & Run Transactions" tab.
In the "Environment" dropdown menu, select "Injected Provider - MetaMask"; this will connect your MetaMask to Remix and will allow you to make transactions from that connected wallet.
Make sure to have Mode as your selected network in Metamask before deploying
Select the compiled contract you want to deploy and click âDeploy.â
Now, MetaMask should pop up and ask you to confirm the transaction with super low fees.
CONGRATULATIONS! You just deployed your first smart contract to Mode.
Now that you have deployed your first smart contract to Mode letâs see how to interact with it.
You will see your deployed smart contract below in the âDeploy & Run Transactionsâ tab. You can use the Remix interface to call the methods defined in your smart contract and access itâs public variables.
We can also find our deployed smart contract in Blockscout, the Mode block scanner. Copy the contract address from Remix, go to Blockscout, and paste it into the search bar.
The screenshot below shows our deployed smart contract, where you can see all transactions, the creator wallet, balance, and more!
Notice that if you call one of the smart contract methods in Remix, you should see the transaction pop up in this explorer. You can directly interact with your deployed smart contract with Remix.
You now have learned how to deploy a smart contract on Mode using Remix online IDE!
In this tutorial, we also went through the Mode bridge, block explorer, and how to interact with your contract.
To learn more about Mode and how to turn your code into a business, join our Discord and say hello đ
If you want the next challenge, you can try registering a contract for the SFS following this guide: SFS - Registering a contract with Remix