- Loopring zkRollup now supports NFT minting, trading, and transfers, directly on L2.
- Any NFT minted on L2 can be withdrawn to L1.
- Both ERC1155 and ERC721 NFT token standards are supported.
- L1 NFTs can be deposited to L2.
- No restrictions: all L2 accounts can mint NFTs.
- NFT support will be available as part of the Loopring 3.6.2 release end of August 2021.
- Loopring is exploring use-cases + partnerships to help bring NFTs to the next level on Ethereum L2.
We are very excited to announce that Ethereum’s first and longest running zkRollup will now support NFTs. Loopring L2 will provide a smooth NFT experience, allowing anyone to mint and trade NFTs instantly and gas-free while maintaining complete Ethereum self-custody security.
NFTs have been all the rage over this past year and it’s clear that — like much else — Ethereum is leading this phenomenon. Ethereum has opened up the door for artists and creatives to sell their work in a permission-less fashion and create non-intermediated connections with their fans. With that being said, creators have largely been limited to selling high-value pieces to offset high L1 gas costs. L2s will enable lower-priced items to flourish, opening up the NFT market for all price levels and thus allowing more users to participate.
And of course, it is not just art. We increasingly lead digital lives, and the relationships, communities, and possessions we care about continue to move from the physical to the virtual. Ownership of provably unique digital goods is a leap forward for society, and a foundational piece for the coming metaverse. A matter of such importance must be anchored to the most secure, decentralized, and credibly neutral environment — and that is Ethereum.
Of course, we believe the future for users and applications is primarily on L2, with Ethereum L1 as the base settlement layer. Of all the Layer 2 solutions, ZKP-based solutions are best served to scale NFTs without compromising on UX or security. Unlike Optimistic Rollups, where users must wait to withdraw NFTs after a challenge period, zkRollup users can shave off unnecessary waiting times by withdrawing NFTs in the next block. And unlike sidechains, zkRollups inherit Ethereum security guarantees, not relying on new, concentrated validator sets.
How it works
We store the following data for each NFT:
- Minter: The Ethereum address of the minter
- Token address: The contract address of the NFT contract on L1
- NFT type: The token standard followed by the NFT contract on L1
- NFT id: The NFT identifier
- Creator fee: Currently unused in the protocol, can be used to signal how much royalties the creator should get.
When minting on L2, the protocol only ensures that the minter address is the address of the L2 account that minted the NFT. All other NFT values can be chosen freely by the minter. This means that anyone is able to mint NFTs for any token contract. However, NFTs are only authentic when they were minted in a way that will be accepted by the NFT contract when they are withdrawn to L1 (see below).
NFTs minted on L2 can be withdrawn to L1 if the NFT token contract implements the
mintFromL2 function. This function will be called when the NFT is being withdrawn. Here the NFT contract decides which NFTs that were minted on L2 are authentic or not. The most obvious way to do this is to check if the minter of the NFT is an address that was authorized to mint NFTs on L2. The NFT contract is free however to impose any rules it wants.
NFTs that already exist on L1 can also be deposited. These NFTs will have their minter address set to the token address (an NFT deposit is essentially an approval for the L2 account linked to the NFT token contract address to mint the NFT on L2). All other NFT data will be set to the values of the NFT that was transferred in. When a deposited NFT gets withdrawn we simply transfer the NFT out of the zkRollup using a standard L1 transfer.
The Merkle tree our zkRollup uses to store data on L2 has 2**16 (65536) token slots that can be used to store balances for each L2 account. Up till now, we reserved a specific slot for each ERC20 token, and so the token address of each balance could simply be deduced by the slot in which the balance was stored. This also simplified things a bit because the slot used for a specific ERC20 token is the same for each account.
There is an indefinite number of NFTs however and so we can no longer simply reserve a specific token slot globally. For NFTs we now also store the NFT data next to the balance in the token slot. This way NFTs can be stored in different slots for each account, and a slot in an account is only used up when an NFT is actually stored in it.
And so when transferring an NFT (with a trade being basically 2 atomic transfers) from one account to another the token slot used for storing the NFT may change. A token slot can only be used by an NFT if either the slot is currently unused (the balance is zero) or the same NFT is already stored there (in which case the balance will increase).
We’ve added two additional transactions:
- NFT Mint: Used to create NFTs on L2. Used for minting NFTs and also for processing NFT deposits.
- NFT Data: Used to bring NFT data stored on L2 back to L1 as part of the public data. This makes it easy to access L2 NFT data on L1 when needed.
All other transaction types we already supported remain practically the same. Existing transaction types for trading, transferring, and withdrawing needed some small modifications to make them compatible with NFTs because of the differences in how the token slots are used.
We now also support a higher maximum trading fee percentage. In an NFT trade, the trading fee can now be paid in the token being sold (previously the fee always needed to be paid in the token being bought which is not possible when buying an NFT).
L2 zkRollups welcome a new era of possibilities for NFTs that go far beyond jpegs. A fast, cheap and secure NFT environment enables ample opportunities for creators and developers to experiment in areas like play-to earn gaming, scalable marketplaces, insurance and security, music, global IDs and so much more. We will tap into the infinite potential; this is just the beginning for NFTs on Layer-2.
We’re excited for this new primitive in digital ownership and are exploring potential partnerships to help scale the ecosystem.
Loopring is an Ethereum zkRollup protocol for scalable, secure exchanges & payments. Loopring builds non-custodial, high-performance products atop our layer-2, including the Loopring Wallet — a mobile Ethereum smart wallet, and the Loopring Exchange — an L2 orderbook and AMM DEX. To learn more, you can sign up for our Quarterly Update or see Loopring.org.
Twitter ⭑ Discord ⭑ Forum ⭑ Reddit ⭑ GitHub ⭑ Docs ⭑ YouTube ⭑ Weibo