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 Codex Recover Funds After a Failed Atomic Swap?

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

Yes, in the controlled counterparty-abort case. Codex funded fresh contracts and withheld the secret deliberately. The claim branches were not exercised in this round. Recovery depended on the refund authorization and timeout conditions of each contract, not on reversing a confirmed transaction.

How was recovery verified?

An early Sepolia refund simulation was rejected. After the deadline, the successful refund returned 100 WABLAB to the funder, leaving zero in escrow. Bitcoin used a block-height lock of 5,374,091. The signed refund was held until eligible for broadcast and confirmed at height 5,374,094.

JSON · 6 lines
1{
2  "confirmed": true,
3  "block_height": 5374094,
4  "block_hash": "0000000000a503a8efa5538f7b9680be6c7fef0afa96dff1912cb721ecb72618",
5  "block_time": 1795889639
6}

WAB then matched an unreserved 8,500 sat SegWit output and reported 107,937 confirmed and spendable sat. This establishes wallet reconciliation in addition to the recorded blockchain confirmation.

JSON · 13 lines
1{
2  "status": "fresh",
3  "scan_height": 5374094,
4  "confirmed_sat": 107937,
5  "spendable_sat": 107937,
6  "matches": [
7    {
8      "vout": 0,
9      "value_sat": 8500,
10      "reserved": false
11    }
12  ]
13}

Does recovery return every original satoshi?

No. The refund output was 8,500 sat, not the original 10,000 sat SEND request used in the earlier claim experiment. Funding and spending costs must be accounted for separately. Refund eligibility also does not guarantee immediate inclusion: the network must accept and confirm the transaction.

This test did not cover every possible failure. A leaked secret, conflicting spends, unavailable signing keys or an adversarial counterparty may require different handling. A reliable adapter should preserve refund information and monitor confirmation without assuming that a timer alone proves recovery.

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