Share
Explore

Heavy Weight Clash


Step-by-Step Process

1. Player Registration & Wallet Connection

User Onboarding:
Registration: Players register on your platform, providing minimal details (username, email) and connecting their Solana wallet (e.g., Phantom).
Authentication: Use JWT-based authentication for secure sessions.
Transparency Aspect:
The wallet connection is recorded and linked to their user account, so every on-chain action is tied to a verifiable wallet address.

2. Viewing Personal Dashboard & Transaction History

Dashboard Features:
Account Overview: Players can view their profile, wallet balance, and a summary of their past activities.
Transaction History: Display a detailed log pulled from your PostgreSQL transactions table.
Each entry shows the type (bet, NFT mint, reward), amount, timestamp, and a unique blockchain transaction signature.
Transparency Aspect:
Each transaction signature acts as a verifiable reference; players can click a link (e.g., to Solana Explorer) to audit the transaction on-chain.

3. Joining a Game & Placing a Bet

Game Entry:
Selecting a Betting Room: Players choose a room that matches their desired bet size.
Placing Bets: Once in a room, a bet is placed which is recorded in the bets table, and a corresponding transaction is initiated on-chain.
Real-Time Updates:
WebSocket Broadcasts: The bet is immediately broadcast to all connected clients so players see live status updates.
Transparency Aspect:
The backend logs each bet with details (user ID, bet amount, team selection) and associates it with a blockchain transaction that is later visible for auditing.

4. Randomized Team Assignment & Game Execution

Team Assignment:
VRF Integration: A Verifiable Random Function (VRF) (e.g., via Chainlink VRF on Solana) is used to assign players to teams fairly.
Smart Contract Logging: The randomization process is executed by the smart contract and recorded on-chain.
Game Execution:
The smart contract calculates the winning team based on the cumulative coin weight, and the result is stored in the games table.
Transparency Aspect:
All random values and team assignments are logged on-chain. Players can verify the fairness of the assignment by checking the corresponding on-chain records.

5. Reward Distribution & NFT Minting

Reward Calculation:
The smart contract deducts a 5% fee and distributes the remaining prize proportionally among the winning team members.
NFT Rewards: For special achievements, the system mints NFTs (recorded in the nft_rewards table) as an additional reward.
Blockchain Transactions:
Every reward distribution and NFT mint operation creates a transaction on the Solana blockchain.
Transparency Aspect:
Players receive detailed information for each reward, including the distribution breakdown and the blockchain transaction signature that they can verify.

6. Leaderboard & Detailed Game History

Leaderboard Display:
Aggregated statistics (total bets, wins, NFTs earned) are stored in the leaderboard table.
A REST API endpoint (or real-time WebSocket channel) provides a view of top players.
Game History:
Each game session’s details including room ID, participating players, bet amounts, team assignments, and final outcome—are stored in the games and bets tables.
A detailed view on the frontend shows players a complete breakdown of each game they participated in.
Transparency Aspect:
Every game and transaction is recorded in the backend database. Players can view comprehensive logs and cross-reference on-chain transaction signatures for further verification.

7. User Interface & Verification Tools

Dashboard & Detailed Views:
User Dashboard: Contains sections for "My Account," "Game History," "Transaction History," and "Leaderboard."
Transaction Verification: Each transaction entry includes a clickable link that opens a block explorer (e.g., Solana Explorer) so that players can verify the transaction details on-chain.
Real-Time Feedback:
WebSockets: Ensure players receive live updates (e.g., when teams are assigned or rewards are distributed) so they always see the latest information.
Transparency Aspect:
The system design ensures that all actions—from bet placement to reward distribution—are transparent and verifiable, reinforcing trust among players.



Server Cost and Services (For Test can use Free $300 credit from AWS duration 6 months)
Component
AWS Service / Instance Type
Cost Considerations (24×7)
Cost Optimization Strategies
Compute (Container Orchestration)
AWS EKS using Managed Node Groups (t3.small/t3.medium)
Nodes running 24×7 incur hourly costs. EKS control plane has a fixed monthly fee (~$73/month).
-Use Cluster Autoscaler to scale nodes during off-peak times. - Consider spot instances for non-critical workloads. - Evaluate if ECS/Fargate or serverless containers can reduce costs.
Load Balancing
Application Load Balancer (ALB)
ALB charges an hourly fee plus a per-GB data processed cost.
- Optimize routing rules and combine services behind a single ALB when possible. - Monitor traffic patterns to avoid over-provisioning.
Database
Amazon RDS (PostgreSQL, db.t3.small/db.t3.medium)
Running a 24×7 instance can be costly, and performance requirements may drive up the instance size or storage costs.
- Consider reserved instances or RDS Serverless options if usage patterns allow. - Right-size your instance based on actual load.
Caching
Amazon ElastiCache (Redis, cache.t3.micro/small)
A continuously running cache instance adds to hourly costs.
- Start with the smallest instance size and adjust based on performance metrics. - Use auto scaling features if available for caching layers.
Monitoring & Logging
Amazon CloudWatch
Costs for metrics, dashboards, and log storage can accumulate with continuous monitoring.
- Optimize log retention policies and only collect essential metrics. - Use CloudWatch custom dashboards wisely to monitor key performance indicators.
Security & Networking
VPC, AWS WAF, IAM
VPC and IAM have minimal direct costs, but AWS WAF may add extra expense based on the number of web requests processed.
- Configure WAF rules to block high-volume malicious traffic, thereby reducing unwanted costs. - Regularly review security group rules to ensure efficient use.
There are no rows in this table
Phases
Done
Task
Due date
Phase-1 Base Building starting with basic login and room selection
Mar 5
Phase-2 Complete backed logics and working application
Mar 19
Phase-3 Sever deployment and unit testing and traffic scalability
Mar 30
There are no rows in this table

Database

Database done in PostgreSql ​
Loading…
As of Now this the basic tables needed will share the sql file and may have to introduce further tables if needed. ​

Server Architecture

Currently will be doing in clean architecture .We may be further doing microservices so i would prefer clean architecture since it can be easily migrated to different services.

Servises-

1)Authentication 2) Verification(all the blockchain transaction can be seen and mostly for the transparency’s )
3)Game implementation

4) Randomisation (will be a service because,will be using an algorithm for this) 5)Admin

Cron Jobs-

These are basically shedulers will be as a separate entity will be hosted in aws Lambda and integrated with rds and cloudwatch shedulers. we may also have shedulers as a service in our main server also.We may need this for realtime scheduling. For Cron we may use seperate db services for listing out all the schedulers and the status.

Frontend Hosting

Will be using AWS s3 bucket and Cloudfront.These services are not costly and best for ci cd.

Conclusion

Listed out the services,Project planning and brief estimate for the cloud cost.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.