How it started

In June of 2021, Aleo announced their Community Grants Program to accelerate the creation of private and personal experiences. Aleo enables decentralised private computing at scale. Implementing an efficient way to generate proofs and making it accessible for any developer without the need for deeper knowledge of cryptography.

We joined the grant program because it aligned perfectly with our goal of accelerating the adoption of decentralised technology for positive impact. Envisioning a ZK toolkit for decentralised game development.

The proof is in the gameplay

At Kryha, we believe in learning through building. Applying Game Theory, we focused on leveraging Zero Knowledge (ZK) in Incomplete Information Games.

In these games, players have limited knowledge about certain aspects. For instance, in Poker, players only know their own cards and must speculate about opponents’ hands.

To provide developers with useful tools, we investigated the main challenges in developing such games. After thorough research, we created Boloney!, a real-world dice game to test ZK capabilities.

In Boloney!, players roll dice, betting on hidden values. To make informed bets, players rely on probability and intuition.

A dicey situation

Identifying the requirements of our ZK sandbox game was a step in the right direction, but it’s only one piece of the puzzle.

Most games need some degree of randomness to be fair and fun to play. In our case, we needed a Random Number Generator to produce the dice rolls. This generator needed to be fair in probability and transparent for players to trust the mechanism. The most common solution for this is to rely on an external oracle, but we need a scheme that doesn’t rely on external sources from which we can extract enough entropy (randomness) to feed our generators.

Another unique decentralised gaming challenge is that part of the state of the game lives on-chain. Storing and computing information in a shared public computer spread across the world is very expensive. This translated into a very concrete requirement: the computation and on-chain storage needed to be reduced to a minimum for the game to be playable.

But the biggest challenge was establishing trust among players that have opposing goals. Every player wants to win, and for that to happen they need as much information as possible about the hidden information. They are also motivated to lie to other players about their own secret information.

No boloney, just Boloney!

For transparency, we implemented a Verifiable Random Function as our generator. This allows mathematical proof of correct computation. The code for the module is open-source and anyone can validate the logic.

To build trust, we adopted a Commit & Reveal Scheme. Players privately commit to values for generating random dice rolls, stored on-chain with timestamps. At match end, players reveal commitments to ensure fair play without cheating.

The critical logic of the game was implemented in Leo, (Aleo’s domain specific language). This allows us to generate ZK proofs out of the box. We can effectively decouple the most expensive verification logic from the game UX, making it so the extra cryptographic transparency has a very low impact on the gameplay and the responsiveness of the UI.

What’s next?

Boloney! showcases the great potential of ZK in the world of gaming. This is the first step of truly bringing gaming on-chain and providing the gaming community with private and verifiably trusted games. In collaboration with Aleo, we have created the initial building blocks, and with time many more will be added. Stay tuned and keep an eye on SirIZK for updates.

Start playing Boloney!