Unity Bitcoin SDK Architecture
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Client boundary
A Unity package should expose player-facing economy operations through the game backend, not direct access to the operator wallet. The backend owns catalog prices, inventory, balances and settlement authorization. A Unity scene or local save file is not an authoritative financial record. Store only scoped session credentials on the client and never bundle BTC KEY in assets, scripts or build configuration.
Conceptual C# interface
public interface IGameEconomy {
Task<PurchaseReceipt> PurchaseAsync(
string itemId, string operationId, CancellationToken ct);
Task<DepositView> GetDepositAsync(
string depositId, CancellationToken ct);
}The proposed DTOs contain player-visible status and integer amounts. Implement transport separately from MonoBehaviour and UI rendering. Generate and persist an operation ID before a purchase, reuse it for the same intent and query the backend after an interrupted request. Cancellation stops waiting locally; it does not undo a committed purchase. Marshal UI updates to the appropriate Unity thread and avoid blocking the frame loop.
Integration boundaries
The package can provide a test transport, JSON serialization and typed errors. It must not trust local inventory edits, arbitrary client prices or a claimed payment confirmation. Server-side authorization applies even if a player modifies the client. Use authenticated HTTPS and avoid logging session tokens. Platform distribution and digital goods payment policies require separate review; the SDK does not bypass them.
Acceptance plan
Use a mock backend for scene changes, duplicate clicks, application suspension and lost responses. Verify that one purchase grants one item even after reconnection. Test serialization and integer ranges on supported Unity targets. Later connect a staging backend to WAB Testnet and verify a deposit through the same backend contract. No Unity package or compiled game is claimed 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-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-game-deposit-withdrawal
https://thamer.org/docs/wab-sdk-unreal-bitcoin-architecture
https://thamer.org/docs/wab-sdk-game-rewards-digital-purchases
