Designing Bitcoin Deposit and Withdrawal Interfaces for Games
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Deposit workflow
Create an application deposit intent with player, network, amount and expiry. Use the documented WATCH interface where suitable, storing its returned identifiers and address. Observe payment evidence and apply the application's confirmation policy. An expired intent may still receive Bitcoin; route late payments to reconciliation instead of silently discarding them. Never credit a player solely because a client supplies a transaction ID.
Withdrawal workflow
Authenticate the player, validate destination and network, disclose fee treatment and reserve the requested debit atomically. Persist a stable engine request ID before dispatch. A timeout after dispatch is an unknown outcome, not permission to send again under a new ID. Reconcile with documented engine evidence and retry only when the actual idempotency contract permits it.
Conceptual Python state transition
def dispatch_withdrawal(record, engine):
if record.state != "reserved":
raise ValueError("not ready")
persist_dispatching(record.id, record.request_id)
try:
result = engine.send_intent(record)
except TimeoutError:
mark_unknown(record.id)
return
persist_engine_result(record.id, result)All helpers and send_intent are proposed adapters. Persisting dispatch state does not by itself make external execution atomic. Use a single claimed worker per intent, durable recovery and documented response interpretation. Do not release reservations on ambiguous errors. Track requested debit, actual recipient output, miner fee and software fee according to available evidence; do not assume they are interchangeable.
Acceptance plan
Simulate late deposits, duplicate observations, partial payments, invalid destinations, insufficient liquidity and a crash after dispatch. Later run a small Testnet transfer between isolated wallets and compare WATCH and TX STATUS observations with the ledger. No real-money withdrawal or engine modification is required for the theoretical design.
Primary reference
https://thamer.org/api
Related reading
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-payment-reconciliation
https://thamer.org/docs/wab-sdk-immutable-fee-policy
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-mobile-secure-backend
https://thamer.org/docs/wab-sdk-game-economy-design
https://thamer.org/docs/wab-sdk-game-internal-ledgers
https://thamer.org/docs/wab-sdk-unity-bitcoin-architecture
https://thamer.org/docs/wab-sdk-unreal-bitcoin-architecture
https://thamer.org/docs/wab-sdk-game-rewards-digital-purchases
