How to Create an EVM-Based Subnet Configuration

Intermediate

 

How to Create an EVM-Based Subnet Configuration

This tutorial explains how to create an Ethereum Virtual Machine (EVM) based Subnet configuration in Avalanche-CLI. The tutorial walks through the process of creating the Subnet using the Subnet Creation Wizard. The wizard asks several questions to configure the Subnet such as choosing the SubnetEVM as the virtual machine, selecting a unique ChainID, naming the Subnet’s native token, selecting the latest version of Subnet-EVM, choosing a gas fee configuration, airdropping tokens, and adding precompiles. The tutorial also explains how to use a custom Genesis and overwrite an existing Subnet configuration.

To create an Ethereum Virtual Machine (EVM) compatible Subnet, Avalanche-CLI runs Subnet-EVM as its virtual machine.

Prerequisites

Using the Subnet Creation Wizard

The Subnet Creation Wizard walks you through the process of creating your Subnet. To get started, pick a name for your Subnet and run

avalanche subnet create <subnetName>

 

The following sections walk through each question in the wizard.

Choose Your VM

Select SubnetEVM.

Enter Your Subnet’s ChainID

Choose a unique positive integer for your EVM-style ChainID. Visit chainlist to verify that your selection is indeed unique.

Token Symbol

Enter a string to name your Subnet’s native token. The token symbol doesn’t necessarily need to be unique. Example token symbols are AVAX, JOE, and BTC.

Subnet-EVM Version

Select Use latest version.

Gas Fee Configuration

Select your fee configuration. The Ava Labs team highly recommends Low disk use / Low Throughput 1.5 mil gas/s (C-Chain's setting).

Airdrop

For development Subnets, select Airdrop 1 million tokens to the default address (do not use in production).

When you are ready to start more mature testing, select Customize your airdrop to distribute funds to additional addresses.

Precompiles

If you’d like to add precompiles to customize your Subnet, select Yes.

If you don’t or don’t know what that means, select No.

Wrapping Up

If the command works successfully, it prints Successfully created subnet configuration.

Using a Custom Genesis

The Subnet Creation Wizard won’t customize every aspect of the Subnet-EVM genesis for you. If you’d like complete control, you can specify a custom genesis by providing a path to the file you’d like to use. This bypasses most of the wizard’s prompts. Run with:

avalanche subnet create <subnetName> --file <filepath>

 

Overwriting an Existing Subnet Config

By default, creating a Subnet configuration with the same subnetName as one that already exists fails. To overwrite an existing config, use the -f force flag:

avalanche subnet create <existingSubnetName> -f