| title | Getting Started |
|---|---|
| description | Install the SDK, create your first agent, and send a private payment |
Install the SDK, create your first agent, and send a private payment in under 5 minutes.
- Node.js 18+
- A Wraith API key (sign up at wraith.dev)
- A wallet with a signing capability (MetaMask, viem, ethers, etc.)
npm install @wraith-protocol/sdkimport { Wraith, Chain } from "@wraith-protocol/sdk";
const wraith = new Wraith({
apiKey: "wraith_live_abc123",
});The Wraith client handles all communication with the managed TEE infrastructure. You never touch servers, keys, or chain-specific crypto directly.
An agent is your identity on the Wraith network. It has a .wraith name, an on-chain address, and stealth keys — all derived inside TEE hardware.
// 1. Sign a message with the owner wallet to prove ownership
const message = "Sign to create Wraith agent";
const signature = await wallet.signMessage(message);
// 2. Create the agent
const agent = await wraith.createAgent({
name: "alice",
chain: Chain.Horizen,
wallet: "0xYourWalletAddress",
signature: signature,
message: message,
});
console.log(agent.info.id); // UUID
console.log(agent.info.addresses[Chain.Horizen]); // "0x..."
console.log(agent.info.metaAddresses[Chain.Horizen]); // "st:eth:0x..."The agent is now live. It has:
- A
.wraithname (alice.wraith) registered on-chain - A stealth meta-address for receiving private payments
- An AI agent inside the TEE ready to process commands
On testnet, the agent is automatically funded via faucet. You can also request funds manually:
const response = await agent.chat("fund my wallet");
// Agent requests testnet tokens from the faucetUse natural language to send a stealth payment:
const response = await agent.chat("send 0.1 ETH to bob.wraith");
console.log(response.response);
// "Payment sent — 0.1 ETH to bob.wraith via stealth address 0x7a3f..."
console.log(response.toolCalls);
// [{ name: "send_payment", status: "success", detail: "..." }]Behind the scenes, the agent:
- Resolves
bob.wraithto a stealth meta-address - Generates a one-time stealth address from the meta-address
- Sends ETH to the stealth address
- Publishes an announcement so
bob.wraithcan detect the payment
const response = await agent.chat("scan for incoming payments");
// Agent scans the chain for announcements matching your stealth keysconst response = await agent.chat("what's my balance?");
// Agent reports native + token balancesOr programmatically:
const balance = await agent.getBalance();
console.log(balance.native); // "1.5"
console.log(balance.tokens); // { ZEN: "100.0", USDC: "50.0" }Move funds from stealth addresses to a destination:
const response = await agent.chat("withdraw all to 0xMyWallet");
// Agent warns about privacy risks before executingIf you already have an agent, reconnect without creating a new one:
// By agent ID
const agent = wraith.agent("agent-uuid-here");
// By owner wallet
const agent = await wraith.getAgentByWallet("0xYourWallet");
// By .wraith name
const agent = await wraith.getAgentByName("alice");All methods throw on failure. Errors include the server's error message:
try {
await agent.chat("send 100 ETH to bob.wraith");
} catch (err) {
console.error(err.message); // "Insufficient balance"
}- Single-Chain Agent Guide — deeper walkthrough
- Multichain Agent Guide — deploy across multiple chains
- Bring Your Own Model — use OpenAI or Claude instead of Gemini
- SDK Reference — full API documentation