Table of Contents
Decentralized Chess app allowing p2p wagered matches and deathmatch competitions
Link to test site
ETH-Chess enables decentralized 1v1 chess matches between random or specific opponents,
as well as competitive DeathMatch tournaments where the player that wins 3 consecutive match rounds, wins the Rewards Pot!
Custom Solidity contracts for p2p wagered matches
EthChessMatches.sol allows for 1v1 random or specific chess matches or DeathMatch tournaments.
EthChessNFTs.sol allows for rewarded dispute resolution processes.
1.) Matches are initiated with a wager amount specified by the player.
2.) Competitors start the Match by entering the equivalent wager amount,
plus the hash of the IPFS object containing Match details and first move.
3.) The winner of the Match enters a winning claim with the final game state IPFS hash and a security deposit equal to the initial wager.
4a.) The opponent has a dispute claim period of n blocks(where n is an adjustable amount initially set at 7)
to enter their IPFS hash and a security deposit equal to twice the amount of the initial wager.
4b.) If disputed, up to 20 EthChess NFT holders can vote on the dispute, 10 for initial Claim is True, 10 for initial Claim is False(Dispute is true).
4c) If the amount of True votes is >= False votes(benefit of the doubt is favored to the claimant),
then the claimant wins the Match total + their initial Claim security deposit back - n fee(where n is an adjustable fee set at 10% that goes to the DeathMatch rewards pot).
Each voter that voted True receives (1/2 of the Dispute security deposit / amount of True voters).
The other 1/2 of the Dispute security deposit goes to the DeathMatch rewards pot.
If the Dispute is True, the disputer wins the Match total + their initial Dispute security deposit - n fee(where n is an adjustable fee set at 10% that goes to the DeathMatch rewards pot).
Each voter that voted False receives ( Claim security deposit / amount of False voters).
*The voters in the dispute resolution process receives the same amount of rewards whicever way they vote.
1/2 of Dispute security deposit == Claim security deposit
The only difference is if the Dispute is false, half of the security contributes to the DeathMatch rewards pot.*
DeathMatches consists of rounds containing Match structs and a reigning champion.
1.) Player initiates DeathMatch with round wager amount.
Each player must enter this amount each round.
2.) Opponent starts DeathMatch round by cycling through the Matches claim/dispute resolution process.
3.) Match winners can advance the DeathMatch round, starting a new Match.
Match rewards are accumulated in the DeathMatch rewards pot.
4.) The Reigning Champion that wins 3 Rounds in a row wins the DeathMatch rewards pot + (platform rewards pot / n (where n is an adjustable fee set at 50%))
IPFS-http-client Github Repo IPFS-http-client is used for storage and content-addressing services.
Each on-chain Match gameplay state is preserved with each move to IPFS, and each previous hash appended to the next IPFS object.
Each player will have a chain of IPFS CID's that can be submitted at the end of the match, either to cliam vicotry or to dispute the results.
This allows for an immutable chain of events that contributes to the Dispute resolution process where holders of EthChess NFTs an vote on the outcome by reviewing the IPFS CID chained history.
Link to IPFS instance hook.Link to usage.
Link to usage
Gun.js is used in both the frontend and the backend applications for decentralized storage and cryptographic verification processes for user profiles.
**GUN** is an [ecosystem](https://gun.eco/docs/Ecosystem) of **tools** that let you build [community run](https://www.nbcnews.com/tech/tech-news/these-technologists-think-internet-broken-so-they-re-building-another-n1030136) and [encrypted applications](https://gun.eco/docs/Cartoon-Cryptography) - like an Open Source Firebase or a Decentralized Dropbox.
The Internet Archive and 100s of other apps run GUN in-production. GUN is also part of Twitter's Bluesky initiative!
- Multiplayer by default with realtime p2p state synchronization!
- Graph data lets you use key/value, tables, documents, videos, & more!
- Local-first, offline, and decentralized with end-to-end encryption.
The GUN ecosystem stack is a collection of independent and modular tools covering everything from CRDT conflict resolution, cryptographic security & encryption, radix storage serialization, mesh networking & routing algorithms, to distributed systems correctness & load testing, CPU scheduled JSON parser to prevent UI lag, and more!
chess.js is a Javascript chess library that is used for chess move generation/validation, piece placement/movement,
and check/checkmate/stalemate detection - basically everything but the AI.
Chessground is a free/libre open source chess UI developed for lichess.org. It targets modern browsers, as well as mobile development using Cordova.
This project code has been made public in condition with this repo GPL-3.0 license.
CRA platform scaffolded using Scaffold-ETH(more info found below)
everything you need to build on Ethereum! 🚀
🧪 Quickly experiment with Solidity using a frontend that adapts to your smart contract:
Documentation, tutorials, challenges, and many more resources, visit: docs.scaffoldeth.io
- scaffold-eth-tailwind
- scaffold-nextjs
- scaffold-chakra
- eth-hooks
- eth-components
- scaffold-eth-expo
- scaffold-eth-truffle
Prerequisites: Node (v16 LTS) plus Yarn and Git
clone/fork ♞ EthChess:
git clone https://github.com/StarKeyJON/EthChess.git
install and start your 👷 Hardhat chain:
cd EthChess
yarn install
yarn chain
in a second terminal window, start your 🗄️ server:
cd EthChess
yarn server
in a third terminal window, start your 📱 frontend:
cd EthChess
yarn start
in a fourth terminal window, 🛰 deploy your contract:
cd EthChess
yarn deploy
...
🔑 You need to create a .env file for packages/server from the example.env, file as well as in packages/react-app. If you would like to persist data to s3 storage, place in your s3 bucket details to enable gun.js s3, and uncomment the s3 imports in packages/server/config.js .
🌍 You need an RPC key for testnets and production deployments, create an Alchemy account and replace the value of ALCHEMY_KEY = xxx
in packages/react-app/src/constants.js
with your new key.
📣 Make sure you update the InfuraID
before you go to production. Huge thanks to Infura for our special account that fields 7m req/day!
- Add README
- Solidity
- Develop EthChess Matches Contract
- Develop EthChess NFT Contract
- Unit tests for smart contracts
- Statements Coverage > 90%
- Branch Coverage > 90%
- Function Coverage > 90%
- Lines Coverage > 90%
- Develop secondary contracts
- EthChess Leagues
- EthChess Tournaments
- EthChess Treasury
- The Graph
- Develop mono subgraph
- refactor subgraph against final contracts
- Front-End
- App
- Home
- Lobby
- P vs. Comp Skirmish
- PvP Skirmish
- Wagered Match
- Wagered DeathMatch
- Voting
- Mint
- Info
- Back-End
- Express server
- Gun.js relay node
See the ISSUE TEMPLATE for how to propose features and issues.