Building Bitcoin Receive Address Interfaces
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Address allocation is an operation
A receive method obtains an address from the engine; it does not generate private keys or derive a substitute address locally. Keep network and address type explicit. SegWit and Taproot are separate choices, and a receiving service must verify that its payer supports the selected address format. An address alone is not a payment invoice or evidence of payment.
Proposed Go interface
type Scope struct { Net string; Type string }
type ReceiveResult struct { Address string }
type Receiver interface {
Receive(ctx context.Context, scope Scope) (ReceiveResult, error)
}The result is a proposed public model. The adapter maps it from the verified engine response, using POST /api/v5/btc/wallet/receive with net and type. Do not assume repeated calls return the same address or a new one until the contract and live behavior establish that property.
Validation and ownership
Validate Bech32 or Bech32m checksum, witness version and program length with a reviewed Bitcoin library. Prefix checks alone are insufficient. A valid address does not prove ownership by the expected wallet. Associate the returned address with the credential context and operation evidence. Testnet address encoding alone does not distinguish all test networks; the actual chain configuration must be verified separately.
Application boundaries
A merchant may store an order-to-address mapping and render a QR code. Those are application functions, not native wallet features. Never reuse an address merely because a previous request timed out. If allocation is uncertain, retain the unresolved operation and follow documented reconciliation behavior. Do not fabricate an address from cached data.
Acceptance plan
Test both address types on the configured test network, invalid scope, wrong credentials, malformed response and interrupted transport. Compare SDK requests with CURL fixtures and validate returned addresses independently. Use a dedicated funded test wallet to send a small authorized payment and verify the output; do not treat successful address allocation as proof of receipt. Mainnet spending remains outside this test.
Primary reference
https://thamer.org/api
Related reading in this series
https://thamer.org/docs/wab-sdk-designing-bitcoin-sdk
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
https://thamer.org/docs/wab-sdk-wallet-creation-restoration
https://thamer.org/docs/wab-sdk-balance-utxo-management
https://thamer.org/docs/wab-sdk-transaction-execution
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-wallet-recovery-local-lifecycle
