Agents use the same
@fairblock/stabletrust SDK as any other integration, driven from a server or agent runtime. See Building an App with the SDK for the full walkthrough and the Method Reference for every method signature.What you can build
- Agent-to-agent payments where amounts and balances stay encrypted between the two agents
- x402 payments with confidential transfers: fast, confidential micro-payments for subscriptions, APIs, or AI agents
Using the SDK
An agent transacts with theConfidentialTransferClient using an ethers.Wallet. The end-to-end confidential flow is:
Hiding the agent’s address
A standard confidential transfer keeps amounts and balances encrypted, but the sender’s wallet address remains visible onchain. To hide the agent’s address as well, use theAnonymousTransferClient, which routes transfers through the Fairycloak relay so only a numeric account ID appears onchain. See Anonymous Transfers.
Security considerations
- Private key management: never expose or log private keys; store them securely (e.g. hardware wallets, encrypted vaults). Derived account
privateKeyvalues are equally sensitive. - Account initialization: always call
ensureAccount()before any operation, and verify that recipient accounts exist before transferring funds. - Balance verification: check available balance before initiating transfers.
- Error handling: implement retry logic for transient network failures.
Next steps
Build an App with the SDK
The full SDK walkthrough this guide builds on.
Method Reference
Every client method, parameter, and return type.
Anonymous Transfers
Hide the agent’s address as well as the amount.
Common Errors
Failure modes and how to handle them.