Walk through the full agent lifecycle on one chain: create an agent, fund it, send stealth payments, scan for incoming transfers, and withdraw safely.
Wraith gives every agent a .wraith name, an on-chain address, and a stealth meta-address — all derived inside a TEE so your keys never leave secure hardware. This guide covers the complete lifecycle for a single-chain agent from creation through withdrawal.
All examples use Chain.Horizen. Swap in any supported chain — the SDK interface is identical.
On testnet, ask the agent to request tokens from the faucet:
const res = await agent.chat("fund my wallet");console.log(res.response);// "Wallet funded with testnet ETH. Balance: 0.5 ETH"
3
Check your balance
Use natural language or the programmatic method:
const res = await agent.chat("what's my balance?");// "Balance: 0.5 ETH, 0 ZEN, 0 USDC"
4
Send a stealth payment
Address the recipient by their .wraith name. The agent resolves the name, generates a one-time stealth address, sends the funds, and publishes an on-chain announcement — all in one step.
const res = await agent.chat("send 0.1 ETH to bob.wraith");console.log(res.response);// "Payment sent — 0.1 ETH to bob.wraith via stealth address 0x7a3f..."
Behind the scenes the agent:
Resolves bob.wraith to a stealth meta-address
Generates a one-time stealth address from that meta-address
Sends ETH to the stealth address
Publishes an on-chain announcement so the recipient can detect the payment
5
Scan for incoming payments
The agent scans announcements on-chain and filters for transfers to your stealth keys:
const res = await agent.chat("scan for payments");console.log(res.response);// "Found 2 incoming payments:// - 0.1 ETH at 0xabc... (balance: 0.1 ETH)// - 0.05 ETH at 0xdef... (balance: 0.05 ETH)"
6
Withdraw
Move funds out of a specific stealth address or sweep everything at once.
const res = await agent.chat( "withdraw 0.05 ETH from 0xabc... to 0xMyWallet");
Withdrawing all stealth addresses to a single known wallet links every incoming payment to your identity. Read the privacy best practices guide before sweeping funds.
If the agent already exists, reconnect without creating a new one. Three lookup methods are available:
// By agent ID (no network call)const agent = wraith.agent("agent-uuid");// By owner wallet addressconst agent = await wraith.getAgentByWallet("0xMyWallet");// By .wraith nameconst agent = await wraith.getAgentByName("alice");
const res = await agent.chat( "create an invoice for 0.5 ETH with memo design work");console.log(res.response);// "Invoice created — [Pay 0.5 ETH](https://pay.wraith.dev/invoice/uuid)"// Check status laterawait agent.chat("check my invoices");
const res = await agent.chat( "schedule 0.1 ETH to bob.wraith every week");// "Scheduled: 0.1 ETH to bob.wraith weekly, next run in 7 days"await agent.chat("list my schedules");await agent.chat("cancel schedule abc-123");
Ask the agent to analyse your stealth address activity and surface any privacy risks:
const res = await agent.chat("run a privacy check");console.log(res.response);// "Privacy Score: 90/100// Issues:// - (info) 3 unspent stealth addresses// Best Practices:// - Use a fresh destination for each withdrawal// - Space withdrawals at least 1 hour apart// - Vary payment amounts slightly"