Transfer Native Tokens
Interact with native tokens
In this exercise, you will learn how to transfer native tokens on your own L1 in the Avalanche network using Foundry, a powerful toolkit for EVM application development. We will use the blockchain you have create in the last chapter.
Create account
avalanche key create myAddressSave the Key to an Environment Variable
Retrieve the new address with and store it in an environment variable to match the following commands.
avalanche key list -l --blockchains myblockchain --keys myAddressexport MYADDRESS=0x...Check the Balance
Now we are checking the balance of that key on your L1. Make sure to replace the --rpc-url flag with appropriate name of your L1.
cast balance $MYADDRESS --rpc-url myblockchainTransfer funds
cast send $MYADDRESS --value 200000 --private-key $PK --rpc-url myblockchainIf you encounter the following error:
error: a value is required for '--private-key <RAW_PRIVATE_KEY>' but none was suppliedThis means the private key environment variable isn't set properly. You'll need to export your private key using the command below:
export PK=56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027Check balances to confirm transfer
cast balance $MYADDRESS --rpc-url myblockchainAs you saw, funds were transfered from one count to another within the same chain (myblockchain)
Is this guide helpful?




