← All projects

GAMES / EXPERIMENTS

Battleships.

You sank my battleship. But can you prove it? Battleships with cryptographic commitments (commit-reveal).

The Battleships page on utile.space: the subtitle "Battleships game with zero knowledge proof", tabs to start a new game, join a game or see the stats, and the opponent's empty 10 by 10 grid next to a radar animation.
The opponent's board before a game. A game needs two players.

Key facts

Status
Experimentas of October 2026
Years
2024
Role
Design and code.
Stack
  • SvelteKit
  • Fabric.js
  • Go
  • WebSocket
  • SHA-256
Highlight
Two players · every cell is committed with a salted SHA-256 hash

Why I built it

In Battleship you have to trust the other player: you shoot, and they tell you if it is a hit or a miss.

This is a place to explore what can be verified without revealing the underlying information.

How it works

Once the ships are placed, each player sends a commitment for every cell of their board: a SHA-256 hash of the cell value, water or ship, with a random salt.

When a cell is shot, its owner reveals the value and the salt, and the other player checks them against the commitment. So a player cannot change the answer after the shot.

What it is not

The page on utile.space says "zero knowledge proof". To be exact, this is a commit-reveal scheme, not a zero-knowledge proof: nothing proves that a board follows the rules without revealing it.

The salts also come from Math.random(), which is not made for cryptography. A real zero-knowledge proof of the board would be a possible next step.

How it's built

The game is part of utile.space. The front end is a SvelteKit page that draws the boards with Fabric.js. The back end is in Go, in the utile.space API, and the players talk to it over a websocket.

GOOD THINGS START WITH A CONVERSATION.

Something on your mind?

LinkedIn
sonny@the-internet: ~

A small window into a curious mind.

Type help to look around. No serious hacking required.

↑ ↓ command historytry a little curiosity