Prerequisites for EVM to TON Tutorials
Before starting the EVM to TON tutorials, ensure you have the following:
Development Environment
-
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:
Terminalnode -vExample output:
$ node -v v22.15.0 -
npm: For installing and managing dependencies.
-
Git: For cloning the repository.
Starter Kit Repository
-
Clone the CCIP TON Starter Kit:
Terminalgit clone https://github.com/smartcontractkit/ccip-starter-kit-ton.git -
Navigate to the directory:
Terminalcd ccip-starter-kit-ton -
Install dependencies:
Terminalnpm install
This installs the required TON SDK packages, including @ton/core, @ton/ton, and @ton/crypto, as well as ethers for the EVM-side scripts.
Wallets
-
EVM Wallet and Private Key: You need an EVM wallet to send CCIP messages from an EVM chain (e.g., Ethereum Sepolia) and to deploy receiver contracts.
- Set up a wallet like MetaMask.
- Export the private key for the account you intend to use. Follow the official MetaMask guide to obtain your private key.
-
TON Wallet: You need a TON wallet to deploy the receiver contract on TON Testnet. The starter kit uses the V4R2 wallet version. You can create a TON wallet using Tonkeeper:
- Download and install Tonkeeper
- Create a new wallet and save the 24-word recovery phrase (mnemonic)
- Add a Testnet Account using the same mnemonic
- In wallet settings, select V4R2 as the wallet version
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 ccip-starter-kit-ton directory by copying the example file:
cp .env.example .env
Next, open the .env file and fill in the required values:
-
EVM_PRIVATE_KEY: The private key (with0xprefix) of your EVM wallet. Required for sending CCIP messages from EVM chains and deploying receiver contracts on TON. -
ETHEREUM_SEPOLIA_RPC_URL: The RPC endpoint for Ethereum Sepolia. Required when sending from Ethereum Sepolia. You can obtain a free RPC URL from providers like Alchemy, Infura, or QuickNode. -
ARBITRUM_SEPOLIA_RPC_URL(optional): The RPC endpoint for Arbitrum Sepolia if you plan to send messages from this chain. -
TON_MNEMONIC: Your 24-word mnemonic phrase for the TON wallet. Required to deploy the receiver contract on TON Testnet. -
TON_RPC_URL(optional): Override the default TON RPC endpoint. The default ishttps://ton-testnet.api.onfinality.io/public, which does not require an API key. -
TON_CENTER_API_KEY(optional): Only required if you use a toncenter RPC URL (e.g.,https://testnet.toncenter.com/api/v2/jsonRPC). Get a free API key from @tonapibot on Telegram.
Example .env file:
EVM_PRIVATE_KEY=0xYourEVMPrivateKey
ETHEREUM_SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
ARBITRUM_SEPOLIA_RPC_URL=https://arb-sepolia.g.alchemy.com/v2/YOUR_API_KEY
TON_MNEMONIC="word1 word2 word3 ... word24"
Testnet Tokens
ETH on Ethereum Sepolia
ETH is required to pay for EVM transaction fees and CCIP fees when sending from Ethereum Sepolia. Use the Chainlink Faucet to get test ETH.
LINK on Ethereum Sepolia (optional)
When paying CCIP fees in LINK instead of ETH, you need LINK tokens on the source chain. Use the Chainlink Faucet to get test LINK.
GRAM on Testnet
A small amount of GRAM is required to deploy the receiver contract and pay for transactions on TON Testnet.
- Visit the TON Testnet Faucet on Telegram
- Send your V4R2 testnet wallet address to
@testgiver_ton_bot - The bot will send you 2 testnet GRAM (you can request again every 60 minutes)