A Guide To Creating a Subnet on Avalanche

A Guide To Creating a Subnet on Avalanche

Avalanche is a groundbreaking blockchain platform known for its high-performance consensus protocol and flexibility in creating custom blockchain networks. In this tutorial, we’ll introduce you to Avalanche and guide you through the process of creating and deploying your own Subnet, an essential component of the Avalanche development ecosystem.

What is Avalanche

Avalanche is a next-generation blockchain platform designed to address the scalability and decentralization challenges faced by earlier blockchain networks like Bitcoin and Ethereum. It stands out for its unique consensus protocol, known as Avalanche consensus, which allows for rapid and secure transaction processing. Avalanche is capable of supporting a wide range of decentralized applications (dApps) and assets, making it a versatile choice for developers.

What is a Subnet

In the context of Avalanche, a Subnet is a specialized blockchain network that can be customized to suit specific use cases and requirements. Subnets can be thought of as individual branches of the Avalanche network, each with its own unique features, consensus rules, and governance structures.

Subnets enable developers to create blockchain networks tailored to their needs, whether for running smart contracts, managing digital assets, or launching decentralized applications. They can be EVM-based (Ethereum Virtual Machine), making them compatible with Ethereum tools and languages, or they can be designed with custom features to support various decentralized applications.

Now, let’s dive into the step-by-step process of creating and deploying your very own Avalanche Subnet.

Avalanche Subnet Development and Deployment

Step 1: Installation

Begin by installing Avalanche-CLI with the following command:

curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-cli/main/scripts/install.sh | sh -s

This command will install Avalanche-CLI in the ~/bin directory. If it doesn’t exist, the script will create it. To make the command accessible from anywhere, add it to your system’s PATH with:

export PATH=~/bin:$PATH

Step 2: Create Your Subnet Configuration

Now, let’s create a Subnet configuration. We’ll create an EVM-based Subnet, and for this example, we’ll name it “mySubnet.” You can choose any name you prefer.

avalanche subnet create mySubnet

Follow these steps during the Subnet Creation Wizard:

Choose Your VM: Select "SubnetEVM."
Enter Your Subnet's ChainID: Pick a unique positive integer.
Token Symbol: Name your Subnet's native token (e.g., AVAX, JOE, BTC).
Subnet-EVM Version: Use the latest version.
Gas Fee Configuration: Select "Low disk use / Low Throughput 1.5 mil gas/s (C-Chain's setting)."
Airdrop: Choose "Airdrop 1 million tokens to the default address" (not for production use).
Precompiles: Select "No" for now.

Upon successful configuration, you will see “Successfully created subnet configuration.”

Step 3: Deploying Subnets Locally

Now, let’s deploy your Subnet locally with the following command:

avalanche subnet deploy mySubnet

Make sure to replace “mySubnet” with your chosen Subnet name if different. Select “Local Network” as the deployment option.

The command will set up a five-node Avalanche network on your machine. It may take a few minutes to complete.

Note: If you’re using bash on ARM64 on Mac, you may need Rosetta 2. Install it with

softwareupdate --install-rosetta

if required.

Upon successful deployment, the output will resemble the following:

✔ Local Network

Deploying [mySubnet] to Local Network

Network ready to use. Local network node endpoints:

You now have your local Subnet running!

Conclusion

Congratulations! You’ve successfully created and deployed your first Avalanche Subnet. You can use the provided network endpoints to interact with your Subnet, and it’s ready for further development and testing. Explore the possibilities of building on the Avalanche platform and take your Subnet development to the next level with our expertise. Connect with our blockchain developers to get started.