1

I developed a maze game in Solidity with a treasure at a location in the game. Players send transactions to move. The first to find the treasure wins some ether.

Is there no solution to the problem that the treasure position will be visible to anybody who looks into the transactions input data? I know how to hide information submitted by players, like in a rock-paper-scissors game, by hashing the answers and providing the key when the game is finished. But I think that doesn't work here, as the information to hide is needed by the contract to check if a player is at the treasure's position and trigger the reward. Is there any way (even complex) to workaround this somehow, or is this game just not meant to be on the blockchain?

In case that helps, here is the code: https://github.com/jquentin/EtherMaze/blob/master/EtherMaze%20-%20Payable.sol

  • But next version will have zk-snarks.. – Ismael Sep 29 '17 at 04:21
  • I am aware of that other question, but mine is more specific to this very situation where the information to hide is not information submitted by the player and later revealed. In which case we could require the player to hash the information. – Jérémy Quentin Sep 29 '17 at 05:00
  • And yes, there might be some new answers now. The other one is very old in blockchain time... – Jérémy Quentin Sep 29 '17 at 05:04
  • W/o looking at the contract, will it be multiplayer ? Should every check of going in the right direction be a transaction, or shall players only provide the right path in a transaction ? – n1cK Sep 29 '17 at 17:57
  • Multiplayer, yes. And 1 transaction per move. Obviously not a cheap way, the treasure must be worth it. But I'm asking technical feasibility, not business model :) – Jérémy Quentin Sep 30 '17 at 15:19
  • Feel free to read and test the code. It works and can be fun, as long as you trust the players to not look at the Init transaction for the maze shape and treasure position... I welcome feedback on that too. – Jérémy Quentin Sep 30 '17 at 15:24
  • @JérémyQuentin You only use equality comparison with treasurePos.x and treasurePos.y then you can store treasureHash = sha3(treasurePos.x, treasurePos.y) and to check if they found the treasure treasureHash == sha3(cell.x, cell.y). The problem is you can simulate the whole game in a private testnet, if the board is finite you will find the position. – Ismael Oct 01 '17 at 05:00
  • Exactly. So basically everything the contract can do, a user can as well, right? I was also thinking to get the contract to request the check to a server. But then same issue, users can request the server by themselves. Unless there is a way for the server to check that the request comes from a real transaction of this contract? – Jérémy Quentin Oct 03 '17 at 02:01

0 Answers0