Designing a Bitcoin SDK Around the WAB Engine
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Architecture and scope
A WAB SDK is a client library, not a Bitcoin node or a replacement wallet implementation. Its job is to translate application intentions into the documented HTTP contract and return useful results without hiding uncertainty. Keep the engine as the execution authority. A developer should be able to swap an HTTP transport in tests without swapping the wallet implementation.
Separate configuration, transport, endpoint adapters and public methods. Configuration identifies the trusted engine and network. Transport owns deadlines, HTTP encoding and response size limits. Endpoint adapters know the wire format. Public methods expose language-appropriate types. Avoid a global client whose active wallet or network changes underneath concurrent callers.
Conceptual Python interface
from enum import Enum
class Network(str, Enum):
TEST = "test"
MAIN = "main"
class WalletClient:
def __init__(self, transport, network):
self.transport = transport
self.network = network
def receive(self, address_type):
return self.transport.post(
"/api/v5/btc/wallet/receive",
{"net": self.network.value, "type": address_type})The injected transport is responsible for authentication and decoding. This sketch is not an installed package. It does not implement the complete error contract or address validation. A production implementation must make those dependencies explicit.
Operation design
Separate informational calls from state-changing calls. Address allocation, watch registration, restoration and payment execution can change state even when they appear simple. Do not assume POST is unsafe in every case or that all POST requests are equally replayable. Model each operation individually. Keep factory access in a separate client so the engine URL cannot accidentally receive creation requests.
Failure boundaries
A timeout is an observation about communication, not proof that a requested operation failed. Preserve an unresolved outcome, and reconcile before repeating a state-changing operation. Never invent an address, transaction ID or balance as a fallback. Use explicit network configuration and prohibit live spending in ordinary unit tests.
Acceptance plan
Build transport fixtures for success, malformed JSON, application rejection and connection loss. Then compare SDK requests with the official CURL reference on a funded test wallet. Record redacted request metadata and actual response shapes; separate broadcast from confirmation. The SDK is only ready for release after its documented capabilities pass those checks.
Primary reference
https://thamer.org/api
Related reading in this stage
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-wallet-identity-management
https://thamer.org/docs/wab-sdk-cross-language-interfaces
https://thamer.org/docs/wab-sdk-typed-json-contracts
https://thamer.org/docs/wab-sdk-authentication-credential-management
