built with Puzzle Wallet & Puzzle SDK
SDK Docs: link
Where's Alex Leo Program Docs: link
Puzzle Wallet Download link
Puzzle Devtools link
Where's Alex? is a fun experiment that aims to be a fun 1v1 game to showcase how to have a completely private multiparty game on Aleo! This technical overview reviews the issues with multiparty privacy and how this is solved using programmable private multisigs and incentives!
Hide alex in a secret location and wager another person on Aleo to guess where you hid Alex. If they guess wrong, then you win the prize pot between you both!
Have fun with other members of the Aleo community, rack up some wins and rack up some puzzle pieces!
The puzzle pieces don't mean anything and can be minted if you are running low -- they are just for fun to experiment with Leo token standards on what's necessary for programmbale private multisigs.
The FE for the game utilizes key multisig features using the Puzzle Wallet and Puzzle SDK described below.
The game is split into 3 Leo Programs described below:
- Puzzle Pieces token program (with n of n programmable multisig functions)
- Multiparty PVP utils program
- Where's Alex program
If you're interested in building your own multiparty game on Aleo, fork this repo and give it a shot!
- Starting a new game (challenger)
- mint Puzzle Pieces if you don't have already
- challenge another Aleo address
- hide alex in either the weeds or the bushes
- set your wager amount to win if your opponent guesses wrong!
- Accepting a new game (opponent)
- mint puzzle pieces if you don't have already
- match wager from the challenger
- guess if alex is hiding in the weeds or the bushes
- accept the game and lock in the wagers to win if you guess correct!
- Finishing a game (challenger)
- Reveal your answer
- Finish the geam and payout the wagers to you if the opponent guessed wrong or the opponent if they guessed right!
Multiparty privacy is a broad category and can be split into multiple categories based on use cases like:
- n:1
- 1:1:1
- n:n
One category of multiparty privacy is n:1 like a company's bank account
A company's bank account is multiparty and private -- n people have ability to view/share an account, everyone outside of those n people can't see the account balance, and it requires t approvals to do an action on one account.
Another category of multiparty privacy is 1:1:1 is like a game like Guess Who?
The users share a single game state that is multiparty while pieces of that shared game state are private to each individual.
Each player in the game has state that is private to themselves but needs to interactive with another player. The game state and individual private values may/may not be private to others outside of the two players, but each player wants to keep certain information private from the other.
Multiparty privacy suffers from 3 problems
- Guarantees on privacy of data
- Guarantees on routing of information between parties
- Multiparty computation attacks: timeout, collusion, and denial of service
We can understand these problems specifically by looking at a game of online poker in web2.
1. Guarantees on privacy of data
The terms of service, the auditing by government, and the enforcement of law by the company's operating jurisdiction is the only guarantee you get that your hand is private to other players as well as the dealer. If you don't know or trust the brand/company, it's likely you won't feel the game is fair.
The most common complaint of online poker is that the game is rigged because other players or the house can see your cards somehow to know to increase wager or fold.
2. Guarantees on routing of information between parties
The terms of service, the auditing by government, and the enforcement of law by the company's operating jurisdiction is the only guarantee you get that your actions to up a bet, match wager, or fold is actually carried out. Again, if you don't know or trust the brand/company, it's likely you won't feel the game is fair.
Another common complaint of online poker is that the game lags or fails to record your action and folds your hand or matches your wager when you didn't want it to.
3. Multiparty computation attacks: timeout and denial of service
These attacks currently have no mitigation
- if the online poker site shuts down, then you have no mitigation
- if the opponent rage quits, then you have no mitigation
- if players collude, you have no mitigation or recourse
These are the last most common complaints of an online poker game -- opponents will rage quit or the online poker service may fail/shut down mid game.
1. Guarantees on privacy of data
In private/public ZKP blockchains like Aleo, your data is guaranteed to be private to other players in the game as long as they don't have your private keys and that the smart contract/program functions don't reveal your data to others.
This alleviates the concern that the game is rigged because you have guarantees your information is hidden from other players/house and you can verify yourself onchain.
2. Guarantees on routing of information between parties
Puzzle's SDK has operations to CreateSharedState and ImportSharedState that work with Puzzle Wallet to create multisig keys and import multisig keys for generating a place to send information to parties in a game.
In private/public ZKP blockchains like Aleo, your information is recorded onchain and guaranteed to be available to anyone that runs or communicates with a node.
Additionally, Puzzle wallet makes it easy for you to find your game state that's recorded on chain.
This alleviates the concern that your actions will be carried out and reach the other parties -- you can verify that it has been processed on chain.
3. Multiparty computation attacks: timeout and denial of service
The secret sauce of Where's Alex is solving the rage-quit, colllusion and denial of service problem with incentive engineering and game design.
This is done by forcing a challenger to commit a wager to a 2/2 multisig between the challenger & opponent when proposing a game. Once the opponent accepts the game and submits their guess -- the challenger's wager is locked and will be lost if the challenger rage quits or never reveals the answer. Importantly -- thanks to programmability of the multisig -- there are exit routes the challenger can take to retrieve their funds from the multisig if the opponent rejects or never responds so it's not stuck at the beginning as well. Because the game is a simple 1v1 -- we also don't have to worry about the collusion risk as well.
Below we'll walk through the following:
- How the Where's Alex? game works at a high level with Leo programs, Puzzle Wallet, and Puzzle SDK
- How the Where's Alex? Leo programs work in depth
NOTE: Different function executions require different keys (player 1, player 2, multisig keys). For testing purposes, you can run the below to switch execution keys.
We also have a test.sh
script here that runs through all the flows.
echo "
NETWORK=testnet3
PRIVATE_KEY={MS_PK || P1_PK | P2_PK}
" > .env
More information on the Puzzle Wallet and Puzzle SDK can be found here
Repo here