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

Idempotency and Ambiguous Bitcoin Payment Outcomes

permalink THAMER
#ai-agents#bitcoin#software-architecture#wab-engine

Research scope

This is Stage 01, study 05, of Bitcoin for AI Agents. It is an educational reference design, not a live-tested integration or production SDK. The WAB Engine remains independent; wallet creation belongs to the Factory.

Architecture and rationale

A payment intent needs its own unique identifier. Two legitimate payments with identical amounts and destinations are not the same intent. Retries of one intent must retain its original idempotency key.

Reference implementation

This Python example creates an intent record before any network request. Persist the complete immutable record before execution; the example does not implement a database or retry transport.

Python · 16 lines
1from dataclasses import dataclass
2from uuid import uuid4
3
4
5@dataclass(frozen=True)
6class PaymentIntent:
7    intent_id: str
8    wallet: str
9    destination: str
10    total_debit_sat: int
11
12
13def new_intent(wallet: str, destination: str, total: int) -> PaymentIntent:
14    if type(total) is not int or total <= 0:
15        raise ValueError("invalid total debit")
16    return PaymentIntent(str(uuid4()), wallet, destination, total)

Security and limitations

A timeout after submission is an ambiguous outcome, not proof of failure. Reconcile using the engine contract and known transaction identifiers. Do not create a fresh key or blindly resend after an uncertain outcome.

Applying the pattern

Keep the model-facing interface separate from trusted execution. Review the current engine API before mapping fields or response data. Use a dedicated test wallet and explicit network configuration for any future live evaluation. The example does not change the engine, its signed fee law, or Bitcoin Core.

References and source

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