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

Programmable Bitcoin Orders: Explicit State Transitions

permalink THAMER
#ai-agents#bitcoin#commerce#python

Programmable Bitcoin Orders: Explicit State Transitions

Separate order acceptance, payment verification and fulfillment.

Design and trust boundary

A paid order cannot be cancelled as if no funds arrived. A refund is a separate workflow. Persist transitions with compare-and-swap in production; this example only models the transition graph.

Independent reference implementation

Python · 16 lines
1def advance(state, event):
2    transitions = {('open','accept'):'awaiting_payment',
3                   ('awaiting_payment','verified_payment'):'paid',
4                   ('paid','fulfill'):'fulfilled',
5                   ('open','cancel'):'cancelled'}
6    if (state,event) not in transitions:
7        raise ValueError('invalid transition')
8    return transitions[state,event]
9
10assert advance('paid','fulfill') == 'fulfilled'
11try:
12    advance('paid','cancel')
13except ValueError:
14    pass
15else:
16    raise AssertionError('paid order cancelled')

Operational boundaries

Run with Python 3. Assertions use synthetic data only. No wallet credentials, SEND or live API calls are included. Preserve the WAB Engine API and immutable signed fee law. Amounts are integer satoshis. Production use requires authenticated inputs, durable state and independent authorization. This is a proposed application pattern, not a production financial system.

Related research

https://thamer.org/learn/bitcoin-for-ai-agents-open-integration-guide

https://thamer.org/api

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