transfer in a few lines, use the Stable SDK.
What you’ll build
Five scripts forming a minimal payment app:wallet.ts— create or restore a wallet.getBalance.ts— query the current USDT0 balance.send.ts— send USDT0 to another address.receive.ts— watch for incoming payments in real time.history.ts— query past Transfer events for an address.
Demo
Prerequisites
- Node.js 20 or later.
- A private key with testnet USDT0 (see Quick start to fund a wallet).
Project setup
config.ts shared by every script:
1. Create or restore a wallet
A wallet is a key pair derived from a seed phrase. Generate one for a new user and return the phrase so they can back it up. A returning user restores their wallet from the same phrase.2. Check the balance
USDT0 is the native asset on Stable, so balance queries work exactly like ETH on Ethereum. Native balance is 18 decimals, useformatEther for display.
3. Send a payment
The sender signs and submits a transfer directly. On Stable, USDT0 is the native asset, so a simple value transfer is the cheapest path (21,000 gas). This is the same code path as “Send” in any payment app.4. Receive payments in real time
The receiver listens for incomingTransfer events. This is equivalent to push notifications in a traditional payment app. On Stable, single-slot finality means the receiver sees a payment almost instantly.
Native transfers (value transfers) also emit a
Transfer event on the USDT0 ERC-20 contract because USDT0 is both the native asset and an ERC-20 token on Stable. A single event listener covers both transfer methods.5. Query transaction history
Query pastTransfer events to build a transaction history view, like a bank statement or transaction list in any payment app.
Next recommended
Subscribe and collect
Pull-based recurring subscriptions with EIP-7702 delegation.
Paying with invoice
Settle invoices with ERC-3009 and deterministic nonces.
Send your first USDT0
Reference the basic native vs. ERC-20 transfer flow.

