Skip to main content

U'Mint L2 to L1 Private Bridge

Summary

This is a use-case where airdrops, staking and similar is done on Coinweb. The users can at any point "cash out" their tokens on L1 if the L2 version of their token is staked.

In this use-case the tokens are associated with some centralized use-case like a game or similar which ultimately controls issuance of the token.

A private bridge is operated by the centralized entity which bridges a private state root for the L2 state into an L1 contract.

Goals
  • Reduce the fees for airdrops and staking by moving this into L2.
  • Move the cost of "cashing out" into L1 to the users that accept the fees.
  • Consolidate the bridging into writing a single root hash regularly into L1.
  • Immediate minting (flash minting) of NFTs at L1 that are usable within a single transaction.

Introduction

In this use-case we assume that there is an issuer of tokens which issues NFTs or tokens at L2. This entity runs a private bridge without collateral as it is assumed that:

  1. If the entity fails to bridge correctly, this entity ultimately controls the utility of the NFTs (say game NFTs with associated features).
  2. The entity uses the L2 as source of truth.
Add-ons

This use-case can be combined with the token shield for managing security breaches in the private bridge.

It can also be combined with offering non-custodial staking of L1 NFTs

The NFTs are constructed using a set of contract modules (JS), that have on-chain and off-chain code.

The Coinweb NFT implementation used supports airdrops and staking.

There are smart contracts at L1 that will mint NFTs given a merkle proof that the NFT is in the set of staked NFTs. The root hash is regularly updated by the private bridge. Updating this root is the essence of the private bridge.

There is an Coinweb reactive smart contract that monitors the L1 contract such that whenever the root hash is updated by the private bridge component, it is matched against a similarly computed merkle root hash computed by the Coinweb reactive smart contract.

Whenever the L2 NFTs are staked, the smart contracts managing the process will incrementally update the merkleized root of all staked NFTs.

Only staked NFTs can be moved to L1. A variant is to lock the L2 NFT (short term staking) in order to move it into L1.

When an L1 NFT is minted successfully by providing a proper merkle proof, this is picked up by the L2 reactive smart contract and the NFT is automatically unstaked.

Waiting periods and similar can be implemented in the L1 contract if needed.

The core mechanism

The core mechanism in this use-case is to compute a merkleized set of "eligible" NFTs that can be moved to L1, either through staking or locking, and allow the minting of these in a single L1 transaction.

The trade-off is that the NFTs will be immobilized at L2 while being immediately available at L1.

The interval for updating the state root in the L1 smart contract is tuned to match the unlocking staking duration.

note

See Whack-A-Mole optimistic bridge for the opposite trade-off where NFTs would not be immobilized at L2 but would not be released within a single transaction at L1.

plantuml