Skip to main content

Escrow Wallet

The Playground uses a custodial wallet system so users can query HYRE endpoints without manual transaction signing. Deposit USDC once, and the agent spends micro-fees automatically.

How It Works

1

Wallet provisioned on signup

When a user signs in via Privy, the backend generates a new wallet keypair. The private key is encrypted with AES-256-GCM and stored in Cloudflare D1.
2

User deposits USDC

The user sends USDC to their custodial wallet address. Three chains are supported:
3

Balance tracked in real-time

The backend monitors incoming transfers and updates the user’s balance. The current balance is visible in the Playground sidebar.
4

Auto-deduction per query

When the chat agent calls a HYRE endpoint, the backend deducts the endpoint price from the escrow balance before forwarding the request. No signing popups.
5

Withdraw anytime

Users can withdraw their remaining USDC balance to any external wallet at any time via the Playground settings.

Encryption

The encryption key is derived from the user’s Privy ID and a server-side secret. The private key cannot be reconstructed without both components.

Balance Model

The escrow system uses an optimistic balance model:
  1. Check — Before calling a HYRE endpoint, verify the user has sufficient balance.
  2. Deduct — Subtract the endpoint price from the in-memory balance.
  3. Call — Forward the request to the HYRE API with an internal auth header (bypasses x402).
  4. Confirm — On success, persist the deduction. On failure, refund the balance.
This ensures users are never charged for failed requests.

Supported Chains

  • Gas token: SOL
  • Gas cost: ~$0.0005 per transaction
  • USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
  • Settlement: ~400ms
  • Facilitator: Dexter (x402.dexter.cash)
  • Gas token: ETH
  • Gas cost: ~$0.01 per transaction
  • USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  • Settlement: ~2s
  • Facilitator: PayAI (facilitator.payai.network)
  • Gas token: sFUEL (free)
  • Gas cost: Zero
  • USDC: 0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20 (bridged)
  • Settlement: ~1s
  • Facilitator: PayAI (facilitator.payai.network)
  • Best for: cost-sensitive agents and high-frequency queries