- Generates and registers an with Circle.
- Creates a Wallet Set and an Wallet on Arc Testnet.
- Appends credentials to the project
.envfor use in later guides. - After you fund the wallet (using the Circle Faucet), creates a second wallet in the same wallet set, sends USDC to it, and verifies both wallet balances.
Prerequisites
Before you begin, ensure you have:- A Circle Developer Account and an API key created.
- Node.js 22+ installed.
Step 1. Set up your project
Create a project directory, install dependencies, and configure the project.1.1. Create the project and install dependencies
In your terminal, create a directory for your dev-controlled wallet scripts. You’ll add more scripts to this folder in later guides.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:
YOUR_API_KEY is your actual Circle Developer API key.
Step 2. Create the script
Create a file namedcreate-wallet.ts. The script appends credentials to your
project .env and writes the recovery file and wallet details to output/.
Each subsection below adds a new functionality.
2.1. Add imports and constants
Add the required imports and constants:create-wallet.ts
2.2. Register entity secret
Add themain function, generate a 32-byte Entity Secret, register it with
Circle (the SDK saves the recovery file to output/), and append the secret to
your project .env:
create-wallet.ts
2.3. Create wallet set
Add the SDK client and create a Wallet Set.create-wallet.ts
2.4. Create the wallet
Create a wallet on Arc Testnet, append its address and blockchain to your project.env, write wallet details to output/wallet-info.json, and prompt
for the faucet:
create-wallet.ts
2.5. Pause for faucet
Add a readline prompt so the script waits until you have funded the wallet:create-wallet.ts
2.6. Create second wallet, send USDC, and verify balances
After you have funded the first wallet and pressed Enter, the script creates a second wallet in the same wallet set, sends USDC to it, waits for the transaction to complete, then prints both wallets’ token balances:create-wallet.ts
2.7. Copy the full script
The completecreate-wallet.ts is below. Replace the contents with the full
script below if you prefer:
create-wallet.ts
-
Reads your API key from
.env(via--env-file) or the environment. -
Generates a 32-byte Entity Secret, registers it with Circle (recovery file is
saved to
output/), and appendsCIRCLE_ENTITY_SECRETto your project.env.See Entity Secret Management for more details on generation, rotation, and recovery. - Initializes the dev-controlled wallets client with your API key and Entity Secret.
-
Creates a wallet set and a wallet on Arc Testnet; appends
CIRCLE_WALLET_ADDRESSandCIRCLE_WALLET_BLOCKCHAINto.envand writesoutput/wallet-info.json. - Prompts you to fund the wallet at the Circle Faucet (Arc Testnet), then waits until you press Enter to continue.
- Creates a second wallet in the same wallet set, sends USDC to it, polls until the transaction is complete, then prints both wallets’ token balances.
Step 3. Run the script
3.1. Launch in your terminal
From your project directory, run:.env, writes the recovery file and wallet-info.json to output/,
then pauses. You should see output like this:
3.2. Fund the wallet
While the script is waiting, fund the wallet using the Circle Faucet:- Copy the wallet address from the script output (or from
.envoroutput/wallet-info.json). - Visit the official Circle Faucet.
- Select Arc Testnet as the blockchain network.
- Paste the wallet address in the Send to field.
- Click Send USDC.
The script verifies both wallets’ balances at the end. You can also verify any
address on the Arc Testnet explorer by pasting
it in the search field.
Output files
After a successful run:.env: The script appendsCIRCLE_ENTITY_SECRET,CIRCLE_WALLET_ADDRESS, andCIRCLE_WALLET_BLOCKCHAINto your existing.env. Use this same.envfor follow-up guides (for example, Send a Transaction to Transfer Assets).output/: The SDK writes the recovery file here; the script writeswallet-info.json(wallet details, including address and blockchain).
Summary
In this guide, you created a dev-controlled wallet on Arc Testnet. The script appends credentials to your project.env, writes the recovery file and
wallet-info.json to output/, and in a single run sends USDC to a second
wallet and verifies both balances. Main points to remember:
- Wallet ready: This guide creates a wallet (and a second one in the same wallet set) that you can use in successive guides.
- Single run: The script pauses so you can fund the first wallet at the Circle Faucet; after you press Enter, it creates the second wallet, sends USDC to it, and prints both wallets’ token balances.
- Credentials: Entity Secret and wallet address/blockchain are in your
project
.env; the recovery file and wallet details are inoutput/. Never commit them and always keep them secure. - Follow-up guides: Use the same project and
.env.