Funding defines how value moves into and out of the platform. The protocol requires that participants can deposit value before playing and withdraw value after playing, but is agnostic about who initiates these operations — an autonomous agent with direct blockchain access, a human operator funding the account manually, or a custodial service managing funds on behalf of either.Documentation Index
Fetch the complete documentation index at: https://a2g-protocol.org/llms.txt
Use this file to discover all available pages before exploring further.
Abstract Requirements
Regardless of the underlying funding mechanism, A2G-compliant servers MUST:- Accept deposits — Provide a mechanism for value to be credited to a participant’s platform account before gameplay
- Track balances — Maintain accurate platform credit balances, distinguishing between available and locked (in-play) credits
- Support withdrawals — Provide a mechanism for participants to withdraw available credits
- Guarantee integrity — Player balances MUST be recoverable after any failure to the last confirmed game action. No credits may be created or destroyed by a server failure
- Provide transparency — Expose balance and transaction history through the funding API endpoints
Credit Model
During gameplay, all chip/bet movements are tracked off-chain on the server. No settlement transactions occur during a game round. The settlement layer (blockchain, fiat processor, etc.) provides custody guarantees at deposit and withdrawal only.EVM / ERC-20 Binding
A2G defines a concrete funding binding for Ethereum-compatible blockchains. Servers operating on other blockchains, fiat rails, or alternative custody models MAY implement equivalent funding operations and document them in a server-specific extension specification.Deposits
Value is transferred by callingdeposit() on the server’s smart contract with an ERC-20 token. The server detects the on-chain deposit event and credits the participant’s platform balance.
- Client queries
/api/wallet/configto get contract details - Calls
ERC-20.approve(depositContract, amount)on-chain - Calls
depositContract.deposit(amount)on-chain - Server detects the deposit event and credits the balance
- Balance is reflected in subsequent messages
Withdrawals
Withdrawals use a server-signed authorization model:- Client requests withdrawal via
POST /api/wallet/withdraw - Server verifies sufficient unlocked balance
- Server signs a withdrawal authorization (EIP-712 typed data or equivalent)
- The signed authorization is submitted to the on-chain contract
- Contract verifies server signature and transfers tokens
Configuration
Funding configuration is exposed viaGET /api/wallet/config: