Smart-Contract Specification
🎮 Game Logic for Non-Technical Players
Rock–Paper–Scissors on Cardano is a blockchain-powered version of the classic game, designed to be fair, transparent, and fully automated using smart contracts. Here’s how it works in simple terms:
🔹 Step 1: Player A Starts the Game
Player A chooses Rock, Paper, or Scissors.
The choice is encrypted (kept secret).
A sends a bet amount (in ADA) to the smart contract, along with:
the encrypted choice
a time limit (
unlock_join_time
) for Player B to join.
🔹 Step 2: Player B Joins
B must join before
unlock_join_time
expires.B chooses and encrypts their move.
B sends the same bet amount.
✅ If B doesn't join in time, A can withdraw their bet.
🔹 Step 3: Reveal Phase
After both have joined, A and B must reveal:
Their actual move
Their secret key (salt)
The reveal must happen before
unlock_revealed_time
.✅ If one player doesn’t reveal in time, the other can claim both bets.
🔹 Step 4: Determining the Winner
Once both moves are revealed:
Rock beats Scissors
Scissors beats Paper
Paper beats Rock
Same move = Tie
The smart contract automatically distributes rewards:
🏆 Winner gets 2 × bet_amount
🤝 Tie: each player gets their bet back
🔐 Fairness & Security
Encrypted choices ensure no cheating.
The smart contract is trustless and verifiable.
All game data is recorded on-chain, making the game tamper-proof.
🧩 Game Flowchart (Mermaid Syntax)


Smart contract Soure.
Last updated