Hello, dear judges, users and everyone who is interested in our cool blockchain world!

Today, we’re happy to announce our zkBattleShips game!

Backstory

As you may know, XDC Blockchain is famous for fast transaction speeds, lower energy consumption rates, and significantly smaller transaction fees than its predecessors. These criteria are great for creating a GameFi project in the ecosystem - with incredibly low commissions and fast transactions, it is possible to implement almost any on-chain game mechanics, which should certainly attract special interest from both old and new users of the network.

Inspiration

Our team was inspired by the well-known and beloved game named Battleship. We rethought the whole concept of this game, and added an innovative encryption system (about it below), which allows you to use one of the main advantages of the blockchain - transparency, but also to hide the actions of the opponent for more fair play.

How to play

If you want to create a new room

  1. Connect your wallet
  2. Press “Start new game”, if you want to play a game with your friend.
  3. Copy Room ID, you got after creating the room. Send it to your friend.
  4. The friend have to click “Join the room” and enter the room number.

If you want to join a room

  1. Connect your wallet
  2. Press “Join the room”, if you want to proceed to an existing room.
  3. Put the ID of needed room to the pop-up.

The creator of the room takes control of the crypto-lincore and the first to attack the submarine. The second participant of the battle controls the submarine and defends in the first round.

When the game begins

  • Make your move by choosing the part of the ship/submarine you want to defend (if you are defending) or the part you want to attack (if you are attacking)
  • Confirm the transaction in wallet.
  • Wait for your opponent to make his choice.
  • Send a new transaction to see who wins.
  • If one of you is still alive, keep playing.

Challenge we ran into and Accomplishment that we're proud of

The most challenging work that we've done - our own encryption system. I've left a presentation that visualize the whole process, but anyway here is a brief of what we've done.

In the beginning of the project, we got a really complicated question - “How to not disclose certain user’s data in a transaction?” We came up with this idea:

Users send 3 actions in an encrypted way, but only 1 of them is true. For complete security, we specify the following parameters when encrypting:

  • action
  • room number
  • true/false statement of action

This number of parameters is necessary so that an opponent cannot predict (the chance tends to zero), based on the large number of attempts, what the other user could do. As both players have made their move, they send a new transaction in which all encrypted parameters are no longer encrypted. This system cannot be cheated, since the smart contract has the condition that only one action must be true. If the second player could see the open data, he would change his turn. However, if he does so, his move sent openly won’t match the encrypted data sent earlier.

What we learned

  • We learned how to interact with a new blockchain ecosystem
  • New methods of encrypting
  • Working within a limited timeframe and with a limited set of tools
  • Operational communication within the team
  • Collective thinking and collaborative approach in software development

What's next for zkBattleShips

  • Improve UX
  • New game modes (including tournament)

Built With

Share this project:

Updates