This page demonstrates how to create an Avalanche L1 using Avalanche-CLI.
This tutorial walks you through the process of using Avalanche-CLI to create an Avalanche L1, deploy it to a local network, and connect to it with Core wallet.
The first step of learning Avalanche L1 development is learning to use Avalanche-CLI.
This tutorials teaches you how to create an Ethereum Virtual Machine (EVM) based Avalanche L1. To do so, you use Subnet-EVM, Avalanche's L1 fork of the EVM. It supports airdrops, custom fee tokens, configurable gas parameters, and multiple stateful precompiles. To learn more, take a look at Subnet-EVM. The goal of your first command is to create a Subnet-EVM configuration.
The avalanche-cli command suite provides a collection of tools for developing and deploying Avalanche L1s.
The Creation Wizard walks you through the process of creating your Avalanche L1. To get started, first pick a name for your Avalanche L1. This tutorial uses myblockchain, but feel free to substitute that with any name you like. Once you've picked your name, run:
avalanche blockchain create myblockchain
The following sections walk through each question in the wizard.
? Which validator management type would you like to use in your blockchain?: ▸ Proof Of Authority Proof Of Stake Explain the difference
Select Proof Of Authority.
? Which address do you want to enable as controller of ValidatorManager contract?: ▸ Get address from an existing stored key (created from avalanche key create or avalanche key import) Custom
Select Get address from an existing stored key.
? Which stored key should be used enable as controller of ValidatorManager contract?: ▸ ewoq cli-awm-relayer cli-teleporter-deployer
Select ewoq.
This key is used to manage (add/remove) the validator set.
Do not use EWOQ key in a testnet or production setup. The EWOQ private key is publicly exposed.
To learn more about different validator management types, see PoA vs PoS.
? Do you want to use default values for the Blockchain configuration?: ▸ I want to use defaults for a test environment I want to use defaults for a production environment I don't want to use default values Explain the difference
Select I want to use defaults for a test environment.
This will automatically setup the configuration for a test environment, including an airdrop to the EWOQ key and Avalanche ICM.
Choose a positive integer for your EVM-style ChainID.
In production environments, this ChainID needs to be unique and not shared with any other chain. You can visit chainlist to verify that your selection is unique. Because this is a development Avalanche L1, feel free to pick any number. Stay away from well-known ChainIDs such as 1 (Ethereum) or 43114 (Avalanche C-Chain) as those may cause issues with other tools.
Enter a string to name your Avalanche L1's native token. The token symbol doesn't necessarily need to be unique. Example token symbols are AVAX, JOE, and BTC.
Make sure to substitute the name of your Avalanche L1 if you used a different one than myblockchain.
? Choose a network for the operation: ▸ Local Network Devnet Etna Devnet Fuji Testnet Mainnet
Next, select Local Network.
This command boots a two nodes Avalanche network on your machine. It needs to download the latest versions of AvalancheGo and Subnet-EVM.
Note: If you run bash on your shell and are running Avalanche-CLI on ARM64 on Mac, you will require Rosetta 2 to be able to deploy Avalanche L1s locally. You can download Rosetta 2 using softwareupdate --install-rosetta .
If all works as expected, the command output should look something like this:
> avalanche blockchain deploy myblockchain✔ Local NetworkDeploying [myblockchain] to Local NetworkNetwork has already been booted.Using [P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p] to be set as a change owner for leftover AVAXInstalling avalanchego-v1.12.1...avalanchego-v1.12.1 installation successfulBackend controller started, pid: 33210, output at: /Users/l1-developer/.avalanche-cli/local/myblockchain-local-node-local-network/server.logAvalancheGo path: /Users/l1-developer/.avalanche-cli/bin/avalanchego/avalanchego-v1.12.1/avalanchego✓ Local cluster myblockchain-local-node-local-network not found. Creating...Starting local avalanchego node using root: /Users/l1-developer/.avalanche-cli/local/myblockchain-local-node-local-network ...✓ Booting Network. Wait until healthy...Waiting for P-Chain to be bootstrapped✓ Avalanchego started and ready to use from /Users/l1-developer/.avalanche-cli/local/myblockchain-local-node-local-networkNode logs directory: /Users/l1-developer/.avalanche-cli/local/myblockchain-local-node-local-network/node1/logsNetwork ready to use.URI: http://127.0.0.1:60538NodeID: NodeID-ABuKofpRtHhFwAm4FXQNSpCR9jqtXWUwaYour blockchain control keys: [P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p]Your subnet auth keys for chain creation: [P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p]CreateSubnetTx fee: 0.000010278 AVAXSubnet has been created with ID: fvx83jt2BWyibBRL4SRMa6WzjWp7GSFUeUUeoeBe1AqJ5Ey5wNow creating blockchain...CreateChainTx fee: 0.000095680 AVAX+--------------------+----------------------------------------------------+| DEPLOYMENT RESULTS | |+--------------------+----------------------------------------------------+| Chain Name | myblockchain |+--------------------+----------------------------------------------------+| Subnet ID | fvx83jt2BWyibBRL4SRMa6WzjWp7GSFUeUUeoeBe1AqJ5Ey5w |+--------------------+----------------------------------------------------+| VM ID | qDNV9vtxZYYNqm7TN1mYBuaaknLdefDbFK8bFmMLTJQJKaWjV |+--------------------+----------------------------------------------------+| Blockchain ID | 2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED |+--------------------+ +| P-Chain TXID | |+--------------------+----------------------------------------------------+Now calling ConvertSubnetToL1Tx...ConvertSubnetToL1Tx fee: 0.000036992 AVAXConvertSubnetToL1Tx ID: 2n6L5gfEFayPEWhc7XcpumfwHeqjyZLrcrFjvU5EugcXZ2xAAWWaiting for L1 to be converted into sovereign blockchain ... 100% [===============] Restarting node node1 to track subnetWaiting for blockchain myblockchain to be bootstrappedWaiting for rpc http://127.0.0.1:60538/ext/bc/2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED/rpc to be available✓ myblockchain-local-node-local-network successfully tracking myblockchain✓ Checking if node is healthy...✓ Node is healthy after 0 secondsInitializing Proof of Authority Validator Manager contract on blockchain myblockchain ...✓ Proof of Authority Validator Manager contract successfully initialized on blockchain myblockchainRPC Endpoint: http://127.0.0.1:60538/ext/bc/2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED/rpcICM Messenger successfully deployed to myblockchain (0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf)ICM Registry successfully deployed to myblockchain (0x695Ea5FbeBBdc99cA679F5fD7768f179d2281d74)ICM Messenger has already been deployed to c-chainRelayer is not deployed due to there is already a local relayer deployed for Local NetworkTo deploy relayer, call `avalanche interchain relayer deploy`✓ L1 is successfully deployed on Local Network+---------------------------------------------------------------------------------------------------------------------------------+| MYBLOCKCHAIN |+---------------+-----------------------------------------------------------------------------------------------------------------+| Name | myblockchain |+---------------+-----------------------------------------------------------------------------------------------------------------+| VM ID | qDNV9vtxZYYNqm7TN1mYBuaaknLdefDbFK8bFmMLTJQJKaWjV |+---------------+-----------------------------------------------------------------------------------------------------------------+| VM Version | v0.7.0 |+---------------+-----------------------------------------------------------------------------------------------------------------+| Validation | Proof Of Authority |+---------------+--------------------------+--------------------------------------------------------------------------------------+| Local Network | ChainID | 111 || +--------------------------+--------------------------------------------------------------------------------------+| | SubnetID | fvx83jt2BWyibBRL4SRMa6WzjWp7GSFUeUUeoeBe1AqJ5Ey5w || +--------------------------+--------------------------------------------------------------------------------------+| | BlockchainID (CB58) | 2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED || +--------------------------+--------------------------------------------------------------------------------------+| | BlockchainID (HEX) | 0xb883b54815c84a3f0903dbccd289ed5563395dd61c189db626e2d2680546b990 || +--------------------------+--------------------------------------------------------------------------------------+| | RPC Endpoint | http://127.0.0.1:60538/ext/bc/2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED/rpc |+---------------+--------------------------+--------------------------------------------------------------------------------------++------------------------------------------------------------------------------------+| ICM |+---------------+-----------------------+--------------------------------------------+| Local Network | ICM Messenger Address | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf || +-----------------------+--------------------------------------------+| | ICM Registry Address | 0x695Ea5FbeBBdc99cA679F5fD7768f179d2281d74 |+---------------+-----------------------+--------------------------------------------++---------------------------+| TOKEN |+--------------+------------+| Token Name | NAT Token |+--------------+------------+| Token Symbol | NAT |+--------------+------------++----------------------------------------------------------------------------------------------------------------------------------------+| INITIAL TOKEN ALLOCATION |+-------------------------+------------------------------------------------------------------+---------------+---------------------------+| DESCRIPTION | ADDRESS AND PRIVATE KEY | AMOUNT (NAT) | AMOUNT (WEI) |+-------------------------+------------------------------------------------------------------+---------------+---------------------------+| Used by ICM | 0x001CBe3650FAD190d9ccBd57b289124F5131AA57 | 600 | 600000000000000000000 || cli-teleporter-deployer | d00b93e1526d05a30b681911a3e0f5e5528add205880c1cafa4f84cdb2746b00 | | |+-------------------------+------------------------------------------------------------------+---------------+---------------------------+| Main funded account | 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC | 1000000 | 1000000000000000000000000 || ewoq | 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 | | |+-------------------------+------------------------------------------------------------------+---------------+---------------------------++-----------------------------------------------------------------------------------------------------------------+| SMART CONTRACTS |+-----------------------+--------------------------------------------+--------------------------------------------+| DESCRIPTION | ADDRESS | DEPLOYER |+-----------------------+--------------------------------------------+--------------------------------------------+| Proxy Admin | 0xC0fFEE1234567890aBCdeF1234567890abcDef34 | 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |+-----------------------+--------------------------------------------+--------------------------------------------+| PoA Validator Manager | 0x0C0DEbA5E0000000000000000000000000000000 | |+-----------------------+--------------------------------------------+--------------------------------------------+| Transparent Proxy | 0x0Feedc0de0000000000000000000000000000000 | |+-----------------------+--------------------------------------------+--------------------------------------------++----------------------------------------------------------------------+| INITIAL PRECOMPILE CONFIGS |+------------+-----------------+-------------------+-------------------+| PRECOMPILE | ADMIN ADDRESSES | MANAGER ADDRESSES | ENABLED ADDRESSES |+------------+-----------------+-------------------+-------------------+| Warp | n/a | n/a | n/a |+------------+-----------------+-------------------+-------------------++--------------------------------------------------------------------------+| NODES |+-------+------------------------------------------+-----------------------+| NAME | NODE ID | LOCALHOST ENDPOINT |+-------+------------------------------------------+-----------------------+| node1 | NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg | http://127.0.0.1:9650 |+-------+------------------------------------------+-----------------------+| node2 | NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ | http://127.0.0.1:9652 |+-------+------------------------------------------+-----------------------++--------------------------------------------------------------------------------------------------------+| WALLET CONNECTION |+-----------------+--------------------------------------------------------------------------------------+| Network RPC URL | http://127.0.0.1:60538/ext/bc/2QGB9GbEhsFJLSRVii2mKs8dxugHzmK98G5391P2bvXSCb4sED/rpc |+-----------------+--------------------------------------------------------------------------------------+| Network Name | myblockchain |+-----------------+--------------------------------------------------------------------------------------+| Chain ID | 111 |+-----------------+--------------------------------------------------------------------------------------+| Token Symbol | NAT |+-----------------+--------------------------------------------------------------------------------------+| Token Name | NAT Token |+-----------------+--------------------------------------------------------------------------------------+
This address derives from a well-known private key. Anyone can steal funds sent to this address. Only use it on development networks that only you have access to. If you send production funds to this address, attackers may steal them instantly.
First, you need to import your airdrop private key into Core.
In the Accounts screen, select the Imported tab. Click on Import private key.
Here, enter the private key. Import the well-known private key 0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027.
Next, rename the Core account to prevent confusion. On the Imported tab, click on the pen icon next to your account. Rename the account DO NOT USE -- Public test key to prevent confusion with any personal wallets.
Congrats Subnetooooor, you just deployed your first Avalanche L1!
After you feel comfortable with this deployment flow, try deploying smart contracts on your chain with Remix, Hardhat, or Foundry. You can also experiment with customizing your Avalanche L1 by addingprecompiles or adjusting the airdrop.