Skip to content
Starfield Labs

Tutorials

Send your first USDC on Arc testnet with ethers v6

Create a throwaway wallet, fund it from the Circle faucet, send testnet USDC on Arc with ethers v6, and read the receipt.

By Labs News DeskPublished Beginner30 min

Cover card for the tutorial: Send your first USDC on Arc testnet with ethers v6

Before you start

  • Node.js 20 or newer
  • A terminal
  • A throwaway test wallet

Arc is a blockchain built for stablecoins. Its gas token is USDC, so you pay fees in the same dollar-pegged asset you send. In this tutorial you will send testnet USDC from a script. You need no prior blockchain experience, but you should know basic JavaScript and be able to run commands in a terminal.

You will do five things:

  1. Connect to Arc testnet and confirm the chain.
  2. Create a throwaway wallet.
  3. Get testnet USDC from the Circle faucet.
  4. Send USDC and wait for the transaction to finish.
  5. Read the receipt and find the transaction in a block explorer.

Use a throwaway testnet key. The scripts store a private key in a .env file. Anyone who has that key controls the wallet. Never use a wallet that holds real funds, and never reuse a key from a wallet you use elsewhere. Testnet USDC has no real value, so a throwaway key is the right choice here.

What you need

  • Node.js 20.12 or later. We tested with Node 20.20.2 and npm 10.8.2.
  • A terminal and a text editor.
  • A web browser, for the faucet step.

Set up the project

Download the project folder, then install the dependencies from its package.json:

cd arc-testnet-usdc-ethers/project
npm install

The project pins ethers to version 6.17.0 exactly. It uses ES modules, so the scripts use import. The package.json also overrides the ws package to 8.23.0. ethers 6.17.0 depends on an older ws release with a known high-severity advisory. The override keeps npm audit clean without changing ethers.

Next, copy the example environment file. You will fill it in shortly:

cp .env.example .env

Confirm the network

Arc has a mainnet and a testnet. Each one has its own chain ID and RPC URL. This tutorial uses the testnet values from the Arc docs:

Setting Value
Chain ID 5042002
RPC URL https://rpc.testnet.arc.io
Explorer https://explorer.testnet.arc.io
USDC (ERC-20 interface) 0x3600000000000000000000000000000000000000

The shared settings live in common.js. Look at it first. The connect function creates an ethers provider and passes the chain ID. If the RPC returns a different chain, ethers throws an error, so a wrong network fails early:

// common.js (excerpt)
export const RPC_URL = "https://rpc.testnet.arc.io";
export const CHAIN_ID = 5042002;
export const USDC_ADDRESS = "0x3600000000000000000000000000000000000000";

export function connect() {
  return new JsonRpcProvider(RPC_URL, { name: "arc-testnet", chainId: CHAIN_ID });
}

Run the connection check:

npm run check-connection

You should see output like this:

RPC: https://rpc.testnet.arc.io
Chain ID: 5042002
Latest block: 75407244

The block number changes over time. The chain ID must read 5042002.

Create a throwaway wallet

Run this command:

npm run make-wallet

The script calls Wallet.createRandom() from ethers. It writes the private key to .env with permissions that only your user can read, and it prints only the public address. It never prints the key.

// make-wallet.js (core)
const wallet = Wallet.createRandom();
writeFileSync(envPath, `PRIVATE_KEY=${wallet.privateKey}\n`, { mode: 0o600 });
console.log(`Address: ${wallet.address}`);

The script refuses to overwrite an existing .env. Delete .env yourself if you want a new wallet.

Copy the address from the output. You will paste it into the faucet.

Get testnet USDC from the faucet

Open the Circle testnet faucet in your browser. Then:

  1. Select USDC.
  2. Select Arc Testnet in the network menu.
  3. Paste your wallet address into Send to.
  4. Select Send 20 USDC. The faucet may show a reCAPTCHA. Complete it if it appears.

The faucet sends 20 USDC. It allows one request for each asset and network every two hours. If you see "Limit Exceeded", wait and try again later.

After a few seconds the page shows "Tokens sent" with a link to the transaction. Check the balance next.

Check the balance

Run this command:

npm run check-balance

The output shows two numbers for USDC:

Address: 0x23b19d64aD57F63451A3476579E73B6AC80885F3
Native balance (18 decimals): 20.0 USDC
ERC-20 decimals(): 6
ERC-20 balance: 20.0 USDC

Arc has two interfaces for USDC, and they use different precision:

  • The native balance is the gas token. It uses 18 decimals, like ether on Ethereum.
  • The ERC-20 interface uses 6 decimals, which is the normal USDC precision.

Both interfaces read the same balance. The docs say to call decimals() on the ERC-20 contract and not to assume a number, so the script does that:

// check-balance.js (core)
const [nativeWei, decimals, rawBalance] = await Promise.all([
  provider.getBalance(wallet.address),
  usdc.decimals(),
  usdc.balanceOf(wallet.address),
]);
console.log(`Native balance (18 decimals): ${formatUnits(nativeWei, 18)} USDC`);
console.log(`ERC-20 balance: ${formatUnits(rawBalance, decimals)} USDC`);

If the balance is still zero, wait a little longer and run the command again.

Send USDC

Send to any address you control. For a test, you can use a second wallet, or a second account from another wallet app. Do not send to an address you cannot control, because you cannot get the funds back.

npm run send-usdc -- 0xRECIPIENT_ADDRESS 0.5

The script does three things:

  1. It reads decimals() from the contract, which is 6.
  2. It converts your amount with parseUnits. So 0.5 becomes 500000, the integer that the contract stores.
  3. It calls transfer and waits for the receipt.
// send-usdc.js (core)
const decimals = await usdc.decimals();
const amount = parseUnits(amountText, decimals);

const tx = await usdc.transfer(to, amount);
console.log(`Transaction hash: ${tx.hash}`);

const receipt = await tx.wait();
console.log(`Status: ${receipt.status === 1 ? "success" : "failed"}`);

tx.wait() returns when the transaction is in a block. Until then, the transaction is pending. A success status means the transfer ran.

The output looks like this, with your own hash and block number:

From: 0x23b19d64aD57F63451A3476579E73B6AC80885F3
To: 0x6A62Be8e9b75430050CF02E62940AF956c547546
Amount: 0.5 USDC (500000 base units, 6 decimals)
Transaction hash: 0xd77de3d4865a97dce2d87d1e0100040608b4cabc90fb32e54bed0bde14fe90fe
Explorer: https://explorer.testnet.arc.io/tx/0xd77de3d4865a97dce2d87d1e0100040608b4cabc90fb32e54bed0bde14fe90fe
Waiting for the receipt...
Status: success
Block: 75407380
Gas used: 73938
Sent: 0.5 USDC

Gas is paid in USDC from the native balance. The gas cost comes out of the 20 USDC you received, so your balance drops by a little more than 0.5.

Read the receipt

You can read any transaction's receipt with its hash:

npm run read-receipt -- 0xd77de3d4865a97dce2d87d1e0100040608b4cabc90fb32e54bed0bde14fe90fe

The script prints the status, the block, and every USDC Transfer event in the transaction:

Status: success
Block: 75407380
Gas used: 73938
Transfer: 0x23b19d64aD57F63451A3476579E73B6AC80885F3 -> 0x6A62Be8e9b75430050CF02E62940AF956c547546: 0.5 USDC

The script uses parseLog to decode each log. A transaction can contain other events, so it skips any log that does not come from the USDC contract.

Open the same hash in the explorer at https://explorer.testnet.arc.io/tx/<hash>. The page shows the status, block, sender, recipient, and the USDC amount.

When something goes wrong

Sending before you have funds. The script stops during gas estimation and sends nothing. It prints:

Send failed: execution reverted: "ERC20: transfer amount exceeds balance"

Fund the wallet first, then try again.

The faucet says "Limit Exceeded". Wait two hours for the same asset and network, or request from another address.

check-connection shows the wrong chain ID. The script throws an error. Check that RPC_URL is https://rpc.testnet.arc.io. Arc mainnet uses a different chain ID.

read-receipt says no receipt was found. The hash may be wrong, or the transaction may still be pending. Wait and run it again.

Next steps

  • Add a function that sends USDC to several addresses. Use parseUnits for every amount.
  • Read the Arc docs on gas and fees, and compare the native balance with the ERC-20 balance after a few transfers.
  • Read the ethers docs on Wallet and Contract if you want to write your own calls.

When you finish, delete .env, or keep it only with a throwaway key. Testnet funds have no value, but a key in a file can still leak.

Build this at our next hackathon

Dark Factory Hackathon

Registration closes

Register now: Dark Factory Hackathon

Keep reading

All tutorials

Build what you just read

Join an AI hackathon

  • Ultimate AI Game Hackathon

    Ultimate AI Game Hackathon

    Nov 30, 2026 – Jan 31, 2027129 builders registered

    Took the week off for GTA VI? Respect. Now build your own game. Inspired by GTA VI.

    Live
  • Dark Factory Hackathon

    Dark Factory Hackathon

    Dec 14 – 21249 builders registered

    Open models. Real code. One BAND of agents. Build a multi-agent system where at least three agents plan, hand off and check each other's work through BAND. Any model works, with a focus on open-weight ones, via an API or locally. Teams of 1-6, fully online, free to join.

    Open

Browse hackathons