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

Can an AI Agent Build a Bitcoin HTLC Contract?

permalink THAMER
#ai-agents#bitcoin#chatgpt#codex#engineering#wab

Yes. The laboratory used an external Go tool to construct and test a Bitcoin hash time-locked contract (HTLC). The design combines a hashlock for the claim branch and a block-height timelock for the refund branch. WAB can fund a compatible contract address while the external tool handles the specialized spending conditions.

What does the contract enforce?

The claim branch requires a matching secret and the appropriate signature. The refund branch requires the refund key and a transaction satisfying the locktime condition. A matching secret alone does not authorize spending without the required signature.

The initial laboratory script tests accepted the intended claim and rejected incorrect keys and secrets. Refund validation rejected a transaction below the required locktime and accepted one set to the required height. These were script-level checks, not proof that a refund had already confirmed on the public network.

Why separate the adapter?

The engine retains its wallet identity, fee law and normal payment operations. A contract adapter constructs the script and the specialized spending transaction. A developer must distinguish the requested SEND amount from the actual contract output and account for the redemption fee separately.

The first live Bitcoin round and later Sepolia experiments are documented separately. The initial script proof should not be confused with the later confirmed claim and refund evidence. Production use would require independent review of script construction, timeout coordination, confirmation policy and recovery behavior.

Primary lab references

https://thamer.org/api

https://thamer.org/ask/wab-testnet3-htlc-proof

https://thamer.org/ask/wab-testnet3-sepolia-settlement

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