Run a payments agent
Hold a private balance and send payments from a server, a bot or an AI agent, with no wallet and no browser.
@senddy/node runs Senddy headlessly. An agent holds its own private balance, receives payments, and sends them, all from code. Its keys come from a seed you control, and every transaction is relayed, so it never needs gas.
Install#
npm install @senddy/nodeCreate an agent#
import { createSenddyAgent } from '@senddy/node';
const agent = createSenddyAgent({
seed: mySecretSeed, // Uint8Array, from your secret store
apiKey: process.env.SENDDY_API_KEY!,
});
await agent.init();
console.log('Receive at', agent.getReceiveAddress());
console.log('Balance', await agent.getBalance());The defaults point at Base. For Robinhood Chain, pass chainId, rpcUrl, pool, usdc (the USDG address), subgraphUrl and apiUrl from Choose a chain.
The seed is the agent's money. Anyone with it can spend the balance. Keep it in a secrets manager, never in code or logs.
Fund it#
An agent doesn't deposit from a wallet. Fund it with a private transfer from a funded Senddy balance, such as your treasury or the Senddy app:
await treasury.transfer(agent.getReceiveAddress(), toUSDC('500'));Pay#
import { toUSDC } from '@senddy/node';
await agent.sync();
await agent.transfer('senddy1…', toUSDC('12.00'), { memo: 'Invoice 1042' });Everything from Accept and send private payments works here: prepareTransfer for a check step, withdraw to pay a public address, and on('balanceChange') to react to incoming money.
Patterns that work#
- Payouts. A worker reads a queue of payouts and sends each one privately. Recipients' amounts and identities stay off the ledger.
- Pay-per-use. An AI agent pays for an API call or a dataset from its own balance, with a memo naming the job.
- Treasury. A service holds operating funds privately, so competitors can't read its balance or its suppliers.
Limits to know#
- Agents keep notes in memory. Restarting is fine:
init()resyncs from the chain. - Use one agent per seed. Two processes spending from the same seed at once will race for the same notes.
- Rate limits apply per API key. If an agent needs more, ask us.