onchain implementation of the popular board game Secret Hitler using Solana's blockchain. The game integrates off-chain components for role assignment and deck shuffling.
The official game rules have been cafully followed and some gaps have been filled such as player inactivity. Games can be set up with a required entry deposit which will be returned if the player completes the game regardless of game outcome. If a player is inactive past there turn period, then over players (or any signer) is insentivesed to call the "Eliminate Player instruction which automatically kicks out inactive players from the game and their deposit and/or bet will be later distributed amongst the remaining active players at the end of the game.
This solutions uses game theory to eliminate the need for an offchain game server or cron job to continuesly listen to the game events.
The solana-sdk has been utilized to interact with the anchor program and partially sign a transaction. This is to make sure that the game can only begin when the needed information has been recorded in the SQLite database in memory.
Program on Devnet: FxKWd5DzXvHPVfrGo3DvXgTeG25TGUGUAFvjQ1zSMp1B
- Inactivity Management: On-chain functionality to handle inactive players and manage their removal, reducing reliance on external servers or cron jobs.
- Off-Chain Role Assignment and Deck Shuffling: Managed via a Rust server to keep critical game data secure. Future enhancements may include ZKPs for on-chain processing. (In progress)
- Frameworks Used: Solana test validator, TypeScript test files, and Rust test files.
cd anchor-program
anchor build
anchor test
- Zero-Knowledge Proofs (ZKPs): Plan to implement ZKPs for on-chain role assignment and deck shuffling, eliminating the need for off-chain servers.
- SPL Tokens: Consider integrating SPL tokens for player rewards, enhancing the gameplay experience.
- Progress Status: onchain anchor program is finished and tested. Rust Axum backend in development and has made significant progress. front-end is not yet implemented