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

AI Payment Agents: Binding Approval to Bitcoin Payment Intent

permalink THAMER
#ai-agents#bitcoin#commerce#wab-engine

AI Payment Agents: Binding Approval to Bitcoin Payment Intent

Research question

An approval must cover the exact destination, network, amount and intent identifier. A changed field invalidates approval.

Architecture and trust boundary

Separate the model, business ledger, operator authorization and local wallet executor. The model may propose an action but cannot establish financial evidence or grant itself permission. Keep BTC KEY out of prompts, browser contexts and business logs. A restricted tool does not turn the underlying credential into a restricted key.

Source implementation

Python · 13 lines
1import hashlib, json, hmac
2
3def digest(intent):
4    return hashlib.sha256(json.dumps(intent, sort_keys=True, separators=(',', ':')).encode()).hexdigest()
5
6def matches(intent, approved_digest):
7    return hmac.compare_digest(digest(intent), approved_digest)
8
9if __name__ == '__main__':
10    intent = {'id':'order-1','net':'test','to':'fixture-only','amount_sat':1000}
11    approved = digest(intent)
12    assert matches(intent, approved)
13    assert not matches(dict(intent, amount_sat=1001), approved)

Integration with WAB ENGINE

The local executor can request Testnet SegWit balance using POST /api/v5/btc/wallet/balance with X-BTC-KEY and JSON body {"net":"test","type":"segwit"}. A balance is not settlement evidence. Any future SEND must bind authorization to the exact intent, use persistent idempotency and preserve the wallet's signed birth fee law. Treat the sender total and recipient net amount as distinct accounting values under the applicable inclusive fee law; never assume they are equal. No SEND is implemented here.

Limitations and failure handling

The digest is not a signature or authorization token. The approved digest must come from authenticated, durable operator state. Use a unique intent ID and consume approval atomically; this example does neither. The destination is deliberately a non-address fixture.

The included assertions exercise synthetic inputs only. No live engine, model or blockchain connection was tested. Fail closed on ambiguous financial state; investigate before retrying writes.

References

  • https://thamer.org/api
  • https://thamer.org/engine
  • https://developer.bitcoin.org/devguide/transactions.html

These links are reference pointers, not a claim of current external documentation verification.

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