# 🎨 What is an NFT ?

If ERC-20 tokens represent **fungible** assets like money or points, **NFTs** are their **unique, one-of-a-kind cousins**.\
They’re the digital collectibles, membership passes, and proof-of-ownership certificates that power much of Web3 today.

Let’s unpack what that actually means 👇

### 🧩 NFT in Simple Terms

**NFT** stands for **Non-Fungible Token**.

* **Non-fungible** means it **can’t be replaced** by another identical item.
  * A dollar bill? Fungible — any other $1 bill is the same.
  * A rare baseball card? Non-fungible — it’s unique.
* **Token** means it’s a **digital asset on a blockchain**, just like an ERC-20 token.

Put together, an NFT is a **unique digital certificate stored on the blockchain** that proves you own something — digital or even physical.

### 🎟️ What NFTs Can Represent

NFTs are like digital wrappers that can point to almost anything:

* 🖼️ **Digital art** (like the ones sold on OpenSea or Foundation)
* 🎧 **Music, videos, or animations**
* 🕹️ **In-game items** (skins, weapons, land plots)
* 🎟️ **Tickets or membership passes**
* 🏠 **Real-world assets**, like deeds or certificates
* 🧾 **Receipts or credentials** (like a diploma stored on-chain)

Essentially, **NFTs turn ownership into code.**\
Instead of trusting a database or platform, the blockchain becomes your proof of authenticity.

### ⚙️ The ERC-721 Standard

Most NFTs on Ethereum follow the **ERC-721** standard — introduced after ERC-20.\
While ERC-20 focuses on *interchangeable tokens*, ERC-721 focuses on *unique ones.*

#### Core ERC-721 Functions

| Function                                  | Purpose                                      |
| ----------------------------------------- | -------------------------------------------- |
| `ownerOf(tokenId)`                        | Returns who owns a specific NFT              |
| `balanceOf(address)`                      | Shows how many NFTs an address holds         |
| `transferFrom(address, address, tokenId)` | Moves ownership of an NFT                    |
| `tokenURI(tokenId)`                       | Returns metadata (e.g., image, name, traits) |

The `tokenURI` is what links your NFT to off-chain data — like an image stored on **IPFS** or **Arweave**.

### 🧠 Example in Code

Here’s a tiny NFT contract using OpenZeppelin:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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

contract CheeseArtNFT is ERC721 {
    uint256 public nextId;

    constructor() ERC721("Cheese Art", "CHEESEART") {}

    function mint() external {
        _safeMint(msg.sender, nextId);
        nextId++;
    }
}
```

Each time you call `mint()`, it creates a **unique token** with a new `tokenId`.\
No two CheeseArt NFTs are the same — even if they look alike 🧀🎨.

### 🌐 Why NFTs Matter

NFTs gave us a way to **own and trade digital assets** without needing permission from centralized platforms.

They enable:

* **Digital property rights** → verifiable ownership on-chain
* **Creator royalties** → artists earn from secondary sales
* **Interoperability** → same NFT can be used across apps or games
* **Identity and membership** → NFTs as access keys to communities or events

It’s less about “JPEGs on a blockchain” and more about **programmable ownership.**

### 💡 ERC-1155: The Hybrid Standard

There’s also **ERC-1155**, a newer, more flexible standard that supports **both fungible and non-fungible** tokens in one contract.\
It’s often used for **gaming** and **multi-asset collections** — think bundles of weapons, tickets, or currencies all managed together.

### 🏁 Final Thoughts

NFTs are the evolution of digital ownership.\
They make items **verifiable, portable, and programmable**, unlocking a world of new possibilities — from art and gaming to identity and beyond.

So next time someone says, “Why would anyone buy a JPEG?”\
You can tell them: it’s not just a JPEG — it’s **a tokenized piece of digital history**.
