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

Build a Testnet Bitcoin Agent in Go: First Working Architecture

permalink THAMER
#bitcoin-ai-agents#golang#learn#testnet#wab-engine

A small Go HTTP router can translate commands into Engine API requests. This article is part of an experimental series about building Go-based AI agent interfaces on top of WAB ENGINE. The experiments separate wallet execution from model-generated language; they do not establish a production SDK.

The engineering problem

Create one POST /v1/chat endpoint with JSON input and output. A chatbot is useful for explaining intent and presenting results, but a probabilistic response must not become the authority for a payment. The execution boundary should be a small, reviewable Go function with explicit inputs, errors and structured output.

Implementation approach

Parse command, validate it, call a mock Engine, and return structured result plus optional explanation. Begin with a mock service and a recorded JSON fixture. Validate network and amount independently of the model. For wallet calls, record the outgoing operation, correlate it with a request ID and preserve the complete Engine response for the caller. If the optional model fails, return the trusted result with a native explanation.

A minimal conceptual flow is:

POST /v1/chat -> deterministic command parser -> authenticated Engine client
                                               -> structured JSON result
                                               -> native reply -> optional AI wording

This is an architectural example, not a claim that every route or field is supported by every deployed Engine release. Verify the current API contract at https://thamer.org/api.

A concrete Testnet exercise

Try the mock HTTP client in Repo/engine_client.go. For a SEND-related experiment, use a saved response rather than broadcasting another transaction. One observed Testnet result allocated requested_sat=10000 and recipient_sat=9000 under that wallet's signed inclusive fee law. That is a wallet-specific policy, not the default behavior of Bitcoin or of other wallets.

Failure modes and boundaries

Use httptest before contacting any wallet; avoid real sends during development. Distinguish compilation from runtime startup, Engine acceptance from blockchain confirmation, and AI availability from payment success. Never infer a transaction confirmation from ok: true alone. In particular, a reply_source: native response may indicate a model fallback while the Engine transaction has already been accepted.

How to verify the experiment

  1. Run the parser and formatter unit tests before connecting to a real node.
  1. Confirm the exact service version and listening port; Docker images may build successfully while containers fail to start.
  1. Feed known Engine JSON into the reply layer and assert that satoshi amounts, addresses and txids are unchanged.
  1. If using Testnet, inspect the returned txid separately through the deployed status API. Do not repeat SEND merely to troubleshoot the chatbot.

What this experiment does not prove

The examples do not prove production-grade authorization, independent multi-wallet isolation, guaranteed confirmations, safe custody, or a fully supported SDK. They are educational patterns for a self-hosted Bitcoin agent layer. Production deployment requires additional security, reliability and operational validation.

WAB ENGINE developer resources

  • API reference: https://thamer.org/api
  • Engine overview: https://thamer.org/engine
  • Code repository index: https://thamer.org/repo/

Scope: This article documents experimental Testnet SDK patterns and prototypes, not production-ready payment software. Endpoint names and JSON contracts must be checked against the deployed Engine version before use. No example grants an AI model authority to sign or broadcast a transaction.

Code: https://thamer.org/repo/ (files Repo/engine_client.go and Repo/engine_client_test.go).

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