NFTGuessr: gaming web3 EVM with FHE
Will you find NFTs around the world?
Game like GeoGuessr base on EVM with Fully Homomorphic Encryption.
For now, the game is available and in development on the Zama devnet. When the Fhenix blockchain is available, a migration will be performed.
What’s EVM ?
EVM stands for Ethereum Virtual Machine. It enables the development of decentralized applications using smart contracts written in the Solidity programming language.
What’s FHE?
FHE stands for Fully Homomorphic Encryption. It is an advanced encryption technique that allows computations to be performed on encrypted data without decrypting it first. In traditional encryption systems, data is encrypted for privacy during storage or transmission but must be decrypted before any meaningful computation can be performed. Fully Homomorphic Encryption, however, allows operations such as addition, multiplication, and more to be directly applied to the encrypted data, producing results that, when decrypted, match the result of applying the same operations to the unencrypted data.
Zama has developed an FHE solution on the EVM.
Fhenix, which will be a blockchain entirely encrypted using Zama’s FHE.
Game rules
You are projected onto a Google Maps Street View.
The goal is to find where you are located in the world (around 5km2). To inquire if it’s the correct location, it will cost you 1 Zama.
If you find the location, you will receive the corresponding NFT GeoSpace and 1 token SpaceCoin.
Then, several options are available to you:
- either you put the obtained NFT back into the game with your own tax.
2. You can stake 1 nft and you receive a daily reward (1 token SpaceCoin) and accumulate NFTs until you have 3, stake them, and unlock the right to create GPS points with your own tax.
Profil view:
To create new GeoSpace NFTs, it will cost you 1 SpaceCoin.
If you are a creator, then you will receive a share of the creation fees on SpaceCoin distributed among all the other creators.
Technical Explication:
The smart contract is developed in Solidity with the use of FHE. It is sufficient to import the TFHE library into the Solidity file:
import "fhevm/lib/TFHE.sol";
Then, we have access to new variables like:
euint32
It is with this that I will record the GPS points like this:
struct Location {
euint32 lat;
euint32 lng;
}
- A function to create the NFT for and staker and the owner of the smart contract .
- A function to verify if a user is within the 5km2 of the NFT location. If yes, then an NFT transfer will be made from the smart contract to
msg.sender
. - Functions to stake / unstake NFTs.
- Functions to put or cancel the NFT back into play with a tax.