Suit Prediction Game is a beginner-friendly Ethereum smart contract that lets players test their luck by predicting a card suit — Hearts, Diamonds, Clubs, or Spades.
If the player’s prediction matches the randomly generated suit, they win double their bet!
This project is designed to help new Solidity developers understand:
How to write and deploy smart contracts
How to handle Ether transactions
The basics of pseudo-randomness in Solidity
My project is a simple Solidity-based card suit prediction game where players place a small bet, guess a suit, and win double their bet if they guess correctly. I implemented functions for betting, generating a pseudo-random suit, and owner features like depositing and withdrawing funds. It’s designed to be beginner-friendly, and I’ve deployed it on the Celo-Sepolia testnet to make it easy to test and explore how smart contracts work in practice.
Creating a simple blockchain-based game that demonstrates how smart contracts handle bets, randomness, and payouts. Traditional guessing games lack transparency, so my goal was to build a trustless version where the rules and outcomes are fully visible on-chain.
To solve this, I developed a Solidity smart contract that allows users to place a small bet and guess a card suit. The contract generates a pseudo-random suit based on block data, compares it with the user’s guess, and automatically handles payouts. If the player guesses correctly, they receive double their bet; otherwise, the contract keeps the amount. I also added owner-only functions to deposit funds, withdraw earnings, and view contract balance. The contract is deployed on the Celo-Sepolia testnet to make testing and interaction easy.
India