Welcome to the Rock-Paper-Scissors (RPS) game implemented on the blockchain! This project allows players to participate in an online RPS game using smart contracts on the Ethereum blockchain.
The game involves two players interacting via a smart contract. It supports the following functionalities:
-
Connect Wallet: Before starting the game, players need to connect their wallets to interact with the smart contract.
-
Create Game or Join a Game:
- Create Game: As the first player, you can create a game by selecting your move (Rock, Paper, Scissors, etc.), providing a salt to create a commitment for your move, entering your opponent's address, and specifying the stake amount.
- Join a Game: The second player can join an existing game by providing the contract address created by the first player. They can then make their move, match the stake amount, and wait for the first player's reentry of their move.
-
Game Flow:
- The first player enters their move, creates a commitment using a salt, and specifies the opponent's address and stake amount.
- The second player joins the game, matches the stake amount, and makes their move.
- The first player reenters their move.
- The smart contract verifies if the reentered move matches the one entered during the creation.
- If the moves match, the smart contract determines the winner, and the entire stake amount goes to the winner.
-
Timeouts:
- Timeout occurs if a player doesn't make their move within 5 minutes. This feature prevents delays and ensures active participation.
To run the game:
- Clone this repository.
- Install the necessary dependencies.
- Run the application on a development environment.
Ensure you have a compatible Ethereum wallet (like MetaMask) to connect and interact with the smart contract.
The game is built using [insert technologies/languages/frameworks used - e.g., Solidity, React, Ethereum, etc.].
Contributions and improvements to the game are welcome! Feel free to submit issues or pull requests.
This project is licensed under the [insert license type].