Use any Native as Native Token (DIY)
Learn how to transfer a native token to a new Avalanche L1 and use it as the native token via ICTT.
In this section, you will learn how to transfer a native token from Avalanche’s C-Chain to a new Avalanche L1 using Interchain Token Transfers (ICTT) and set it up to act as the native token on the new L1. This guide will walk you through each step, from creating a L1 to transferring and using the native token.
Create a new blockchain and Deploy on Local Network
Use the avalanche
CLI to create a new blockchain where you will deploy the ERC-20 as the native token.
Take note of the important addresses (e.g., Teleporter Registry
, Funded Address
) from the deployment output as they will be needed in the following steps.
Wrap the Native Token on C-Chain
You'll need to deploy a wrapped token contract for your native token on the C-Chain. The wrapped token will serve as the transferable asset between the chains.
After deployment, save the Deployed to
address in an environment variable for future use.
Deploy Interchain Token Transfer Contracts
Now, deploy the Interchain Token Transfer contracts on both the C-Chain
and the myblockchain
to enable cross-chain token transfers.
NativeTokenHome
Contract on C-Chain
NativeTokenRemote
Contract onmyblockchain
Note: Ensure that the initial amount matches the native token amount minted on the C-Chain during the wrapped token deployment.
Export the deployed addresses as environment variables:
Grant Native Minting Rights to NativeTokenRemote
To ensure that the NativeTokenRemote
contract can mint native tokens on the L1 when ERC-20 tokens are transferred from the C-Chain
, the contract must be granted minting rights. This is done by adding the NativeTokenRemote
contract address to the Native Minter Precompile
.
-
You will need to interact with the
Native Minter Precompile
, which resides at a fixed address on all Avalanche L1s:
Native Minter Precompile Address:0x0200000000000000000000000000000000000001
-
Use the following command to grant the
NativeTokenRemote
contract minting rights by setting it as an enabled address on the Native Minter Precompile:
$NATIVE_TOKEN_REMOTE_L1
: The deployed address of theNativeTokenRemote
contract on your L1.
Once this step is completed, the NativeTokenRemote
contract will have the necessary permissions to mint native tokens when ERC-20 tokens are transferred from the C-Chain.
Register Remote Token with Home Transferer
Register the remote token on the home chain so that it recognizes the transferer contracts.
Collateralize and Transfer Tokens
Collateralize the home contract by locking native tokens. The amount of collateral should match the initial token reserve set on the myblockchain
.
- Approve Tokens for Transfer
Approve a certain number of tokens to be used by the Home Transferer.
- Add Collateral and Send Tokens
Add collateral to the transferer contract.
Send tokens to the L1.
Check Balances
Finally, check the balance on the L1 to confirm that the tokens were successfully transferred and minted.
You can also verify that the token is collateralized:
Conclusion
By following these steps, you’ll successfully transfer a native token from the C-Chain to a L1 and use it as the native token via Avalanche’s Interchain Token Transfer system.
For more detailed information, refer to the refer to the official Avalanche ICTT documentation.