Prerequisites for Aptos to EVM Tutorials
Before starting the Aptos to EVM tutorials, ensure you have:
Development Environment
-
Aptos CLI: Install the Aptos CLI by following the official installation guide.
-
Node.js v20 or higher: You can use the nvm package to install and switch between Node.js versions. Once installed, verify the node version with:
node -vExample output:
$ node -v v22.15.0 -
Npm: For installing and managing dependencies.
-
Git: For cloning the repository.
Starter Kit Repository
-
Clone the CCIP Aptos Starter Kit:
git clone https://github.com/smartcontractkit/aptos-starter-kit.git -
Navigate to the directory:
cd aptos-starter-kit -
Install dependencies:
npm install
Understanding Named Addresses in the Manifest File (Move.toml)
The Move build system uses a manifest file, Move.toml, to define a package, its dependencies, and any named addresses it references. Named addresses are human-readable aliases for on-chain hexadecimal addresses, which makes the Move code cleaner, more readable, and easier to manage.
When you compile a Move package, the compiler replaces these aliases (e.g., @ccip_router) with their actual address values from the Move.toml file.
In the aptos-starter-kit, the example modules (like ccip_message_sender, ccip_message_receiver) need to interact with the core CCIP modules already deployed on the Aptos Testnet. The [addresses] section in their Move.toml files provides the necessary references.
Example Move.toml Address Block:
[addresses]
ccip = "0xc748085bd02022a9696dfa2058774f92a07401208bbd34cfd0c6d0ac0287ee45"
mcms = "0xbdf1b9aacb4e21bf6f255105831df0172e911d4748e488196fde10d2e2a4e32d"
mcms_register_entrypoints = "0x0"
ccip_onramp = "0xc748085bd02022a9696dfa2058774f92a07401208bbd34cfd0c6d0ac0287ee45"
ccip_router = "0xc748085bd02022a9696dfa2058774f92a07401208bbd34cfd0c6d0ac0287ee45"
Here is a breakdown of what each named address represents:
-
ccip: This is the main Object address under which the core CCIP packages and their modules (likefee_quoter,rmn_remote,token_admin_registry, etc.) are published. -
ccip_router&ccip_onramp: These aliases also point to the main CCIP Object address. This is because therouterandonrampmodules are part of the packages published under that single, unified Object. The aliases are defined for clarity and consistency in the Move code'susestatements. -
mcms: This is the address of the on-chain ManyChainMultiSig (MCMS) module, which is responsible for handling governance and administrative actions for the CCIP protocol through a secure, time-locked implementation process. -
mcms_register_entrypoints: This is a special value used as a compile-time flag. By setting it to0x0, the module is compiled in a way that bypasses the logic for registering with the MCMS system. This is useful for certain testing or deployment scenarios where the MCMS module is not relevant.
By defining these addresses in the Move.toml file, the example modules can interact with the core CCIP protocol without hardcoding long addresses, making the code portable and easier to update for different networks.
Wallets
-
Aptos Account: You'll need an Aptos account. If you don't have one, create it with:
aptos init --network testnetThis command will guide you through creating a new account for Testnet and will save the credentials in a
.aptos/config.yamlfile. This also configures your Aptos CLI to use Testnet.Verify your current configuration with:
aptos config show-profilesThis should show your
defaultprofile configured for Testnet, with thenetworkset toTestnet.Example output:
$ aptos config show-profiles { "Result": { "default": { "network": "Testnet", "has_private_key": true, "public_key": "ed25519-pub-0x2ecdd2d7bc0cbfe2e44c219ef9a9fddc986b384f4a01fb5d821cf0dab5d2fbae", "account": "d0e227835c33932721d54ae401cfaae753c295024fe454aa029b5e2782d2fad4", "rest_url": "https://fullnode.testnet.aptoslabs.com" } } } -
EVM Wallet Address: You'll need an EVM-compatible wallet address to receive tokens on the destination chain (Ethereum Sepolia). You only need the address itself, not the private key, as you are only sending to this address.
Environment Configuration (.env file)
The starter kit uses a .env file to manage sensitive information like private keys and RPC URLs. Create a new file named .env in the root of the aptos-starter-kit directory by copying the example file:
cp .env.example .env
Next, open the .env file and fill in the following values:
PRIVATE_KEY_HEX: The private key of your source wallet (EOA) on Aptos Testnet from which you're sending CCIP-BnM tokens. You can find this in the.aptos/config.yamlfile created by theaptos init --network testnetcommand, as shown in the Wallets section above.ETHEREUM_SEPOLIA_RPC_URL: The RPC endpoint for the Ethereum Sepolia testnet. This is required by the verification script (aptos2evm/checkMsgExecutionStateOnAptos.ts) to read theExecutionStateChangedevent from the CCIP OffRamp on Ethereum Sepolia. You can obtain an RPC URL by signing up for a personal endpoint from Alchemy, Infura, or another node provider service.
Example .env file:
PRIVATE_KEY_HEX=<YOUR_APTOS_PRIVATE_KEY_HEX>
ETHEREUM_SEPOLIA_RPC_URL=<RPC_URL_FOR_ETHEREUM_SEPOLIA>
Native Tokens for Transaction Fees
APT tokens are used for Aptos transaction fees. For these tutorials, we will also use APT to pay for CCIP fees.
-
Obtain APT on Testnet using the faucet:
You can use the official Aptos Testnet Faucet to get APT tokens. Simply enter your Aptos account address and click on Mint to request tokens.
-
Check your account balance:
aptos account balanceExample output:
$ aptos account balance { "Result": [ { "asset_type": "coin", "coin_type": "0x1::aptos_coin::AptosCoin", "balance": 100000000 } ] }
Obtaining Testnet Tokens
BnM Tokens on Aptos
To complete the cross-chain token transfer examples, you'll need BnM tokens. To obtain CCIP-BnM tokens on Aptos Testnet, run the faucets/aptos/dripCCIPBnMToken.ts script included in the starter kit.
Run the following command in your terminal:
npx ts-node scripts/faucets/aptos/dripCCIPBnMToken.ts --to <YOUR_APTOS_WALLET_ADDRESS>
The output looks like this:
1 CCIP-BnM token is minted to 0xd0e227835c33932721d54ae401cfaae753c295024fe454aa029b5e2782d2fad4 successfully.
Please check the transaction at https://explorer.aptoslabs.com/txn/0x7e5d5bae918c97cb086c72023012da2a8a230c91155f8ff697eb29001f606e55?network=testnet