# DeFi Masterclass

**Level: Advanced**\
**Module Title:** _Create & Launch Your Own NFT Collection_

**🧠 What You’ll Learn:**

* What NFTs are and how they work
* Writing ERC-721 compliant smart contracts
* Uploading assets and metadata to IPFS
* Listing your NFTs on marketplaces like OpenSea

**📘 Lesson 1: Understanding NFTs**

NFTs (Non-Fungible Tokens) are unique digital assets stored on the blockchain. Unlike fungible tokens (like ETH or USDC), each NFT has a unique ID and metadata.

Common uses:

* Digital art
* Gaming items
* Virtual land
* Collectibles

**📘 Lesson 2: Writing an ERC-721 Smart Contract**

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

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

contract MyNFT is ERC721 {
    uint public nextTokenId;
    address public admin;

    constructor() ERC721("MyNFT", "MNFT") {
        admin = msg.sender;
    }

    function mint(address to) external {
        require(msg.sender == admin, "only admin can mint");
        _safeMint(to, nextTokenId);
        nextTokenId++;
    }

```

**📘 Lesson 3: Hosting Metadata on IPFS**

Each NFT links to off-chain metadata (image, name, traits) stored on IPFS.

1. Upload your artwork to Pinata or NFT.storage
2. Create a metadata JSON file:

```
{
  "name": "Epic Sword",
  "description": "A rare in-game sword.",
  "image": "ipfs://your-image-hash",
  "attributes": [
    { "trait_type": "Power", "value": 9000 },
    { "trait_type": "Rarity", "value": "Legendary" }
  ]
}
```

3. Upload metadata to IPFS

**📘 Lesson 4: Listing on OpenSea**

* Connect MetaMask to [OpenSea](https://opensea.io)
* Go to "My Collections"
* Import your deployed contract
* Start minting or listing tokens

Tips:

* Ensure your contract implements ERC-721 fully
* Add royalty logic if needed using EIP-2981
