TokenomGo is a game taking inspiration from PokemonGo. The main idea is to allow players claim tokens based on their geolocation.
The main issue with having a GPS based on-chain game is hiding the coordinates of the tokens to be claimed. That's where Aztec's Noir comes into play, letting us hide the location of the tokens using ZKP.
- We created a circuit to hide the location of the tokens, generating a smart contract through the use of
nargo codegen-verifier
, ran local tests and deployed theVerifier
contract. - Following which we created a
Holder
contract which actually holds the tokens and verifies proofs generated byNoirJS
on the frontend with theVerifier
contract.
The following figure illustrates the application's architecture:
-
Create a smart contract from the circuit.
-
Frontend:
- Constantly polls the geolocation of the player (represented in seconds, 1' ~ 30 meters)
- Generates the proofs for the private inputs.
- Allows the player to try and claim the tokens off the contract.
-
The holder contract tries to verify the proof calling
verify
method on the verifier contract.
The idea was to use a mobile app to interact with the game, however it proved more complex than initially anticipated. Had there been more time to hack the project, we’d have definitely gotten the mobile application working but for now it works as a web app. We used ionic
and capacitor
which works for both web apps and mobile apps.
The frontend constantly polls the players’ geolocation allowing them to try and claim the tokens from the Holder
contract. If the coordinates submitted are correct, all locked ETH is sent over to the player.
The GPS coordinates are converted from the standard form of degrees, minutes and seconds into seconds. The advantage of doing so is that one second approximately equates to 30 meters. So the tokens are placed in a rough square of 30x30 meters.