Skip to main content

Connect to EVM Testnet and deploy a Solidity Smart Contract

info

In this tutorial, we will connect to EVM Testnet, connect Metamask to it, get funded and deploy a smart contract in Solidity.

Prerequisites

  • Metamask or any other wallet of your choice.
  • Remix or any other development environment of your choice.

Connect to EVM Testnet

You can either just use the following button to add the EVM Testnet network to Metamask or enter the information manually.

To add the EVM Testnet network manually to your Metamask use following info:

Metamask Adding New Network

Alternatively, you can setup your own EVM Smart Contract Chain on top of the Shimmer network and provide a custom URL, which might look something like: https://api.sc.testnet.shimmer.network/chain/rms1prr4r7az8e46qhagz5atugjm6x0xrg27d84677e3lurg0s6s76jr59dw4ls/evm/jsonrpc as well as your own custom Chain ID.

Hit Save and wait for Metamask to connect to the network.

At this point, our Metamask wallet is connected to the Shimmer EVM Testnet, but we don't have any funds in it. So, let's try to get some.

Get EVM Account Funded

Open EVM Toolkit and enter your EVM address as shown below: EVM Toolkit

In case, you've setup a custom EVM chain, you'd need to add your custom network first. Please add your own chain address and select the relevant network as shown below: EVM Toolkit Custom Network

Once you're done, click on Send funds and wait for a few minutes for the faucet to process. You should start seeing some funds on your Metamask wallet soon.

Now, open Remix ide or your favourite IDE and let's try to deploy a solidity smart contract.

Deploy Solidity Smart Contract

Here's a sample solidity smart contract that we will be deploying:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Storage {
uint256 number;
function store(uint256 num) public {
number = num;
}
function retrieve() public view returns (uint256){
return number;
}
}

If you've a different smart contract that you wish to deploy, feel free to.

Go to the Run tab and Select Injected Provider - Metamask as your environment as shown below: Injected Provider - MetaMask

Then, click on Deploy and confirm the Metamask transaction as shown below: Metamask Confirm

And voila—it's done!

Video Tutorial

info

Feel free to play around and reach out to us on discord on #evm-contracts-dev in case you're facing any issues.