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

NftGatedUnityExperiences

A NFT gated experience with Lit protocol for Unity Games with a safe webgl files management

NftGatedUnityExperiences

Created At

ETHOnline 2022

Project Description

A Unity webgl game build consists of 4 files: .data.js .framework.js .loader.js .wasm

The idea behind this project is to use the Lit Protocol feature that allows you to encrypt files, in this case the wasm file, and then to create a condition that allows decryption using a signature , a condition ( for example if you have or not an NFT ) and a symmetric key string.

If you are are able to decrypt ,it is possible to play the unity game, otherwise it is not possible.

In this way , you can publicly expose the .wasm file that no resides on the server but on the client in public folder, but encrypted. And only at the time you want to play that Lit protocol decrypts it if the condition is met.

How it's Made

This project is made using : I used Nextjs tecnology to scaffold the app.

Then Lit protocol tecnology , to manage the wasm file for encryption and decryption, and for gating the game with a control access condition that checks on mumbai or polygon if the user is respecting on chain the Lit condition set.

The app use also the Lit protocol feature related the getSignedToken method in order to get a jwt token useful to login to the Unity game protected page: const litjwt = await client.getSignedToken({ accessControlConditions, chain, authSig, resourceId: resourceId })

Polygon chain in order to manage the NFTs that allow or not the decryption process managed by Lit.

background image mobile

Join the mailing list

Get the latest news and updates