Cross-Chain Token Gating

0xEssential's Cross-Chain Token Gating enables developers to build cross-chain experiences that use L1 NFTs on EVM L2 or sidechain networks without bridging.

Introduction

0xEssential provides open-source software and permissionless services that allow developers to deploy Layer 2 contracts that depend on trust-minimized Layer 1 NFT ownership data.

Instead of users bridging NFTs between chains to use them in games or other contracts, 0xEssential's approach uses meta-transactions and trust-minimized offchain data fetching based on EIP standards to offer a superior developer and user experience.

dApp developers can use our client SDK to gather EIP-712 meta-transaction signatures from users. Those signatures must be routed through a relaying service backend - we provide deploy-ready OSS for this step, but developers are responsible for providing infrastructure - your own backend, or a SAAS service like OpenZeppelin Defender.

The relayer can call 0xEssential's deployed EssentialForwarder contract, or developers may deploy their own version. NFT ownership data is fetched via EIP-3668 OffchainLookup - 0xEssential provides an open and standards based HTTPS RPC API that integrates with our OSS contract and relayer.

Finally, developers must inherit our EssentialERC7221Context primitive in their implementation contract. This allows the contract developer to use _msgSender() and _msgNFT() functions to get verified data about the L1 NFT being used and its owner inside their Layer 2 contract functions.

Use cases

Token gating is when a contract or dApp restricts access to users who own a certain token. 0xEssential's toolkit allows developers to write smart contracts on Layer 2 or sidechain EVM networks that can restrict access based on a caller's ownership of an NFT on Ethereum mainnet or other EVM chains.

Simply put - you can deploy a contract to Polygon that uses L1 NFTs.

Gaming

On-chain games are too expensive on Layer 1. Write your games on a more efficient chain, but let users keep their NFTs on mainnet. Only the token owner can use the NFT to take a game move.

Governance

Use a cheaper chain for voting, but restrict voting to holders of your L1 NFT, and ensure each NFT gets one vote.

Raffles

If you're doing a giveaway for your L1 NFT community, increase trust by doing an onchain raffle with verifiable randomness, while keeping your costs reasonable by using a scalable EVM chain.

Airdrops

If you're giving your community a derivative NFT, cross-chain token gating is a great way to let users claim, especially for more ephemeral tokens like event tickets or mint passes.

Status & Supported Networks

0xEssential's cross-chain token gating is deployed on Polygon's Matic mainnet and Mumbai testnet, while the cross-chain ownership data supports NFTs from any EVM chain. You can currently deploy contracts for games or other projects to Polygon that gate transactions based on NFT ownership from any EVM chain, such as mainnet.

We plan to deploy to additional EVM chains - let us know which EVM networks you'd like to see next. We also plan to support verified ownership of NFTs from alternative L1 chains like Solana in the long term.

0xEssential's contracts have not been audited. The risk profile is extremely low, but if you plan on building experiences that use cross-chain token gating in a manner that has large financial implications, we suggest waiting until we receive an audit.

0xEssential's contracts may also be too inefficient for your budget. Meta-transactions require that the developer pays for the user's transaction fees. Using an L2 or sidechain reduces transaction fees overall, but we need to do some gas golfing to reduce the cost of verifying signatures and ownership proofs.

Our Ownership RPC API is also in beta - we do not offer any uptime guarantees. In the future 0xEssential may decentralize this portion of the solution, where 3rd party developers may run instances of this API in a decentralized pool. You are free to clone our software and run your own RPC API.

The source code we provide for using OpenZeppelin Defender Autotasks as your relaying service is also in beta. We plan to reduce the amount of custom error handling as EIP-3668 is supported by more libraries and nodes. In the future 0xEssential may develop our own SAAS service for relaying cross-chain token gated meta-transactions.

Finally, 0xEssential's client SDK is in beta. The current version depends on ethers - we'd like to support other web3 JS libraries, and will need to ensure our extension remains compatible with the imminent ethers v6.

GOTO Code

If you're ready to start diving through some docs and code, head over to our Quick Start guide or visit 0xEssential's Github.

Cross-Chain Token Gating currently supports authenticating NFTs from any EVM chain in contracts deployed on Polygon's Matic Network. We hope to deploy our forwarder to more EVM chains soon, but the rest of the stack is written to support any EVM chain.

Last updated