I found a way to zero (0) Gas Batch Minting for any number of token

new Implementation of ERC721 that removes minting fee or no transaction fee minting.(ERC721FancyMint.sol)

As of today there is two way to mint ERC721 NFTs:

  1. lazy minting or just in time minting.
  2. pay the minting fees your self and list them.

I created a way to mint arbitrary number of NFT with no minting fee.

how other ERC721 works?

at the heart of any ERC721 there is data storage that hold what token(token Id number) belongs to which Ethereum address.

  • this is a “Mapping”, Mapping is like a kind of magical table/record, it has a default value for every possible entry.
    the default value for addresses are address(0).
  • as people mint tokens, contract populates the mapping with user address.

An ERC721 contract have to determine which tokens exist.

  • for example in ERC721 Implemented by OpenZeppelin the Rationale behind token existence is if a token owner address is 0x000…0000 (also called address(0)) this token does not exist, if anything else the token is exist and owned by that address.

in the image above only the tokenID 0, 1, 2 are exist.

my Implementation:

This implementation I need to introduce you to 2 new parameter.

  1. MaxSupply: total number of token that we want to mint(it can be any number without increasing transaction fee)
  2. preOwner: the address that we want to mint maxSupply of token to.(maybe the creator)

This Implementation uses a new abstraction for token existence, instead of checking token owner not being address(0) to exist, it check if a token Id is less than MaxSupply it exists, and if the token owner is any address beside address(0) it belong to that address, if the owner was address(0) it belongs to preOwner.

also at deployment make the balance of the user equal to MaxSupply.

In this way preOwner have MaxSupply number of token in their wallet.

Example: If we create a collection with this implementation with the MaxSupply of 999, token 0 to 998 would be exist.

If you want to know more about the Implementation please look at the following links:

  1. Ethereum Magicians:Idea : minting one billion NFTs or 2^256
  2. Ethereum Magicians: EIP Draft : mint arbitrary number of tokens(ERC-721) via EIP-2309
  3. GitHub: EIP-draft_ERC721FancyMint.sol


  1. no minting fee for any number of token.
  2. users can view the tokens before owning them.
  3. tokens are accessible trough all Ethereum platforms at the same time.

Deployed on the mainnet.

Fancy Project : Premeium

I created a collection around this. it has 999 item and the art is on-chain SVG.
and I list them in different market places. something that you can’t do with marketplaces lazy minting contract.
OpenSea Link

LooksRare Link

UniSwap NFTs

and as I promised they all minted with no transaction.

etherscan link

the current implantation of manifold has max gas limit of 12 million or 200 token per transaction.

but this way you can bring down the gas usage to zero for any number of token.

you can see that it only used around 4 million gas for contract deployment, that has 999 NFT (it can be one billion NFT, the contract does not care)

the magic happens all with the help of EIP-2309 the consecutiveTransfer event(event is a thing that notify other application that there is something to check for) instead of simple one by one transfer.
consecutiveTransfer of token 0 - 998, are in the transaction log

Fancy Project : Premeium is fully compatible with IERC721 and IERC721Enumerable by using ERC721FancyMint and ERC721FancyMintEnumerable (ERC721FancyMIntEnumerable is a bit too long to explain here)
code: Github-Fancy_project_premium

1 Like

Wow :star_struck: this is interesting. Are you a developer yourself?

1 Like

yes, I’m a developer and thank you for taking time to read this Implementation.


May I send you a DM?

Of course, I’ll be glad.