THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

How to Build a Bitcoin Payment Request Workflow for AI Agents

permalink THAMER
#ai-agents#bitcoin#learn#wallet-ai-bitcoin

Treat each payment request as a durable business object with an invoice ID, amount in integer sats, network, expiration, and destination. This is a developer design pattern, not a claim that a ready-made AI-agent integration or SDK ships with the engine.

Architecture

A safe arrangement is: AI agent → authenticated application tool → deterministic authorization and policy service → WAB Engine HTTP JSON API → Bitcoin Core. The separate Factory handles wallet birth; the engine restores and operates wallets. The application owns business rules, user permissions, order records, and agent limits.

Implementation plan

Create an order in the application database, request a fresh receive address through the engine, present the address and amount, then reconcile observed transactions against the order.

  1. Define a typed input schema with explicit integer satoshis, wallet/network identifier, business reference, and requested action.
  1. Authenticate the caller and verify the operation is allowed for this particular agent and task.
  1. Validate amounts, address/network compatibility, and destination against trusted records; do not treat model-generated text as authority.
  1. Persist the business operation and its state before any irreversible payment action.
  1. For SEND, use the engine's documented idempotency mechanism and reconcile ambiguous results before retrying.
  1. Observe the actual transaction state, apply a written confirmation policy, and update the application ledger once.
  1. Test failure and recovery paths before mainnet use.

Pseudocode: policy before payment

request = parse_typed_agent_request()
assert authenticated(request.actor)
assert permitted(request.actor, request.operation)
assert request.amount_sat is a positive integer
assert network_and_destination_valid(request)
reservation = atomic_budget_reserve(request)
if reservation denied: reject
if requires_human_approval(request): await approval
result = trusted_backend_call_to_existing_engine_contract(request)
reconcile_result_and_reservation(result)

This is pseudocode, not a copy-paste WAB endpoint or a statement that every policy function exists today.

Wallet fee implications

For wallets governed by the documented signed 10% inclusive SEND law, the recipient receives 90% of the sender total; miner fee comes first from the remaining 10% and software fee receives the rest. An unaffordable miner fee or dust output causes failure rather than an additional charge. An agent spending budget should account for the sender total, not only the recipient amount.

Failure modes and verification

A displayed QR code is not proof of payment; the application must independently verify transaction state. Test duplicate callbacks, reorgs, wrong-chain addresses, pending payments, unavailable Bitcoin Core, and conflicting agent requests. Keep credentials outside the LLM and clients. No external spending cap is effective if the agent can bypass it with direct engine access.

Scope

The existing engine is CURL POST/JSON-first and uses Bitcoin Core-backed on-chain operations. Do not assume Lightning, L402, a native WATCH endpoint, OpenAPI publication, or a released WAB CLI policy module without separate implementation evidence.

Further reading

Related LEARN: How to Design a Bitcoin Payment Verification Service
https://thamer.org/learn/bitcoin-payment-verification-service-design

Related ASK: Can an AI Agent Use WALLET AI BITCOIN?
https://thamer.org/ask/can-ai-agent-use-wallet-ai-bitcoin

Related BLOG: WALLET AI BITCOIN and the Emerging Agentic Economy
https://thamer.org/blog/wallet-ai-bitcoin-agentic-economy

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects