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

Swift SDK Architecture for Bitcoin Payments

permalink THAMER
#application-development#bitcoin#sdk#wab

Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.

Module design

Separate WABTransport, WalletModels and PaymentCoordinator into testable modules. A transport adapter handles URLSession, HTTP status and decoding; the coordinator handles application intent and recovery. A merchant-facing Swift package should call an authenticated application backend, not distribute the merchant BTC KEY. A personal-wallet deployment requires an explicit credential custody design, potentially using Keychain with an appropriate access policy.

Conceptual Swift interface

struct PaymentIntent: Codable, Sendable {
    let requestID: String
    let amountSat: Int64
    let address: String
    let network: String
}
protocol PaymentGateway: Sendable {
    func submit(_ intent: PaymentIntent) async throws -> PaymentOutcome
    func lookup(_ requestID: String) async throws -> PaymentOutcome
}

PaymentOutcome and lookup are proposed application abstractions, not native API contracts. The backend persists the request identifier and maps the intent to the documented SEND request only after authorization. Validate positive amounts, supported networks and address compatibility before execution. Decode the engine envelope and distinguish an explicit rejection from a transport failure. A cancelled Swift task does not cancel an already submitted Bitcoin transaction.

Concurrency and recovery

An actor can serialize local coordinator state but cannot enforce uniqueness across devices or backend replicas. Durable server-side intent records are necessary for that boundary. Keep pending identifiers across app launches. Do not log headers or raw credential-bearing responses. Present unknown outcomes explicitly rather than offering a new send button that creates another request identifier.

Acceptance plan

Use injected URLSession transport or URLProtocol fixtures to test malformed JSON, HTTP failures, application errors and cancellation. Run Swift package unit tests on a supported toolchain; iOS simulator and device integration require macOS and Xcode. Verify a testnet transfer through the engine before claiming compatibility. No Swift package or iOS build is supplied here.

Primary reference

https://thamer.org/api

Related reading

https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-authentication-credential-management
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-payment-reconciliation
https://thamer.org/docs/wab-sdk-mobile-bitcoin-architecture
https://thamer.org/docs/wab-sdk-kotlin-bitcoin-applications
https://thamer.org/docs/wab-sdk-flutter-cross-platform
https://thamer.org/docs/wab-sdk-mobile-secure-backend
https://thamer.org/docs/wab-sdk-desktop-applications

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