TLDR; A Prouvably fair multiplayer Card Game based on Rock Paper Scissors. Players join by providing a collateral and recieve 6 random cards (a collection of Rock, Paper, Scissors cards) and 3 stars. Players play matches by chosing a card and betting a number of stars. At the end of the game, if a player has no more cards, he can redeem his stars for collateral. The fairness of the game is proven by the blockchain and any cheating is automatically detected.
Disclamer: The previous version of this game https://github.com/raouf2ouf/restricted-rps won the second best project at the Encode x Lightlink Hackathon and the new verson is submitted to the Encode x Polkadot Hackathon 24Q1. Details on the changes can be found here.
- Demonstration video Demo Video
- Pitch Deck Slides Presentation
- Example of a Game EVM example Substrate example
- Changes for the Polkadot hackathon
- Game Introduction and How to Play
- Architecture and How it Works
- Known Issues
- Roadmap
The previous version of this game submitted for the Encode x LightLink hackathon (won second best project) had various shortcommings pointed out by the judges, mainly, scaling. In the new version, we use Acurast.com and GetBlock.io to address these weaknesses. The following table explains the main changes:
| Changes | Previous version (github repo) | Polkadot version |
|---|---|---|
| Technology |
|
|
| Architecture | Client-Server A server is needed for automatic game creation, cards distribution, game closing, and distribution of player rewards. This Nodejs server relies on multiple Etherjs listeners. Main issues:
|
Serverless and fully decentrelized With the help of Acurast cloud computing, a server is no longer needed, making the game 100% decentralised. Solutions:
|
| Scaling Games |
|
|
| Scaling RPC calls | The game requires more than 50 RPC calls per second. Furthermore, any lag on contract event listener can negatively impact the ability of players to make the right choice of cards. The handling of contracts event was not optimised along with the inability of the RPC to respond quickly. | By using multiple Getblock.io websocket RPC and optimising RPC calls (40 calls per second per game) we achieve fluid gameplay. |
| Scaling Blockchains support | In this version, only 1 blockchain (LightLink) was supported. | By using Acurast as a chain-agnostic RNG provider along with Getblock RPCs we can support multiple evm and polkadot chains. Currently, we deployed the game for: Fantom Testnet, Azero Testnet, Polygon Mumbai, LightLink Testnet. Furthermore, deploying to a new blockchain is relatively straightforward as it only requires creating a Getblock RPC API keys and Acurast Jobs (along with integrating the proper wallet on the frontend). |
Rock, Paper, Scissors [RPS] is one the most iconic and played games all over the world (there is even an RPS World Championship. However, there was always a debate on wether it is a game of chance or a game of skill ?
Random Open Restricted RPS [RORRPS] is a variant that adds complexity and amplifies the role of chance and skill. It is inspired by the famous Resctricted RPS from the manga Kaiji along with the E-Card game from the same manga. By making the player cards public, chosing a card amounts to playing E-Card.
You start by joining a game and providing a collateral for which you will recieve:
- 6 cards: a collection of Rock, Paper, Scissors cards.
- 3 stars: used to bet when you play a card. They are redeemable for collateral at the end of the game.
In-game Cash: used to buy and sell cards. You can only redeem stars if you have no cards in you hand!(functionnality removed for now as the smart-contract is too big).
After which you can offer or answer a match: a match is offered by placing a hidden card and a bet (number of stars). Other players can answer your match by placing a card and bet at least equal to the minimum you indicated.
- You win a game when you have at least 3 stars and no cards at the end of the game. For each star above 3 you will recieve additional collateral.
- You lose a game when you have less than 3 stars at the end of the game (you will still recieve part of your collateral for each star you have).
- You draw a game when you have more than 3 stars and at least 1 card. You will only recieve the collateral you used.
The game is composed of two smart-contract:
RestrictedRPSFactory: handles game creation (deploys or resets an instance of theRestrictedRPSGamecontract), collateral redeeming, and banning of cheaters.RestrictedRPSGame: handles everything related to a game, from joining to matches along with cheat detection.
Along with these smart contract, there is a frontend to simplify contract interaction and a set of Acurast jobs that handle automation and Rng providing.
The following schemas describes how Acurast and Getblock are used to generate the Cards of a player:

- Acurast HttpPOST: There is currently an issue with Acurast Jobs, the
HttpPostmethod sends aGETrequest rather than aPOSTrequest. this makes the job unabled to have up-to-date information on players to give the correctRNG. A workaround is currently in place only forFantom Testnetas getting the gas fees is relatively easy for this chain.
This project (previous and current version) was started 4 weeks ago (mid february 2024). There is sill a lot of work to bring this game to the public, mainly:
- 2024Q2:
- Optimise frontend wallet connection: the blockchain change detection is currently unreliable.
- Optimise Ink Smart Contracts: My knowledge of Ink is still limited, I believe the smart contract can be better optimized.
- Deploy more Acurast Jobs and have a dedicated smartphone for our jobs.
- Improve the reliability of the winning/loss aggregated data for players.
- 2024Q3/4:
- Public launch with Tournaments including prizes and NFTs.
- Include Partners from Web3 and from the RPS community.
