Skip to content
Every change on Solana is a transaction: a list of instructions, signed by the accounts they spend from. In this step you send 1 USDC from your wallet to a new address. It settles in under a second, and the fee is a fraction of a cent, paid in SOL.

​Send the transaction

Save this as send-dollars.ts next to client.ts and run npx tsx send-dollars.ts.
TypeScript
Output of npx tsx send-dollars.tsLocal test network (Surfpool)
npx tsx send-dollars.ts
Sent 1 USDC to 7uayuZtw7YLxuGqU9cQ47wGqPsoZBhivDHDfLqP6Xckz
Signature: 66vHKDBp1xddS9Sc4SA5ymX56HNjsRoPaFwZud4dTEsFQeWmQ4LEDq1AGd4T69tQZHE8VwiHx9mozFG8p4qVxeQE
Explorer: https://explorer.solana.com/tx/66vHKDBp1xddS9Sc4SA5ymX56HNjsRoPaFwZud4dTEsFQeWmQ4LEDq1AGd4T69tQZHE8VwiHx9mozFG8p4qVxeQE?cluster=devnet
Recipient balance: 1 USDC
Confirmed
The script prints a link to your transaction in Solana Explorer. What the code does:
  • tokenBalance(...), from client.ts, checks that you have at least 1 USDC before sending.
  • client.token.instructions.transferToATA(...) builds two instructions:
    1. Open the recipient’s USDC token account if it doesn’t exist (and do nothing if it does). Your wallet pays its small deposit.
    2. Move 1 USDC: 1,000,000 base units, because USDC has 6 decimals. As a TransferChecked instruction, it also checks the mint and decimals, so a wrong amount fails instead of sending 1,000 times too much.
  • .sendTransaction() puts both in one transaction, with your wallet as fee payer, signs and sends it, and returns its signature once confirmed. The account is never opened without the payment arriving.
No devnet USDC yet? The script says so instead of sending. Get test USDC as in step 1, then run npx tsx send-dollars.ts again.