- Circle Wallets
- Viem
Prerequisites
Before you begin, make sure you have:- A Circle Developer Console account
- An API key created in the Console:
Keys → Create a key → API key → Standard Key - Your Entity Secret registered
Step 1. Set up your project
In this step, you set up your local development environment and install the required dependencies.1.1. Create the project and install dependencies
Create a new directory, navigate to it and initialize a new project.1.2. Configure TypeScript (optional)
This step is optional. It helps prevent missing types in your IDE or editor.
tsconfig.json file:Shell
1.3. Set environment variables
Create a.env file in the project directory with your Circle credentials,
replacing these placeholders with your own credentials:.env
CIRCLE_API_KEYis your Circle Developer API key for Wallets API requests.CIRCLE_ENTITY_SECRETis your registered entity secret used to authorize developer-controlled wallet operations.
.env using
Node.js native env-file support.Step 2. Set up your wallets
In this step, you create two Arc Testnet dev-controlled wallets and fund one of them with testnet USDC or EURC for the transfer flow. If you already have two Arc Testnet dev-controlled wallets and one is funded with USDC or EURC, skip to Step 3.2.1. Create wallets
Import the Wallets SDK and initialize the client using your API key and Entity Secret. Dev-controlled wallets are created in a wallet set, which serves as the source from which individual wallet keys are derived.If you’re calling the API directly, you’ll need
to make two requests: one to create the wallet set; one to create the wallet.Be sure to replace the
Entity Secret ciphertext
and the idempotency key in your request. If you’re using the SDKs, this is
handled automatically for you.
2.2. Fund a wallet with testnet stablecoins
Obtain testnet USDC or EURC from the Circle Faucet or the Console Faucet to perform actions like making transfers and paying gas fees. You’ll need a funded balance to execute transactions using your dev-controlled wallet.2.3. Check the wallet balances
You can check your wallet balances from the Circle Developer Console or programmatically by making a request to GET /wallets/{id}/balances with the specified wallet ID.Step 3. Transfer USDC / EURC
In this step, you set up your script, execute the USDC or EURC transfer, and check the result.3.1. Set up the transfer script and execute the transfer
Replace thewalletAddress field with the address of the funded wallet, and the
destinationAddress field with the address of the other wallet.- USDC
- EURC
3.2. Verify the status of the transfer
You can check the status of the transfer with thegetTransaction method by
providing the transaction ID obtained from the previous step.txHash) value and look up the
transaction details on the Arc Testnet explorer.Summary
After completing this tutorial, you’ve successfully:- Set up a wallet workflow for either Circle Wallets or a self-managed wallet
- Prepared your wallet with testnet tokens
- Transferred USDC or EURC from one wallet to another