Bitcoin Agent Secure Communication and Audience Binding
Bitcoin Agent Secure Communication and Audience Binding
Design and trust boundary
Authenticate a message together with its intended audience and protocol domain. HMAC provides shared-secret authentication, not public-key signatures or confidentiality. Use TLS, independent keys and durable replay protection in production; this example intentionally demonstrates only audience binding.
Independent reference implementation
1import hashlib
2import hmac
3import json
4
5def tag(key, audience, message):
6 body = json.dumps(['bitcoin-agent/v1', audience, message], separators=(',', ':'), ensure_ascii=True).encode()
7 return hmac.new(key, body, hashlib.sha256).digest()
8
9def verify(key, audience, message, signature):
10 return hmac.compare_digest(tag(key, audience, message), signature)
11
12if __name__ == '__main__':
13 key = b'fixture-only'
14 sig = tag(key, 'agent-A', 'quote-1')
15 assert verify(key, 'agent-A', 'quote-1', sig)
16 assert not verify(key, 'agent-B', 'quote-1', sig)
17 assert not verify(key, 'agent-A', 'quote-2', sig)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
