Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Stabletrust for Private Agentic Finance

Private payments for AI agents. One key. Zero traces.

Stabletrust enables AI agents to transact privately on EVM chains - shield tokens, transfer confidentially, withdraw silently. Balances are encrypted on-chain. No one can see what your agent holds or where it sends.

Built for the private agent economy.


Quickstart

No SDK. No setup. Just POST.

// Shield tokens into a confidential accountawaitfetch("https://stabletrust-api.fairblock.network/deposit",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,tokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",// USDCamount: "10000000",// 10 USDCchainId: 84532,// Base Sepolia}),});

That's it. Your agent now has a private balance no one can read.


Agent Flow

EOA → [account/create] → Confidential Account → [deposit] → shielded balance
→ [transfer] → Recipient
Recipient → [apply] → spendable → [withdraw] → EOA
  1. Create account - provision a confidential account (idempotent). Required before an account can receive a transfer.
  2. Deposit - shield ERC-20 tokens. Balance becomes encrypted on-chain.
  3. Transfer - send privately to any address. Amount is invisible on-chain.
  4. Apply - a recipient applies received funds, moving them from pending to available so they can be spent or withdrawn.
  5. Withdraw - unshield back to public ERC-20 at any time.
  6. Balance - check any account's decrypted balance. Read-only - sends no transaction.

API

POST /account/create

Provision your confidential account (idempotent). Required before an account can receive a transfer.

constres=awaitfetch("https://stabletrust-api.fairblock.network/account/create",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,chainId: 84532,}),});const{ address, created }=awaitres.json();// { success: true, address: '0x...', created: true } // created:false if it already existed

POST /deposit

constres=awaitfetch("https://stabletrust-api.fairblock.network/deposit",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,tokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",amount: "10000000",chainId: 84532,}),});const{ receipt }=awaitres.json();// { hash: '0x...' }

POST /balance

Read-only - decrypts and returns the balance without sending any transaction. Returns exists: false with zero balances if the account hasn't been created yet.

constres=awaitfetch("https://stabletrust-api.fairblock.network/balance",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,tokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",chainId: 84532,}),});const{ exists, balance }=awaitres.json();// { exists: true, balance: { total: '10000000', available: '10000000', pending: '0' }}

POST /transfer

constres=awaitfetch("https://stabletrust-api.fairblock.network/transfer",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,recipientAddress: "0x...recipient",tokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",amount: "5000000",// 5 USDCchainId: 84532,}),});const{ receipt }=awaitres.json();// { hash: '0x...' }

POST /apply

Apply received funds - moves a recipient's balance from pending to available so it can be spent or withdrawn.

constres=awaitfetch("https://stabletrust-api.fairblock.network/apply",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,chainId: 84532,}),});const{ tx }=awaitres.json();// { success: true, message: 'Pending balance applied', tx: '0x...' }

POST /withdraw

constres=awaitfetch("https://stabletrust-api.fairblock.network/withdraw",{method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({privateKey: process.env.AGENT_KEY,tokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",amount: "5000000",chainId: 84532,}),});const{ receipt }=awaitres.json();// { hash: '0x...' }

Parameters

/deposit

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key
tokenAddressstringyesERC-20 token contract address
amountstringyesAmount in token base units
chainIdnumberyesTarget network chain ID
waitForFinalizationbooleannoWait for tx finality (default: true)

/balance

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key (used for decryption)
tokenAddressstringyesERC-20 token contract address
chainIdnumberyesTarget network chain ID
addressstringnoAddress to query - defaults to wallet from privateKey

/transfer

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key
recipientAddressstringyesRecipient Ethereum address
tokenAddressstringyesERC-20 token contract address
amountstringyesAmount in token base units
chainIdnumberyesTarget network chain ID
useOffchainVerifybooleannoOff-chain proof verification (default: false)
waitForFinalizationbooleannoWait for tx finality (default: true)

/withdraw

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key
tokenAddressstringyesERC-20 token contract address
amountstringyesAmount in token base units
chainIdnumberyesTarget network chain ID
useOffchainVerifybooleannoOff-chain proof verification (default: false)
waitForFinalizationbooleannoWait for tx finality (default: true)

/account/create

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key
chainIdnumberyesTarget network chain ID
waitForFinalizationbooleannoWait for account finality (default: true)

/apply

FieldTypeRequiredDescription
privateKeystringyesAgent wallet private key
chainIdnumberyesTarget network chain ID
waitForFinalizationbooleannoWait for tx finality (default: true)

Supported Chains

ChainID
Base8453
Base Sepolia84532
Ethereum Sepolia11155111
Arbitrum Sepolia421614
Arc5042002
Stable2201
Tempo42431

stablepay-api

About

Private on-chain payments for AI agents. Encrypted balances, untraceable transfers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages