Skip to content

A modern, real-time crash-style gambling game built on Solana with provably fair gaming mechanics. Time your exit before the multiplier crashes!

Notifications You must be signed in to change notification settings

dvansari65/crashed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

escape.fun - Crash Game Platform

A modern, real-time crash-style gambling game built on Solana with provably fair gaming mechanics. Time your exit before the multiplier crashes!

๐Ÿš€ Features

Core Features

  • Live Crash Game: Watch the multiplier rise and cash out before it crashes
  • Solana Wallet Integration: Connect with Phantom and Solflare wallets
  • Provably Fair System: Transparent and verifiable crash points
  • Auto Cashout: Set automatic cashout at your preferred multiplier
  • Sidebet System: Bet on crashes within 10 seconds for 5x payout
  • Real-time Chart: Live multiplier visualization with historical data
  • Player Tracking: See active players and recent winners

Technical Features

  • Real-time Updates: WebSocket-powered live updates
  • Responsive Design: Modern UI that works on all devices
  • Secure Authentication: JWT-based user authentication
  • Rate Limiting: Protection against abuse
  • Database Persistence: PostgreSQL with Prisma ORM

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Framer Motion - Smooth animations
  • Socket.IO Client - Real-time communication

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web framework
  • Socket.IO - Real-time bidirectional communication
  • Prisma - Database ORM
  • PostgreSQL - Primary database
  • JWT - Authentication tokens

Blockchain

  • Solana Web3.js - Solana blockchain integration
  • Wallet Adapter - Multi-wallet support
  • Devnet/Mainnet - Network flexibility

๐Ÿ“‹ Prerequisites

  • Node.js 18+
  • Docker & Docker Compose
  • Solana CLI (optional)
  • Git

๐Ÿš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd rugsfe

2. Install Dependencies

npm install

3. Set Up Environment Variables

cp env.example .env.local

The .env.local file is pre-configured with:

  • Docker database credentials
  • Your Helius API key for enhanced Solana RPC
  • Mainnet configuration
  • Redis cache settings

4. Set Up Database

# Generate Prisma client
npx prisma generate

# Start Docker services (PostgreSQL + Redis)
docker-compose up -d

# Run database migrations
npx prisma db push

5. Start the Development Server

# Terminal 1: Start the backend API
npm run dev:server

# Terminal 2: Start the frontend
npm run dev

Visit http://localhost:3000 to see the application.

Quick Setup (Alternative)

# Run the automated setup script
chmod +x setup.sh
./setup.sh

๐ŸŽฎ How to Play

1. Connect Your Wallet

  • Click "Connect Wallet" on the homepage
  • Choose your preferred Solana wallet (Phantom, Solflare)
  • Approve the connection

2. Place Your Bet

  • Set your bet amount in SOL
  • Choose your auto cashout multiplier (optional)
  • Click "BUY" to enter the round

3. Watch and Cash Out

  • Watch the multiplier rise in real-time
  • The longer you wait, the higher the potential payout
  • Click "CASHOUT" before the chart crashes
  • If you wait too long and it crashes, you lose your bet

4. Strategy Tips

  • Start with small bets to learn the game
  • Use auto cashout for consistent profits
  • Don't get greedy - cash out early for safer gains
  • Watch the recent results to understand patterns

๐Ÿ”’ Provably Fair System

Our platform uses a provably fair system to ensure crash point integrity:

How It Works

  1. Crash Point Generation: Before each round, the server generates a provably fair crash point
  2. Hash Publication: The server publishes a hash of the crash point before the round starts
  3. Multiplier Calculation: The multiplier rises continuously until it reaches the crash point
  4. Crash Point Revelation: After the round ends, the original crash point is revealed
  5. Verification: Players can verify fairness by checking the hash and running the algorithm

Crash Point Algorithm

The crash point is generated using the formula: crashPoint = max(1.0, 0.99 / (1 - random)) This ensures a fair distribution where most crashes happen early, but high multipliers are possible.

Verification

You can verify any crash point by:

  1. Confirming the hash of the revealed crash point matches the pre-published hash
  2. Running the verification algorithm with the seed to produce the same crash point

๐Ÿ—๏ธ Project Structure

rugsfe/
โ”œโ”€โ”€ app/                    # Next.js app directory
โ”‚   โ”œโ”€โ”€ components/        # React components
โ”‚   โ”œโ”€โ”€ hooks/            # Custom React hooks
โ”‚   โ”œโ”€โ”€ layout.tsx        # Root layout
โ”‚   โ”œโ”€โ”€ page.tsx          # Home page
โ”‚   โ””โ”€โ”€ providers.tsx     # Context providers
โ”œโ”€โ”€ api/                  # Backend API
โ”‚   โ””โ”€โ”€ server.ts         # Express server with Socket.IO
โ”œโ”€โ”€ prisma/               # Database schema and migrations
โ”‚   โ””โ”€โ”€ schema.prisma     # Prisma schema
โ”œโ”€โ”€ public/               # Static assets
โ””โ”€โ”€ package.json          # Dependencies and scripts

๐Ÿ”ง Configuration

Environment Variables

Variable Description Default
DATABASE_URL PostgreSQL connection string (Docker) postgresql://rugs_user:rugs_password@localhost:5432/rugs_fun_db
JWT_SECRET Secret key for JWT tokens Required
FRONTEND_URL Frontend application URL http://localhost:3000
PORT Backend server port 3001
SOLANA_NETWORK Solana network mainnet-beta
HELIUS_API_KEY Helius API key for enhanced RPC Pre-configured
SOLANA_RPC_ENDPOINT Helius RPC endpoint Pre-configured
REDIS_URL Redis cache URL redis://localhost:6379

Database Schema

The application uses the following main entities:

  • Users: Player accounts and statistics
  • Battles: Game sessions and configurations
  • BattleParticipants: Player participation in battles
  • Transactions: Financial transactions and history
  • ChatMessages: Real-time chat messages
  • Badges: Achievement badges
  • Achievements: Player accomplishments

๐Ÿš€ Deployment

Frontend (Vercel)

npm run build
# Deploy to Vercel or your preferred platform

Backend (Railway/Heroku)

# Set up environment variables
# Deploy the api/ directory

Database

  • Use a managed PostgreSQL service (Railway, Supabase, etc.)
  • Run migrations: npx prisma db push

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License.

โš ๏ธ Disclaimer

This is a demonstration project. Use at your own risk. Never bet more than you can afford to lose.

๐Ÿ†˜ Support

For support, please open an issue on GitHub or contact the development team.


Built with โค๏ธ for the Solana community

About

A modern, real-time crash-style gambling game built on Solana with provably fair gaming mechanics. Time your exit before the multiplier crashes!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published