NFT minting
Minting an NFT is the act of bringing it into existence on-chain — creating a new token id and assigning its first owner. In the contract it is a call to an internal _mint(to, tokenId) that writes the owner into storage and emits a Transfer event from the zero address, which is how indexers recognize a brand-new token. 'Minting' usually refers to the public moment a collection lets people pay to create and claim their pieces.
Real mints layer mechanics on top. Allowlists (also called whitelists) restrict early minting to eligible addresses; the gas-efficient way to prove eligibility is a Merkle proof — the contract stores only a Merkle root, and each minter submits a proof that their address is a leaf, rather than the contract storing thousands of addresses. Reveal mechanics hide the art until after the sale: the contract serves a placeholder tokenURI, then the team flips a baseURI to expose the real metadata, ideally with a randomized offset so no one can mint-snipe the rare traits by knowing which token id maps to which image in advance.
Popular mints create congestion known as gas wars: many people broadcast minting transactions at once, all bidding up the gas price to be included first, so fees spike and losers pay gas for failed transactions. Mitigations include Dutch auctions (price starts high and falls, smoothing demand), per-wallet caps, and gas-optimized minting like the ERC-721A implementation, which lets a buyer mint several tokens for close to the cost of one by deferring per-token bookkeeping. Lazy minting flips the cost entirely: the NFT is only actually written on-chain when it is first bought, so the creator pays nothing up front.
function mint(bytes32[] calldata proof) external payable {
require(msg.value == PRICE, "wrong price");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(proof, allowlistRoot, leaf), "not allowlisted");
_mint(msg.sender, ++nextId);
}Allowlisted mint proving eligibility with a Merkle proof.
Minting writes a new token; it is the 'from zero address' Transfer that marks creation. Allowlists and reveals are conveniences layered on top — none of them are required by ERC-721 itself.