S

Shatranj

The classic game of chess with a modern prize for winning. Play with $ASHF, winner takes it all.

The problem Shatranj solves

During the lockdown in light of the pandemic, we all witnessed a sharp increase in the popularity of chess. As most sporting action shut down because of the lockdown, chess found new life online with several tournaments taking place. In an interview with PTI, the 51-year-old maestro Viswanathan Anand touched upon a variety of subjects, including the immense popularity of chess-based Netflix drama 'The Queen's Gambit, his new role of a mentor to youngsters, amidst a lot of other things.

Reputed chess website chess.com declared that its subscriber base shot up significantly after the series's release. With Samay Raina, the organizer of Comedians On Board and an avid Chess Enthusiast onboard BUIDL IT, we decided to try our hands over the ancient game of Shatranj with new Asharfi, crypto token, which just like Chess boomed in Indian households this year.

We know that Chess games are widely popular today. Shatranj increases the incentive and the stake to play this classic ancient game with Web3 tokens we call Ashrafi (ancient coins in India) $ASHF. Both players of the game that connect using our special matchmaking algorithm agree on a bid amount and the winner of the game takes all the $ASHF (game token) in the prize pool. In short, Shatranj is the Web3 implementation of the popular Web2 Application, chess.com.

We are trying to use a more governed super token $ASHFx by integrating Superfluid in the system. We are also currently trying to make the backend more scalable, optimized, and decentralized using Stack OS integration in the system.

Challenges we ran into

Web2

Handling the Chess Board moves was a challenge for us and we had to pick between writing the code from scratch or using a pre-existing library. For Shatranj, we chose to have the best elements from both worlds and we ended up using chess.js and react-chessboard with our amendments. Implementing the architecture was a difficult task too. WebSocket doesn't come with CORS inbuilt and we took a significant amount of time to resolve the CORS errors.

Web3

As all of us are new to Web3, local setup was difficult initially but eventually, we figured our way around. Another issue was connecting MetaMask and minting contracts as well as the deployment of local blockchain. We were also clueless about the different chains we could implement, even though there are several options available, none's really complete in terms of documentation or has API limitations. Making $ASHF was a challenge that we resolved alongside shifting network chain ID and after much deliberation, we did our testing over ngrok. Socket.io has a deployment issue due to HTTP-server-affinity as socket rooms are not being connected to the same instance.

Discussion