logoDocumentation

Deploy a Smart Contract

Deploy a smart contract on your Avalanche L1.

This tutorial assumes that:

Step 1: Setting up Core

EVM Avalanche L1 Settings: (EVM Core Tutorial)

  • Network Name: Custom Subnet-EVM
  • New RPC URL: http://NodeIPAddress:9650/ext/bc/BlockchainID/rpc (Note: the port number should match your local setting which can be different from 9650.)
  • ChainID: Subnet-EVM ChainID
  • Symbol: Subnet-EVM Token Symbol
  • Explorer: N/A

You should see a balance of your Avalanche L1's Native Token in Core.

balance

Step 2: Connect Core and Deploy a Smart Contract

Using Remix

Open Remix -> Select Solidity.

remix Avalanche L1 evm sc home

Create the smart contracts that we want to compile and deploy using Remix file explorer

Using GitHub

In Remix Home Click the GitHub button.

remix Avalanche L1 evm sc load panel

Paste the link to the Smart Contract into the popup and Click import.

remix Avalanche L1 evm sc import

For this example, we will deploy an ERC721 contract from the Avalanche Smart Contract Quickstart Repository.

remix Avalanche L1 evm sc file explorer

Navigate to Deploy Tab -> Open the "ENVIRONMENT" drop-down and select Injected Web3 (make sure Core is loaded).

remix Avalanche L1 evm sc web3

Once we injected the web3-> Go back to the compiler, and compile the selected contract -> Navigate to Deploy Tab.

remix Avalanche L1 evm sc compile

Now, the smart contract is compiled, Core is injected, and we are ready to deploy our ERC721. Click "Deploy."

remix Avalanche L1 evm sc deploy

Confirm the transaction on the Core pop up.

balance

Our contract is successfully deployed!

remix Avalanche L1 evm sc deployed

Now, we can expand it by selecting it from the "Deployed Contracts" tab and test it out.

remix Avalanche L1 evm sc end

The contract ABI and Bytecode are available on the compiler tab.

remix Avalanche L1 evm sc ABI

If you had any difficulties following this tutorial or simply want to discuss Avalanche with us, you can join our community at Discord!

You can use Subnet-EVM just like you use C-Chain and EVM tools. Only differences are chainID and RPC URL. For example you can deploy your contracts with hardhat quick start guide by changing url and chainId in the hardhat.config.ts.

Last updated on

On this page

Edit on Github