logoDeveloper Hub

Teleporter 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.)

For more information on cross chain messaging through Teleporter and Warp, check:

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):

avalanche blockchain create <chain1> --evm --latest\
    --evm-chain-id 1 --evm-token TOKEN1 --evm-defaults
 
creating genesis for <blockchain chain1>
configuring airdrop to stored key "subnet_<chain1>_airdrop" with address 0x0EF8151A3e6ad1d4e17C8ED4128b20EB5edc58B1
loading stored key "cli-teleporter-deployer" for teleporter deploys
  (evm address, genesis balance) = (0xE932784f56774879e03F3624fbeC6261154ec711, 600000000000000000000)
using latest teleporter version (v1.0.0)
 Successfully created subnet configuration

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:

avalanche blockchain create <chain2> --evm --latest\
    --evm-chain-id 2 --evm-token TOKEN2 --evm-defaults
 
creating genesis for <blockchain chain2>
configuring airdrop to stored key "subnet_<chain2>_airdrop" with address 0x0EF815FFFF6ad1d4e17C8ED4128b20EB5edAABBB
loading stored key "cli-teleporter-deployer" for teleporter deploys
  (evm address, genesis balance) = (0xE932784f56774879e03F3624fbeC6261154ec711, 600000000000000000000)
using latest teleporter version (v1.0.0)
 Successfully created subnet configuration

Deploy the Avalanche L1s to Local Network

Let's deploy <chain1>:

avalanche blockchain deploy <chain1> --local
 
Deploying [<chain1>] to Local Network
Backend controller started, pid: 149427, output at: ~/.avalanche-cli/runs/server_20240229_165923/avalanche-cli-backend.log
 
Booting Network. Wait until healthy...
Node logs directory: ~/.avalanche-cli/runs/network_20240229_165923/node<i>/logs
Network ready to use.
 
Deploying Blockchain. Wait until network acknowledges...
 
Teleporter Messenger successfully deployed to c-chain (0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf)
Teleporter Registry successfully deployed to c-chain (0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25)
 
Teleporter Messenger successfully deployed to <chain1> (0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf)
Teleporter Registry successfully deployed to <chain1> (0x9EDc4cB4E781413b1b82CC3A92a60131FC111F58)
 
Using latest awm-relayer version (v1.1.0)
Executing AWM-Relayer...
 
Blockchain ready to use. Local network node endpoints:
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| NODE  |     VM    |                                        URL                                         |                  ALIAS URL                 |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| node1 | <chain1> | http://127.0.0.1:9650/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc | http://127.0.0.1:9650/ext/bc/<chain1>/rpc |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| node2 | <chain1> | http://127.0.0.1:9652/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc | http://127.0.0.1:9652/ext/bc/<chain1>/rpc |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| node3 | <chain1> | http://127.0.0.1:9654/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc | http://127.0.0.1:9654/ext/bc/<chain1>/rpc |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| node4 | <chain1> | http://127.0.0.1:9656/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc | http://127.0.0.1:9656/ext/bc/<chain1>/rpc |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
| node5 | <chain1> | http://127.0.0.1:9658/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc | http://127.0.0.1:9658/ext/bc/<chain1>/rpc |
+-------+-----------+------------------------------------------------------------------------------------+--------------------------------------------+
 
Browser Extension connection details (any node URL from above works):
RPC URL:          http://127.0.0.1:9650/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc
Funded address:   0x0EF8151A3e6ad1d4e17C8ED4128b20EB5edc58B1 with 1000000 (10^18) - private key: 16289399c9466912ffffffdc093c9b51124f0dc54ac7a766b2bc5ccf558d8eee
Network name:     <chain1>
Chain ID:         1
Currency Symbol:  TOKEN1

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.

avalanche blockchain deploy <chain2> --local
 
Deploying [<chain2>] to Local Network
 
Deploying Blockchain. Wait until network acknowledges...
 
Teleporter Messenger has already been deployed to c-chain
 
Teleporter Messenger successfully deployed to <chain2> (0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf)
Teleporter Registry successfully deployed to <chain2> (0x9EDc4cB4E781413b1b82CC3A92a60131FC111F58)
 
Using latest awm-relayer version (v1.1.0)
Executing AWM-Relayer...
 
Blockchain ready to use. Local network node endpoints:
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| NODE  |     VM    |                                         URL                                         |                  ALIAS URL                 |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node1 | <chain2> | http://127.0.0.1:9650/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc | http://127.0.0.1:9650/ext/bc/<chain2>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node1 | <chain1> | http://127.0.0.1:9650/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc  | http://127.0.0.1:9650/ext/bc/<chain1>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node2 | <chain2> | http://127.0.0.1:9652/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc | http://127.0.0.1:9652/ext/bc/<chain2>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node2 | <chain1> | http://127.0.0.1:9652/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc  | http://127.0.0.1:9652/ext/bc/<chain1>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node3 | <chain2> | http://127.0.0.1:9654/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc | http://127.0.0.1:9654/ext/bc/<chain2>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node3 | <chain1> | http://127.0.0.1:9654/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc  | http://127.0.0.1:9654/ext/bc/<chain1>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node4 | <chain2> | http://127.0.0.1:9656/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc | http://127.0.0.1:9656/ext/bc/<chain2>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node4 | <chain1> | http://127.0.0.1:9656/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc  | http://127.0.0.1:9656/ext/bc/<chain1>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node5 | <chain1> | http://127.0.0.1:9658/ext/bc/MzN4AbtFzQ3eKqPhFaDpwCMJmagciWSCgghkZx6YeC6jRdvb6/rpc  | http://127.0.0.1:9658/ext/bc/<chain1>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
| node5 | <chain2> | http://127.0.0.1:9658/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc | http://127.0.0.1:9658/ext/bc/<chain2>/rpc |
+-------+-----------+-------------------------------------------------------------------------------------+--------------------------------------------+
 
Browser Extension connection details (any node URL from above works):
RPC URL:          http://127.0.0.1:9650/ext/bc/2tVGwEQmeXtdnFURW1YSq5Yf4jbJPfTBfVcu68KWHdHe5e5gX5/rpc
Funded address:   0x0EF815FFFF6ad1d4e17C8ED4128b20EB5edAABBB with 1000000 (10^18) - private key: 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027
Network name:     <chain2>
Chain ID:         2
Currency Symbol:  TOKEN2

Verify Teleporter Is Successfully Set Up

To verify that Teleporter is successfully, let's send a couple of cross messages:

avalanche teleporter msg C-Chain chain1 "Hello World" --local
 
Delivering message "this is a message" to source subnet "C-Chain"
Waiting for message to be received at destination subnet subnet "chain1"
Message successfully Teleported!
avalanche teleporter msg chain2 chain1 "Hello World" --local
 
Delivering message "this is a message" to source subnet "chain2"
Waiting for message to be received at destination subnet subnet "chain1"
Message successfully Teleported!

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>:

avalanche blockchain describe <chain1>
 
 
 _____       _        _ _
|  __ \     | |      (_) |
| |  | | ___| |_ __ _ _| |___
| |  | |/ _ \ __/ _  | | / __|
| |__| |  __/ || (_| | | \__ \
|_____/ \___|\__\__,_|_|_|___/
+--------------------------------+-------------------------------------------------------------------------------------+
|           PARAMETER            |                               VALUE                                                 |
+--------------------------------+-------------------------------------------------------------------------------------+
| Blockchain Name                    | chain1                                                                              |
+--------------------------------+-------------------------------------------------------------------------------------+
| ChainID                        | 1                                                                                   |
+--------------------------------+-------------------------------------------------------------------------------------+
| Token Name                     | TOKEN1 Token                                                                        |
+--------------------------------+-------------------------------------------------------------------------------------+
| Token Symbol                   | TOKEN1                                                                              |
+--------------------------------+-------------------------------------------------------------------------------------+
| VM Version                     | v0.6.3                                                                              |
+--------------------------------+-------------------------------------------------------------------------------------+
| VM ID                          | srEXiWaHjFEgKSgK2zBgnWQUVEy2MZA7UUqjqmBSS7MZYSCQ5                                   |
+--------------------------------+-------------------------------------------------------------------------------------+
| Local Network SubnetID         | 2CZP2ndbQnZxTzGuZjPrJAm5b4s2K2Bcjh8NqWoymi8NZMLYQk                                  |
+--------------------------------+-------------------------------------------------------------------------------------+
| Local Network RPC URL          | http://127.0.0.1:9650/ext/bc/2cFWSgGkmRrmKtbPkB8yTpnq9ykK3Dc2qmxphwYtiGXCvnSwg8/rpc |
+--------------------------------+-------------------------------------------------------------------------------------+
| Local Network BlockchainID     | 2cFWSgGkmRrmKtbPkB8yTpnq9ykK3Dc2qmxphwYtiGXCvnSwg8                                  |
+                                +-------------------------------------------------------------------------------------+
|                                | 0xd3bc5f71e6946d17c488d320cd1f6f5337d9dce75b3fac5023433c4634b6e91e                  |
+--------------------------------+-------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf                                          |
| Messenger Address              |                                                                                     |
+--------------------------------+-------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0xbD9e8eC38E43d34CAB4194881B9BF39d639D7Bd3                                          |
| Registry Address               |                                                                                     |
+--------------------------------+-------------------------------------------------------------------------------------+
 
...

Obtaining C-Chain Information

Similar information can be found for C-Chain by using primary describe:

avalanche primary describe --local
 
   _____       _____ _           _         _____
  / ____|     / ____| |         (_)       |  __ \
 | |   ______| |    | |__   __ _ _ _ __   | |__) |_ _ _ __ __ _ _ __ ___  ___
 | |  |______| |    | '_ \ / _  | | '_ \  |  ___/ _  | '__/ _  | '_   _ \/ __|
 | |____     | |____| | | | (_| | | | | | | |  | (_| | | | (_| | | | | | \__ \
  \_____|     \_____|_| |_|\__,_|_|_| |_| |_|   \__,_|_|  \__,_|_| |_| |_|___/
 
+------------------------------+--------------------------------------------------------------------+
|          PARAMETER           |                               VALUE                                |
+------------------------------+--------------------------------------------------------------------+
| RPC URL                      | http://127.0.0.1:9650/ext/bc/C/rpc                                 |
+------------------------------+--------------------------------------------------------------------+
| EVM Chain ID                 | 43112                                                              |
+------------------------------+--------------------------------------------------------------------+
| TOKEN SYMBOL                 | AVAX                                                               |
+------------------------------+--------------------------------------------------------------------+
| Address                      | 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC                         |
+------------------------------+--------------------------------------------------------------------+
| Balance                      | 49999489.829989485                                                 |
+------------------------------+--------------------------------------------------------------------+
| Private Key                  | 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027   |
+------------------------------+--------------------------------------------------------------------+
| BlockchainID                 | 2JeJDKL9Bvn1vLuuPL1DpUccBCVUh7iRnkv3a5pV9kJW5HbuQz                 |
+                              +--------------------------------------------------------------------+
|                              | 0xabc1bd35cb7313c8a2b62980172e6d7ef42aaa532c870499a148858b0b6a34fd |
+------------------------------+--------------------------------------------------------------------+
| Teleporter Messenger Address | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf                         |
+------------------------------+--------------------------------------------------------------------+
| Teleporter Registry Address  | 0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25                         |
+------------------------------+--------------------------------------------------------------------+

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:

avalanche teleporter relayer stop --local
 
 Local AWM Relayer successfully stopped

To start it again:

avalanche teleporter relayer start --local
 
using latest awm-relayer version (v1.1.0)
Executing AWM-Relayer...
 Local AWM Relayer successfully started
Logs can be found at ~/.avalanche-cli/runs/awm-relayer.log

Last updated on

On this page

Edit on Github