SPLFlip
  • SPLFlip
  • Backend Architecture
  • Frontend Architecture
  • Tokenomics
Powered by GitBook
On this page

Backend Architecture

System Overview

The backend of SPLFlip is built using Node.js and Express, with several key components handling game logic, transaction management, and WebSocket communications.

Core Components

  1. Game Management System

    • In-memory game storage using Maps

    • Separate storage for open, active, and completed games

    • Automatic game expiration handling

    • Transaction verification and processing

  2. Transaction Processing

    • Robust retry mechanism for failed transactions

    • Priority fee handling for faster confirmations

    • Balance verification before processing

    • Multi-token support with SPL token handling

  3. WebSocket Implementation

    • Real-time game updates

    • Player notifications

    • Connection management per user

    • Event-based communication

  4. Security Features

    • Transaction signature verification

    • Balance checks before game creation/joining

    • Duplicate transaction prevention

    • Error handling and recovery

Key Processes

  1. Game Creation Process

    • Validation of user input

    • Transaction verification

    • Game state initialization

    • Expiration timer setup

    • WebSocket notification dispatch

  2. Game Joining Process

    • Game availability verification

    • Transaction confirmation

    • State transition management

    • Result processing setup

    • Player notification

  3. Result Processing

    • Cryptographic randomness generation

    • Winner determination

    • Payout transaction creation

    • State updates

    • Multi-channel notifications

  4. Error Handling

    • Transaction retry mechanism

    • Automatic refund processing

    • Error reporting through WebSocket

    • State recovery procedures

PreviousSPLFlipNextFrontend Architecture

Last updated 4 months ago