Binding Bitcoin Agent Approval to an Exact Payment Intent
Binding Bitcoin Agent Approval to an Exact Payment Intent
Prevent an approved proposal from being substituted before execution.
Design and trust boundary
The approval record must originate in trusted storage, not in model output. Validate the complete intent schema and destination before fingerprinting; the fixture uses a synthetic destination. Include the wallet, network, exact destination, total amount and unique request identifier. In production bind fee-law identity and approval scope where required, consume approvals atomically with budget reservation, and retain execution evidence. This comparison is not an approval issuer or a SEND implementation.
Independent reference implementation
1# SPDX-License-Identifier: 0BSD
2import hashlib, json, hmac
3
4def fingerprint(intent):
5 return hashlib.sha256(b'approved-intent-v1\x00'+json.dumps(intent,sort_keys=True,separators=(',',':'),ensure_ascii=True,allow_nan=False).encode()).hexdigest()
6
7def matches(record,intent,now):
8 return (record['agent']==intent['agent'] and now < record['expires'] and hmac.compare_digest(record['digest'],fingerprint(intent)))
9
10p=dict(agent='buyer',wallet='demo',net='test',to='synthetic',amount_sat=1000,request_id='r1')
11r=dict(agent='buyer',expires=110,digest=fingerprint(p))
12assert matches(r,p,100)
13assert not matches(r,dict(p,amount_sat=1001),100)
14assert not matches(r,p,110)Validation and limitations
Run the example with Python 3. Assertions use synthetic fixtures and do not contact a wallet or agent service. This is a proposed application-level pattern, not an established interoperability standard. Keep BTC KEY outside agent messages. The WAB Engine API and signed fee law remain unchanged.
Related research
https://thamer.org/learn/bitcoin-for-ai-agents-open-integration-guide
https://thamer.org/api
