> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theblockchainlibrary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ERC-721 NFT Contract

> A simple non-fungible token (NFT) contract with minting functionality.

# ERC-721 NFT Contract

A simple non-fungible token (NFT) contract with minting functionality.

A simple non-fungible token (NFT) contract with minting functionality.

## Explanation

This contract creates a basic NFT collection.

**How it works:**

* Uses a `Counters` library to auto-increment token IDs.
* Each `mint()` call creates a new unique token assigned to `recipient`.
* Inherits all ERC-721 standard behavior from OpenZeppelin.

In production, you'd add token URI management (metadata), mint price, and supply limits.

## Code

```solidity theme={null}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract SimpleNFT is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() ERC721("SimpleNFT", "SNFT") {}

    function mint(address recipient) public returns (uint256) {
        _tokenIds.increment();
        uint256 newTokenId = _tokenIds.current();
        _mint(recipient, newTokenId);
        return newTokenId;
    }
}
```

***

**Canonical knowledge ID:** `code-example:erc-721-nft-contract`
