This guide walks you through transferring EURC on EVM testnets using Viem and Node.js. You’ll build a simple script that checks your balance and sends test transfers.Documentation Index
Fetch the complete documentation index at: https://developers.circle.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure that you’ve:- Installed Node.js v22+
- Prepared a testnet wallet on the selected chain funded with:
- Testnet EURC for the transfer
- Testnet native tokens for gas fees
You can get testnet EURC from Circle’s faucet.
Step 1. Set up the project
This step shows you how to prepare your project and environment.1.1. Create the project and install dependencies
Create a new directory and install the required dependencies:Shell
1.2. Configure TypeScript (optional)
Create atsconfig.json file:
tsconfig.json file:
1.3. Set environment variables
Create a.env file in the project directory and add your wallet private key,
replacing {YOUR_PRIVATE_KEY} with the private key from your EVM wallet and
{YOUR_RECIPIENT_ADDRESS} with the address of the recipient.
PRIVATE_KEYis the private key for the EVM wallet sending the transfer.RECIPIENT_ADDRESSis the EVM wallet address that will receive the EURC.
npm run start command loads variables from .env using Node.js native
env-file support.
Step 2. Create the transfer script
In this step, you’ll build a script in TypeScript that transfers EURC on the selected EVM testnet. The script includes a single list of supported chains, prompts you to choose one at runtime, and then runs the same transfer flow for that chain.2.1. Create the script file
2.2. Add the script
Inindex.ts, add the following script. It keeps the per-chain data in one
CHAIN_CONFIGS list so supporting another EVM testnet only requires one new
entry.
TypeScript
Step 3. Run the script
Run the script using the following command:Shell
Explorer: line
and open it in your browser. This will take you to the testnet’s block explorer,
where you can view full transaction details.
Summary
In this quickstart, you learned how to check balances and transfer EURC on EVM testnets using one multi-chain Viem script in Node.js. Here are the key points to remember:- Testnet only. Testnet EURC has no real value.
- Gas fees. You need a small amount of the testnet’s native token for gas.
- Security. Keep your private key in
.env. Never commit secrets. - Single script. The same script works across all supported EVM testnets.
- Minimal ABI. The script only uses
balanceOfandtransferfor simplicity.