The fastest way to install the latest Avalanche-CLI binary is by running the install script:
The binary installs inside the ~/bin directory. If the directory doesn't exist, it will be created.
You can run all of the commands in this tutorial by calling ~/bin/avalanche.
You can also add the command to your system path by running:
If you add it to your path, you should be able to call the program anywhere with just avalanche. To add it to your path permanently, add an export command to your shell initialization script (ex: .bashrc or .zshrc).
This tutorials teaches you how to create an Ethereum Virtual Machine (EVM) based Avalanche L1. To do so, you use Subnet-EVM, Avalanche's Avalanche 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 L1 command suite provides a collection of tools for developing and deploying Avalanche L1s.
The Avalanche L1 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:
The following sections walk through each question in the wizard.
This address will be able to add and remove validators from your Avalanche L1. You can either use an existing key or create a new one.
In addition to being the PoA owner, this address will also be the owner of the ProxyAdmin contract of the Validator Manager's TransparentUpgradeableProxy. This address will be able to upgrade the Validator Manager implementation through upgrading the proxy.
The CLI provides some default values to help you get started. You can choose to use these defaults or customize them.
These values include things such as airdrop amount, gas fees, and gas limits.
For this tutorial, select I want to use defaults for a test environment.
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.
Next, select Local Network.
This command boots a five node Avalanche network on your machine. It needs to download the latest versions of AvalancheGo and Subnet-EVM. The command may take a couple minutes to run.
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:
You can use the deployment details to connect to and interact with your Avalanche L1. Now it's time to interact with it.
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.
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.