In our post about lazy minting vs. gasless minting, we discussed the need for a layer 2, like ImmutableX or Polygon, to do true gasless minting. There are a few platforms out there claiming to do gasless minting directly on the Ethereum blockchain, such as Mintable. We at Cloud3 Labs were curious about these claims and wanted to take a deeper look at how this could be possible. We had our team of experts deep dive into how Mintable implements this functionality, so you don’t have to. We found that the actual end result is closer to lazy minting than true gasless minting. This article will dig deeper into how platforms like Mintable can offer “gasless minting" directly on Ethereum.
TLDR:
Fair warning for our non-technical users out there, this one might get a bit in the weeds. In a summary, Mintable allows an NFT creator to mint an NFT without paying for gas to change contract state on the Ethereum network. Mintable's definition of "minted" is that the NFT contract returns the NFT creator's ETH address as the owner of that NFT. Mintable does this by putting the user’s address into new NFT token IDs and providing a centralized place to store this info. Gas is only paid when the NFT is sold or transferred, usually by the buyer of the NFT. However, when an NFT is "minted" through Mintable's gasless minting, there are other on-chain records that aren't updated until the first transaction is made (and gas is paid). Because the NFT isn't fully recorded on-chain after it's minted and before it's first transferred, we assert that Mintable's gasless minting is more similar to lazy minting than a true gasless minting experience.
Making use of ‘ownerOf()’ and ‘tokenURI()’
Mintable’s implementation for gasless minting takes advantage of the fact that to find out if an NFT exists, most wallets and services rely on responses sent back from the ‘ownerOf()’ and ‘tokenURI()’ methods in the NFT contract. This is enough to claim that an NFT has been minted (e.g. for adding the NFT to a compatible wallet like MetaMask), even if the on-chain state wasn’t changed to mint the NFT.
The tokenID for a new token is the creator’s address concatenated with a unique integer ID. This means that the ‘ownerOf()’ method can just return the first part of the passed-in token ID if the token isn’t yet seen on-chain. This effectively tells callers the token ID is owned by the creator.
The ‘tokenURI()’ method uses a centralized base URI (https://metadata.mintable.app/mintable_gasless/), which has the token ID appended to it. This means Mintable can easily update hosted metadata off-chain without minting the token.
Your NFT is “kind of” minted
Using the above gives you some features of gasless minting; however, not all behavior is the same as if the NFT was actually minted on-chain. The ‘balanceOf()’, ‘tokenOfOwnerByIndex()’, and ‘tokenByIndex()’ methods don’t work for a token ID until that token has a full record on-chain, because these methods rely on data that must be updated on-chain. For Mintable’s implementation, the NFT isn’t minted on-chain until it is first transferred. At this point, the person transferring the NFT would pay the gas fee for minting the NFT.
So although Mintable's claim of gasless minting on Ethereum is “kind of” correct, the minted NFT doesn’t hold the same behavior as an NFT minted on-chain until it's transferred. Also, someone will eventually have to pay gas to complete the on-chain record for the NFT, this cost is just deferred until the first time the NFT is transferred.
Overview
Based on our deep dive into how Mintable and others claim to offer gasless minting on Ethereum, we feel confident that the only way to achieve true gasless minting would be by utilizing a layer 2. The gasless minting that Mintable and similar platforms offer looks more like lazy minting than gasless minting.
If you want to create an NFT project, look no further than Cloud3 Labs. Launch and manage your next NFT project on our platform without the need to write a single line of code. We have lazy minting built-in along with ways to save you money on deploying your smart contract. If you're interested in using Cloud3 Labs to launch your next NFT project, schedule some time to talk to one of our experts today!