Create a Blockchain
Environment Setup
In order to send messages between two chains, we need to create a blockchain. In this guide, we will spin up a local Avalanche network that has it's own Primary Network (C-, P- and X-Chain) using the Avalanche CLI. Furthermore, we will create a blockchain in that Avalanche network, so we can send messages between the C-Chain and the newly created blockchain in the next chapters.
In the following commands, make sure to substitute the name of your Avalanche L1 for <name>
(including the <>
). You can choose whatever name you want, but I recommend using myblockchain
as the name to avoid the need for some manual configuration.
Start Avalanche L1 Configuration
To create an Avalanche L1 configuration run the following command:
For example:
Select Virtual Machine
You will be prompted a wizard to configure your Avalanche L1. In the first question, select Subnet-EVM
:
Select Default EVM Configuration
In the second question, select I want to use defaults for a test environment
:
After the completing the configuration, you should see something like this:
This command creates the config files genesis.json
and sidecar.json
inside: ~/.avalanche-cli/subnets/<name>
. If you want, you can retrieve the current config with the following command:
To deploy your Avalanche L1, run
So in our case:
When prompted select Local Network
to deploy on.
After the deployment your should see something like this:
Make RPC-Endpoint publicly accessible
The final part of the output shows the wallet connection details. You can use these to connect your wallet like Core or Metasmask to you newly created Avalanche L1.
Since the Avalanche Network is running in a Github Codespace the localhost (127.0.0.1) will only be accessible from inside the Codespace. Connecting your wallet using the localhost RPC URL will not work, since your wallet will be running on your computer, and not the local environment where the network is running (the Codespace cloud).
Therefore, we need to make the RPC-Endpoint publicly accessible. Click on the little antenna icon in the bottom bar of the Codespace:
There select the row with the port 9650 and right-click to open the port: