Bitcoin Agent Payment Intent Integrity
Bitcoin Agent Payment Intent Integrity
Design and trust boundary
Bind the exact wallet, network, destination, amount and request identifier to an approval digest. Do not normalize a destination after approval. A digest alone does not authenticate approval; store it in a trusted authorization record. The sample does not validate Bitcoin addresses or send transactions.
Independent reference implementation
1import hashlib
2import json
3
4def digest(wallet, net, destination, amount_sat, request_id):
5 if net not in ('main', 'test') or type(amount_sat) is not int or amount_sat <= 0:
6 raise ValueError('invalid intent')
7 if not all(type(x) is str and x for x in (wallet, destination, request_id)):
8 raise ValueError('missing identity')
9 return hashlib.sha256(json.dumps(['payment/v1', wallet, net, destination, amount_sat, request_id], separators=(',', ':')).encode()).hexdigest()
10
11if __name__ == '__main__':
12 a = digest('wallet-A', 'test', 'fixture', 1000, 'req-1')
13 assert a != digest('wallet-A', 'main', 'fixture', 1000, 'req-1')
14 assert a != digest('wallet-A', 'test', 'fixture', 1001, 'req-1')
15 assert a != digest('wallet-A', 'test', 'fixture', 1000, 'req-2')Operational boundaries
This offline research example uses synthetic data. It does not execute SEND or modify the wallet birth fee law. A production deployment requires authenticated callers, durable state, tested failure handling and independent security review.
Related research
https://thamer.org/learn/bitcoin-for-ai-agents-open-integration-guide
https://thamer.org/api
