project screenshot 1
project screenshot 2
project screenshot 3

battleFHEps

Private states on chain!!! Play battle ships on chain without having to generate any proofs. We’ve used Fhenix’s platform to enable this timeless classic to work on the blockchain... properly!

battleFHEps

Created At

ETHGlobal London

Project Description

We deployed the game battleships on the Fhenix blockchain with their private state technology to enable this game to be played appropriately. We’re using FHE to store the state of the board so no one apart from the user knows where they’ve launched their battleship. The aim is to sink the enemy battleships by sending attack commands via the GUI.

This project is a representation of a plethora of capabilities that have been enabled via FHE. For example, private state gaming, private data analytics and more! Using FHE, it provides a trustless mechanism to enable people to encrypt their own private records and freely share them to better the world. Everyone is now free to unlock the value of their data without impeding on their privacy to enable a whole new economy where end users are rewarded for their private data, instead of large organisations who de-anonymise and sell it!

The project demonstrates an important proof-of-concept for private computation with blockchain technology that applies to a wide range of decentralised applications that require confidentiality, secrecy, and privacy over private data. In this case, the private data relates to battleship positions. In the future, this method could be applied to protect medical records, financial transactions, personal preferences and other types of sensitive data, while allowing value to be unlocked from these types of data via private computation and privacy preserving AI and machine learning.

How it's Made

We used Fhenix’s JS and Solidity library to enable the private computation, which came with a plethora of interesting nuances. Some blockers that we came across were incorrect gas estimate. We understood this when functions won’t complete all the gas is used (the block explorer wasn’t working at the time). We’ve spun up local instances of the chain (testnet went down in day one). As well as rubber ducky debugging since the block explorer didn’t work and there were no debugging modules.

The key technology we used is Fhenix’s fhEVM implementation for the integration of FHE in the Ethereum Virtual Machine (EVM), which enabled us to implement the private Battleship smart contract in Solidity using encrypted types to conceal and privately compute the board state.

The frontend is written using the Nuxt.js Vue Framework and enables players to deploy and initialise the game on Fhenix. Players are able to setup the positions of their battleships using an intuitive user interface and then take turns to attack opponent positions until one player’s ships have been sunk.

We tested our implementation using Remix and Hardhat.

background image mobile

Join the mailing list

Get the latest news and updates