Proof of concept: minting 2**256 -1 ERC721 with IERC721Enumarable capability

Limits of NFT(ERC721Enumerable) or Minting 2^256 - 1 NFT

warning:

these contract have been altered for proof of concept and they are different than the proposed Implementation. please see this link to learn more about mechanism and rationale

Abstract

The upper limit of totalSupply of any ERC721 contract or how many NFT can be minted, is determined by the EIP-721 is uint256 number.

so the upper limit for totalSupply is this number:

115792089237316195423570985008687907853269984665640564039457584007913129639935

In my Implementation proposal I’ve talked about how this can be reached:

see the implementation here

See the project in Action:

I’ve deployed a contract on goerli for proof of concept.

goerli Limits of NFT: 0x6d04C3F8e618a2404803Ca72f5dF93f4F50CaD45

this token is Fully IERC721 and IERC721Enumerable compatible.

I highly recommend you try it for yourself.

from blanceOf() to ownerOf()

even tokenOfOwnerbyIndex().

try it for yourself

All of these tokens are minted to “giver” contract that you can grab one for yourself.

  1. by calling the getToken() you will get a token from index of 0 of the preOwner(giver address).

  2. by calling the getTokenInd(Index) you will get a token from index of Index of the preOwner(giver address).

giver goerli : 0x65c94c08Dd504a199fE61C3D29ca01784C7081aF

URI:

for proof of concept this contract have an SVG Image with tokenId on it.

the Image:

conclusion:

this project shows:

  1. limit of uint256 for totalSupply for ERC721 can be reached.

  2. zero transaction minting is possible.

  3. batch minting via EIP-2309 and IERC721Enumerable is possible.

please join the disscussion:

Ethereum magician: Use zero gas(0 gwei) for minting any number of NFT

1 Like

OpenSea appears to stop indexing at 5000.

https://testnets.opensea.io/assets/goerli/0x6d04c3f8e618a2404803ca72f5df93f4f50cad45/5000

OpenZeppelin use a 5000 maximum limit for this purpose:

1 Like

yeah, I know about this limit
so I’ve wrote this function

uint256 private emitCounter = 1;

 // in case the marketplace need this
    function emitHandlerSingle() public {
        emit ConsecutiveTransfer(
            emitCounter * 5000,
            emitCounter  * 5000  + 4999,
            address(0),
            preOwner_
        );
        emitCounter++;
    }

PS: I made a typo on the contract in the contract this is the what I think solves the problem :shushing_face:
the problem will be solved with this function.
I know it’s not it’s not feasible to call it 2*256/5000 times but I’ve tried it in bundle of 100 consecutiveTransfer event with gas around 500k another TX and looksrare kept resolving them till 530K Item then they stopped it.


I think marketplace indexer should propose another limit like a daily limit or something else 5000 is a bit small I think.

@abcoathup
also, a really important question, is it possible to use ERC721Consecutive.sol and ERC721Enumerable.sol at the same time?
my guess is no because of this part from ERC721Consecutive:

IMPORTANT: This extension bypasses the hooks {_beforeTokenTransfer} and {_afterTokenTransfer} for tokens minted in
 * batch. When using this extension, you should consider the {_beforeConsecutiveTokenTransfer} and
 * {_afterConsecutiveTokenTransfer} hooks in addition to {_beforeTokenTransfer} and {_afterTokenTransfer}.
 *
 * IMPORTANT: When overriding {_afterTokenTransfer}, be careful about call ordering. {ownerOf} may return invalid
 * values during the {_afterTokenTransfer} execution if the super call is not called first. To be safe, execute the
 * super call before your custom logic.
 *