Subnet Creation

A quick review of creating a Subnet blockchain on Avalanche - the foundation for our permissioned L1.

In the Avalanche Fundamentals course, you learned how to create your own Subnet blockchain from scratch. This section provides a speedrun review of those concepts, focusing on creating the Subnet foundation that we'll later convert to a permissioned L1 with Validator Manager contracts.

Overview

Let's quickly review the Subnet creation process. This speedrun assumes you're already familiar with the concepts and just need a refresher before we dive into advanced permissioned validator management.

Connect & Fund Core Wallet

Quick Steps:

  1. Download Core Wallet if not already installed
  2. Connect your wallet and set to Tesnet mode (upper-right toggle button)
  3. Use the faucet on the Toolbox below to claim testnet AVAX
  4. Use the P-Chain faucet directly to claim AVAX on the P-Chain

Create Subnet and Blockchain Records

Create the P-Chain records for your Subnet by issuing two transactions:

  1. CreateSubnetTx - Creates a Subnet identified by the transaction hash
  2. CreateChainTx - Adds a blockchain to the Subnet
Logo

Create Chain

Create a subnet and add a new blockchain with custom parameters and genesis data.

Step 1: Create a Subnet

Every chain needs to be associated with a Subnet. If you don't have a Subnet, create one here. If you already have a Subnet, skip to the next step.

Step 2: Create a Chain

Enter the parameters for your new chain.

Virtual Machine

Select what Virtual Machine (VM) your chain will use.

Chain Parameters

Enter the basic parameters of your L1, such as the EVM chain ID.

Unique identifier for your blockchain. Check chainlist.org to avoid conflicts.

Permissions

By design, blockchain networks are fully permissionless, allowing anyone to transact and deploy smart contracts. However, certain use cases require permissioning to control who can participate in transactions or deploy contracts. On Avalanche, permissioning is an optional feature for Layer 1 blockchains that may or may not be activated, depending on the network's needs.

Tokenomics

Tokenomics in Layer 1 blockchains on the Avalanche network are highly flexible, allowing developers to tailor economic models to their specific needs. Each L1 can define its own native token, specifying its initial allocation, distribution mechanism, and whether it should be mintable for ongoing issuance. This enables a wide range of economic designs, from fixed-supply tokens to inflationary models that support network sustainability.

Transaction Fees & Gas

In addition to the native token, you can also configure the transaction fees (also known as gas fees). This allows Avalanche L1s to define the desired or maximal throughput of the blockchain differently.

Fill in the configuration to generate the genesis file.

Key Parameters:

  • Subnet Owner: Your P-Chain address (will lose privileges when we convert to L1 later)
  • Chain Name: Your blockchain's name
  • VM ID: The Virtual Machine type (usually Subnet-EVM)
  • Genesis Data: Initial blockchain configuration

Set Up Validator Node

Launch a node to track your Subnet using Docker. This node will become a validator for your Subnet, and later will be managed by the Validator Manager contract when we convert to L1.

Logo

Node Setup with Docker

This will start a Docker container running an RPC or validator node that tracks your L1.

Set up Instance

Set up a linux server with any cloud provider, like AWS, GCP, Azure, or Digital Ocean. Low specs (e.g. 2 vCPUs, 4GB RAM, 20GB storage) are sufficient for basic tests. For more extensive test and production L1s use a larger instance with appropriate resources (e.g. 8 vCPUs, 16GB RAM, 1 TB storage).

If you do not have access to a server, you can also run a node for educational purposes locally. Simply select the "RPC Node (Local)" option in the next step.

Docker Installation

Make sure you have Docker installed on your system. You can use the following commands to install it:

# Install Docker using convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
 
# Test installation
docker run -it --rm hello-world
 

If you do not want to use Docker, you can follow the instructions here.

Select L1

Enter the Avalanche Subnet ID of the L1 you want to run a node for.

Note on Complexity with Localhost

Running validator nodes on localhost can be complex due to networking constraints, port forwarding requirements, and reliability issues. One of the main challenges is securely opening the required ports for node communication while maintaining security.

For this course use, we strongly recommend using:

  • Self-Hosted Node Tool: Our upcoming self-hosted solution for running nodes securely
  • Cloud Providers: AWS, Google Cloud, Azure, or Digital Ocean for full control

For detailed setup instructions, see the Avalanche Fundamentals course.

Test Your Subnet

Deploy a test ERC-20 token to verify your Subnet is functioning correctly.

Logo

Deploy ERC20 Token

Deploy an ERC20 token contract for testing.
This will deploy an ERC20 token contract to your connected network (Chain ID: 0). You can use this token for testing token transfers and other ERC20 interactions, where a total supply of 1,000,000 tokens will be minted to your wallet - view the contract source code

To deploy more custom ERC20 tokens, you can use the OpenZeppelin ERC20 Contract Wizard

Cleanup (Optional)

Stop and remove your node when done testing:

# Stop the node
docker stop avago
 
# Remove the container (keeps state)
docker rm avago
 
# To completely remove state and credentials
rm -rf ~/.avalanchego

Key Takeaways

  • P-Chain Registry: All validators and blockchains are registered on the P-Chain
  • Subnet Foundation: Your Subnet provides the blockchain infrastructure that we'll enhance
  • Traditional Validation: Currently using Avalanche's standard Subnet validation model
  • Ready for Evolution: Your Subnet is now ready to be converted to a sovereign L1

What's Next: From Subnet to Permissioned L1

In the following chapters, we'll transform your Subnet into a sophisticated permissioned L1:

  1. Deploy Validator Manager Contracts: Learn how to deploy and configure smart contracts that will control validator access
  2. Convert to L1: Transform your Subnet into a sovereign L1 with the Validator Manager as the authority
  3. Implement Proof of Authority: Configure permissioned validator management with role-based access control
  4. Advanced Features: Add custom governance, tokenomics, and cross-chain communication

The Subnet you just created is the foundation - now we'll add the advanced permissioning and governance features that make it truly powerful for enterprise and regulated use cases.

Remember, this was just a speedrun review. For detailed explanations and troubleshooting, refer back to the full Avalanche Fundamentals course.

Is this guide helpful?

Report Issue