On-chain Solana program for a simple coin flip gambling game, written in Rust. Players bet SOL against the house; the outcome is determined by the block timestamp (even = win, odd = lose).
- Player calls
PlayGamewith a bet amount in lamports - SOL is transferred from the player to a PDA (Program Derived Address) house account
- Outcome determined by
unix_timestamp % 2 - If player wins: house pays out 1.95× the bet
- If player loses: house keeps the SOL
The Withdraw instruction lets the contract owner withdraw from the house PDA.
- Rust +
solana-programcrate - Borsh serialisation
- Program Derived Address for the house bankroll
- Frontend (
App.tsx) — React/TypeScript wallet integration
cargo build-bpf
solana program deploy target/deploy/solana_program.so- casinr_api — full casino platform