project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

Battlefrogz

Battle your ZuPass frogs with cryptography leveraging the power of ZK's PCDs and 2PC

Battlefrogz

Created At

ETHGlobal Istanbul

Project Description

In this project, we've built a 2PC fighting game for Zupass frogs which utilizes a cryptographic mechanism which has never been seen before in gaming! The 2PC scheme we are using allows both parties to compete trustlessly and never have to reveal their frog's attributes to opponents. This is like playing poker and being able to prove you've won a hand but never having to reveal your hand, or even see anyone else's!

Zupass is an application where users are issued Proof Carrying Datas (PCDs) can generate zk proofs about them. For example, a user could prove they own a ticket to an event without revealing their personal data or prove they own some collectible without revealing exactly which one. A new addition to Zupass at Devconnect was the FROGCRYPTO section. This addition allows users to collect frogs issued by Zupass which have different attributes such as speed, intellect, etc.. One thing users have been requesting since the addition is a battle, so we are here to answer the call!

We know the Zupass team is already hard at work on a battle mechanism however we wanted to take this to another level and introduce a game mechanism that hasn't been explored yet: 2PC. Two Party Computation (2PC) is a form of Multi Party Computation which allows for 2 parties to perform a computation on their combined inputs without revealing them to one another. This allows for a very interesting mechanism where each player never learns the stats of their opponent but are able to reach an agreement on who one.

How it's Made

To facilitate this 2PC system, we mainly used the sine-fdn/tandem library which allowed us to create the game logic circuit and pass data between parties. The tandem library works as a client/server setup where one party is the client and one party must run the server. This is not ideal since we would prefer to have both parties be able to run client-side however given the timeframe of this hackathon, we settled on this system for now.

We use Zupass to access the frog data to battle with. We would like to tap directly into the Zuath system however the documentation was not available to solve this and instead we rely on copying the data manually.

We built the application as a CLI for simplicity and to shift the focus on the underlying technologies instead. To make it a bit prettier though, we used ncurses and some fun ascii art.

There are also some additional trust improvements we would like to make if there was more time. The easiest addition would be to add verification the PCDs provided by Zupass. Each Frog/PCD includes an EdDSA signature of the data which we could verify to ensure the user does not enter malicious data in the cli. Another addition that would greatly strengthen the system would be to generate a proof of the EdDSA signature and the process of encrypting the circuit inputs so that there is no trust required between parties when it comes to inputting valid data into the circuit. The last remaining improvement would be to fix the trust required with sharing the result. Currently there is nothing requiring the server to provide the result but this can be simply fixed by mirroring the system so that each party performs the 2PC system as the role of the other.

background image mobile

Join the mailing list

Get the latest news and updates