#002

September 12, 2025:- Smart Contract Skeleton and Game Engine Planning Initiated


Purpose

To begin translating design into smart contract logic and backend service scaffolding for verifiable skill-based gaming.


Key Highlights

  • Smart contract skeleton deployed - MatchManager.sol with createMatch(), stakeMatch(), and submitResult() functions live on BSC Testnet

  • Backend Node.js service initiated - REST API framework with PostgreSQL integration for player data and match tracking

  • MVP test game Chess selected - Deterministic skill-based outcomes with clear win/loss/draw conditions

  • Dual-player signature logic prototyped - Using ecrecover() to validate both players signed identical match results

  • Database schema drafted - Player profiles, ELO ratings, match history, and transaction logs structure defined

  • Development workflow established - Git branching strategy, code review process, and automated testing pipeline


Why It Matters

  • Enables verifiable on-chain match settlement - Smart contracts can automatically distribute stakes based on cryptographically proven results

  • Uses player signatures to prevent fraud - Both players must agree on outcome before blockchain settlement occurs

  • Starts backend–contract communication - API layer bridges off-chain game logic with on-chain financial settlement

  • Establishes data persistence - Player progress, ratings, and match history stored for competitive integrity


Open Issues

  • Race conditions in match submission - Simultaneous result submissions from both players may cause conflicts

  • Incomplete signature salt/nonce structure - Replay attack prevention mechanism needs refinement

  • Game-state sync planning ongoing - Method for keeping both clients synchronized during gameplay undefined

  • Gas cost estimation pending - Settlement transaction costs may impact minimum viable stake amounts


Fixed

  • Contract deployment verified - All functions callable and events emitting correctly on BSC Testnet

  • Database connection stability - PostgreSQL connection pooling implemented to handle concurrent match creation


Next Steps

  • Implement full EIP-712 structured data signing - Replace basic signature scheme with standardized typed data format

  • Create basic match controller - Backend endpoint to handle match creation, player joining, and state management

  • UI wireframe draft for staking screen - Design user interface for stake amount selection and match confirmation

  • Contract security review - Engage external auditor for preliminary smart contract vulnerability assessment

Last updated

Was this helpful?