Internal Game Ledgers and Bitcoin Settlement
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Ledger model
Keep an append-only journal with operation ID, account, asset, signed amount and timestamp. Each posting group balances to zero within one asset. Separate player available funds, reserved funds, operator revenue and clearing accounts. A purchase is a ledger transfer, not an on-chain transaction. If the game uses nonredeemable points, do not silently treat them as satoshi liabilities.
Conceptual SQL posting
BEGIN;
-- Lock affected accounts in a consistent order.
-- Validate available balance and unique operation ID.
INSERT INTO journal (operation_id, account_id, delta_sat)
VALUES ('purchase-42', 'player-7', -500),
('purchase-42', 'operator-revenue', 500);
-- Update materialized balances and inventory in the same transaction.
COMMIT;This is illustrative SQL, not a complete schema. A separate operation table with a unique operation ID prevents duplicate posting groups; individual journal lines require their own keys. Enforce nonnegative available balances with transaction isolation or conditional updates. Check integer overflow and ensure that all posting groups balance before commit.
Settlement and reconciliation
A confirmed external deposit may debit a clearing asset account and credit a player liability account under a consistent accounting convention. Keep transaction ID and output index as evidence; enforce unique allocation across invoices. Reorganizations require compensating entries, not deletion of historical records. A withdrawal is reserved first and finalized only when its settlement outcome is known. Compare operator assets with redeemable liabilities, reserved funds and pending settlements; a wallet balance alone cannot establish solvency.
Acceptance plan
Run concurrent purchases against the same balance and verify that at most the affordable number succeeds. Replay the same operation ID after a simulated crash. Test duplicate deposit evidence and reorganization adjustments. Rebuild balances from journal entries and compare with materialized balances. Later reconcile a controlled Testnet deposit and withdrawal, recording actual output and fees separately.
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-deposit-withdrawal
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
