2

I want to create game where p1 and p2 take actions in turns but neither p1 nor p2 should be able to see the action, the other is doing till the end of the game. If I would do it like in a normal Web-Game or other Games I would write everything in a sql db where both p1 and p2 don't have access to. In end the both can see the result with a request to the sql db.

But if I use EOS as a Backend and save things there, it is visible and one just has to wait till the other made his turn to see what he did.

A workaround i come up with would be using a sql db where p1 turn is saved in a sql db and a reference is saved in the blockchain. After p2 made his move which is written directly in the chain, i now would need a way to swap p1 turn with the entry in the sql db. But i can't come up with a way to swap entries. I also don't think it is very efficient.

i'm thankful for any help!

2

You could use an approach similar to the dice contract sample:

  • Each user submits sha256(move), where move contains the user's actions plus a random number
  • After the turn, each user submits move. The contract can verify the move matches the hash.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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