Implementing a state channel

by Sanjay S B   Last Updated July 12, 2019 05:28 AM - source

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?

Related Questions

What are State Channels and use case/code examples?

Updated August 04, 2018 02:28 AM

Which state channel state is honest?

Updated May 05, 2018 13:28 PM