PROBLEM
A problem faced within the Ethereum blockchain as well as Layer 2s is the segmentation of assets, especially NFTs. When an NFT is created on a Layer 2, the NFT is stuck on that layer. This leads to the problem of NFT silos, where NFT assets on Layer 2 cannot be withdrawn to Layer 1. Having a way to create and transfer NFTs across multiple layers is important in order to introduce NFT applications to Layer 2s.
SOLUTION
Create a way to easily transfer NFTs across layers and reduce the gas requirements by minting the NFTs on Layer 2. This lets the user decide when they would like to withdraw their NFTs to Layer 1.
OVERVIEW DIAGRAM
Initializing the NFT Contracts
- The Owner will provision the L1_NFT_Collection with the deployed L2_NFT_Collection, specifying:
- Address of the L2_NFT_Collection
- Chain ID of the L2_NFT_Collection
- Location of the NFT, mapping of the Chain ID by the NFT ID
- Range of Allocated NFTs, e.g. #1-100, 60-61, etc.
Range is a unit of 1000 NFTs… rangeid 0 means NFT #0 to NFT #999.
Data Structure
Claiming the NFT on Layer 2
- The User will claim the NFT, specifying the NFT ID. The L2_NFT_Collection contract on Layer 2 will verify the ID assignment (i.e. this Layer 2 owns the NFT) and mints the NFT on this rollup accordingly. Users can freely transfer NFTs within the rollup as normal.
Withdrawing an NFT
- The User sends a transaction to the L2_NFT_Collection smart contract, initiating the withdrawal to a target recipient on Layer 1.
- The NFT gets deposited into the L2_Deposit contract, which locks the NFT for later retrieval if necessary.
- The Locked NFT triggers a cross-message to the L1_NFT_Collection which allows the designated recipient to mint/withdraw the NFT on Layer 1.
- A new record in L1_NFT_Collection will be added to update the chain ownership of this particular NFT, data structure:Â
mapping(id=>chainid) nft_loc;
Ânft_loc
 always overridesÂrange_loc
. To determine the actual chain ownership of a NFT, the logic should checkÂnft_loc
 first thenÂrange_loc
 ifÂnft_loc[id]
 returns 0. - If the NFT was already previously minted on Layer 1 before, i.e. it is not the first time this NFT has been withdrawn to Layer 1, the user would get that NFT with the updated metadata, with itsÂ
nft_loc
 updated.
- The recipient will claim the NFT, specifying the NFT ID.
(Re)depositing the NFT on Layer 2
- The User sends a transaction to the L1_NFT_Collection smart contract, initiating the transition to a target recipient on a target Layer 2 rollup.
- The NFT gets deposited into the L1_Deposit contract, which locks the NFT for later retrieval if necessary.
- The Locked NFT triggers a cross-message to the L2_NFT_Collection, which allows the user to mint/claim an existing NFT on Layer 2 by the NFT ID.
- If the NFT was already created and was deposited to the target rollup, the user would receive the NFT with the updated metadata.
- L1_NFT_Collection will haveÂ
nft_loc
 updated to reflect the updated chain ownership of the NFT.
SEQUENCE DIAGRAMS
Provisioning
Layer 1 => Layer 2
Layer 2 => Layer 1
PROS & CONS
Pros
- Allows any user to claim an NFT on another Layer 2.
- The User can withdraw the NFT on Layer 2 and have the equivalent NFT created on Layer 1 with no chance of duplication.
- The User has the option to transfer their created NFT at any time from Layer 1 to Layer 2 and vice versa.
- Allows one NFT project to extend to multiple rollups.
- Easy and low-cost initial setup.
Cons
- The Owner has to create an equivalent NFT contract on the supported layers.
- NFTs can only move from Layer 2 to the coordinator chain (Layer 1 in this case) and back, they cannot move from Layer 2 to Layer 2 directly.
- Higher cost when moving NFTs among rollups because of the involvement of two Layer 1 transactions (withdraw and deposit)
- Technical complexity to connect both Layers
EXTENSIONS
Using a rollup to track the chain ownership to reduce the transaction cost
A rollup can be used to manage the chain ownership. In this way, the transaction cost can be greatly reduced. Layer 1 in this case can be treated the same as other rollups to some extent.