Geo-Locked NFTs do exactly what they sound like, they are geo-restricted and user can only mint them in specific location, as decided by owner of NFT.
Using FHE i.e Homomorphic Encryption we can send user's encrypted location freely on-chain which was the only barrier previously stopping us from implementing this.
The project "Geo Locked NFT" depicts one of many use cases that FHE unlocks in web3.
- Arbritrum: 0x39DAf5111096520efae34054bfD2A2febA271325
- Base: 0xaa87F6Ff58D587b286a8EE98629D4b5CB2c506A7
- Polygon-zkevm: 0x4097aF75b84D600c2851ea551D5FD7c8D5e07A70
- Fantom: 0x4097aF75b84D600c2851ea551D5FD7c8D5e07A70
- Linea: 0x9dC4638e22936Da7723B4923e0Bfe249d4A7fa62
- Define the bit length of the modulus
n, orkeyLengthin bits. - Choose two large prime numbers
pandqrandomly and independently of each other such thatgcd( p·q, (p-1)(q-1) )=1andn=p·qhas a key length of keyLength. For instance:- Generate a random prime
pwith a bit length ofkeyLength/2 + 1. - Generate a random prime
qwith a bit length ofkeyLength/2. - Repeat until the bitlength of
n=p·qiskeyLength.
- Generate a random prime
- Compute parameters
λ,gandμ. Among other ways, it can be done as follows:- Standard approach:
- Compute
λ = lcm(p-1, q-1)withlcm(a, b) = a·b / gcd(a, b). - Generate randoms
αandβinZ*ofn, and select generatorginZ*ofn**2asg = ( α·n + 1 ) β**n mod n**2. - Compute
μ = ( L( g^λ mod n**2 ) )**(-1) mod nwhereL(x)=(x-1)/n.
- Compute
- If using p,q of equivalent length, a simpler variant would be:
λ = (p-1, q-1)g = n+1μ = λ**(-1) mod n
- Standard approach:
The public (encryption) key is (n, g).
The private (decryption) key is (λ, μ).
Let m in [0, n) be the clear-text message,
-
Select random integer
rinZ*ofn. -
Compute ciphertext as:
c = g**m · r**n mod n**2
Let c be the ciphertext to decrypt, where c in (0, n**2).
- Compute the plaintext message as:
m = L( c**λ mod n**2 ) · μ mod n
