1

I am trying to build a platform to play TicTacToe using DApps. The players invite others by placing a stake and then opponents accept it. The first turn is recorded on chain by calling a function in the smart contract. The subsequent turns are supposed to be recorded off chain. The players will exchange signed board states between them. Finally one of the players submits a save to record the latest board state on chain. The save function optionally checks whether the game has ended.

You can see the current version here.

My question is who will store the intermediate off chain states. If I store it in my server, then it is kind of centralization. I was exploring if there is anyway that the players can store the copy of the board states and exchange the states. My app could facilitate this and app's UI could point to each of the users off chain states. I was thinking of ipfs. I have not used ipfs before. If I am using ipfs how should I go ahead? Is there any better way I should proceed? Can you guys give me some pointers?

1 Answer 1

2

Both players should keep their own copy of the latest state. The server could be a backup, and although it would be a centralized back up, the server will not be able to tamper with the state if players control their secret private keys.

https://medium.com/@graycoding/lessons-learned-from-making-a-chess-game-for-ethereum-6917c01178b6 and its code may also help you.


IPFS could be a backup that's decentralized, but it might not be needed for this DApp (because it's TicTacToe and much won't be lost by a player losing the state). https://docs.ipfs.io is the starting point for IPFS and it would be better to ask more specific questions for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.