ERC721F
The goal of ERC721F is to provide a simple extension of IERC721 with significant gas savings for minting multiple and single NFTs in a single transaction. This project and implementation will be updated regularly and will continue to stay up to date with best practices. Another key goal of ERC721F is to facilitate educational opportunities for new web3 developers, fostering a supportive learning environment and driving innovation within the community.
ERC721F extends ERC721 Non-Fungible Token Standard basic implementation. ERC721F eliminates the need for ERC721Enumerable, yet retains the functionality of totalSupply() and walletOfOwner(address _owner).
The Author is not liable for any outcomes as a result of using ERC721F. DYOR! ERC721F is created and maintained by Frank Poncelet (FrankNFT.eth)
Learning Path
ERC721F ships a set of progressively more advanced example contracts designed to onboard new Solidity developers step by step. Each example builds on the previous one and introduces exactly one new concept.
| Step | Contract | Concepts introduced |
|---|---|---|
| 1 | examples/FreeMint.sol |
Basic ERC721F usage, ERC-2981 royalties, EOA-only guard |
| 2 | examples/AllowList.sol |
Utility mixin pattern, multiple inheritance, allowlist modifier |
| 3 | examples/AllowListWithAmount.sol |
Per-address mint quota, internal state decrement |
| 4 | examples/MerkleRoot.sol |
Merkle-proof whitelisting, pre-sale / public-sale state machine |
| 5 | contracts/token/soulbound/Soulbound.sol |
Non-transferable tokens, EIP-5192, EIP-6454 |
| 6 | examples/OnChain.sol |
On-chain SVG metadata, EIP-4883, string assembly |
| 7 | examples/OnChainOptimized.sol |
Bitfield trait packing — advanced storage optimization |
| 8 | examples/ChainLink.sol |
External oracle integration, Chainlink VRF callback pattern |
| 9 | examples/EIP-2535/ |
Diamond proxy (EIP-2535), upgradeability, facets |
Gas benchmarks comparing ERC721F against OpenZeppelin ERC721Enumerable are in
BENCHMARK.md.
Roadmap
- Add more documentation on benefits of using ERC721F
- Continue to try to reduce gas costs
- Start automated testing
- Put package under Agentic AI control
See the open issues for a full list of proposed features (and known issues).
Security
Please refer to SECURITY.md for our security policy and how to responsibly report vulnerabilities.
Usage
Installation
npm install @franknft.eth/erc721-f
Requirements
- Solidity:
^0.8.20 <0.9.0(the toolchain compiles with0.8.24) - Node.js:
>=24 - OpenZeppelin:
5.7.0
Just import the file from the package like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20 <0.9.0;
import "@franknft.eth/erc721-f/contracts/token/ERC721/ERC721FCOMMON.sol";
contract Example is ERC721FCOMMON {
constructor() ERC721FCOMMON("Example", "Example", msg.sender) {
setBaseTokenURI(
"ipfs://QmVy7VQUFtTQawBsp4tbJPp9MgbTKS4L7WSDpZEdZUzsiD/"
);
}
/**
* Mint your tokens here.
*/
function mint(uint256 numberOfTokens) external {
require(msg.sender == tx.origin, "No Contracts allowed.");
uint256 supply = totalSupply();
for (uint256 i; i < numberOfTokens; ) {
_mint(msg.sender, supply + i); // no need to use safeMint as we don't allow contracts.
unchecked {
i++;
}
}
}
}
Or just import the file directly from GitHub like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20 <0.9.0;
import "https://github.com/FrankNFT-labs/ERC721F/blob/v5.7.0/contracts/token/ERC721/ERC721FCOMMON.sol";
Contributing
See CONTRIBUTING.md.