Teleporter Avalanche L1s on Local Network
This how-to guide focuses on deploying Teleporter-enabled Avalanche L1s to a local Avalanche network.
After this tutorial, you would have created and deployed two Avalanche L1s to the local network and have enabled them to cross-communicate with each other and with the local C-Chain (through Teleporter and the underlying Warp technology.)
Note that currently only Subnet-EVM and Subnet-EVM-Based virtual machines support Teleporter.
Prerequisites
Create Avalanche L1 Configurations
Let's create an Avalanche L1 called <chain1>
with the latest Subnet-EVM version, a chain ID of 1, TOKEN1 as the token name, and with default Subnet-EVM parameters (more information regarding Avalanche L1 creation can be found here):
Notice that by default, Teleporter is enabled and a stored key is created to fund Teleporter related operations (that is deploy Teleporter smart contracts, fund Teleporter Relayer).
To disable Teleporter in your Avalanche L1, use the flag --teleporter=false
when creating the Avalanche L1.
To disable Relayer in your Avalanche L1, use the flag --relayer=false
when creating the Avalanche L1.
Now let's create a second Avalanche L1 called <chain2>
, with similar settings:
Deploy the Avalanche L1s to Local Network
Let's deploy <chain1>
:
Notice some details here:
- Two smart contracts are deployed to each Avalanche L1: Teleporter Messenger and Teleporter Registry
- Both Teleporter smart contracts are also deployed to
C-Chain
in the Local Network - AWM Teleporter Relayer is installed, configured and executed in background (A Relayer listens for new messages being generated on a source Avalanche L1 and sends them to the destination Avalanche L1.)
CLI configures the Relayer to enable every Avalanche L1 to send messages to all other Avalanche L1s. If you add more Avalanche L1s, the Relayer will be automatically reconfigured.
When deploying Avalanche L1 <chain2>
, the two Teleporter contracts will not be deployed to C-Chain in Local Network as they have already been deployed when we deployed the first Avalanche L1.
Verify Teleporter Is Successfully Set Up
To verify that Teleporter is successfully, let's send a couple of cross messages:
You have Teleport-ed your first message in the Local Network!
Relayer related logs can be found at ~/.avalanche-cli/runs/awm-relayer.log
, and Relayer configuration can be found at ~/.avalanche-cli/runs/awm-relayer-config.json
Obtaining Information on Teleporter Deploys
Obtaining Avalanche L1 Information
By executing blockchain describe
on a Teleporter enabled Avalanche L1, the following relevant information can be found:
- Blockchain RPC URL
- Blockchain ID in cb58 format
- Blockchain ID in plain hex format
- Teleporter Messenger address
- Teleporter Registry address
Let's get the information for <chain1>
:
Obtaining C-Chain Information
Similar information can be found for C-Chain by using primary describe
:
Controlling Relayer Execution
Besides having the option to not use a Relayer at Avalanche L1 creation time, the Relayer can be stopped and restarted on used request.
To stop the Relayer:
To start it again: