A comprehensive collection of Non-Fungible Token implementations — from generative art collections and on-chain SVG rendering to dynamic NFTs, music/video tokens, marketplaces, fractionalization, royalty systems, and advanced token standards. Built to master every layer of NFT technology from minting to composable digital ownership.
NFTs are unique digital assets verified on a blockchain. Unlike fungible tokens (where every unit is identical), each NFT carries distinct metadata, provenance, and ownership history. This repository explores the full spectrum of NFT technology — from the simplest PFP collection to complex composable systems where NFTs own other NFTs.
What you'll build:
ERC-721, ERC-1155, and ERC-6551 token implementations from scratch
Generative art engines with on-chain SVG rendering and trait rarity
Dynamic NFTs that evolve based on time, oracle data, or user interaction
Music and video NFTs with streaming rights and royalty splits
Full marketplace contracts — listings, auctions, offers, and royalty enforcement
Fractionalization — split a single NFT into fungible ERC-20 shares
Soulbound tokens (SBTs) for non-transferable credentials
Token Bound Accounts (ERC-6551) — NFTs that own assets
Rental and delegation systems (ERC-4907)
Cross-chain NFT bridges and migration tools
Before NFTs
With NFTs
Digital files infinitely copied
Provably scarce, each token unique
Artists lose control after first sale
Perpetual royalties on every resale
Ownership stored in centralized databases
Ownership on immutable, global blockchain
Items locked to one platform/game
Interoperable across apps, games, and wallets
No way to prove digital authenticity
Cryptographic provenance and chain of custody
Creators need middlemen for distribution
Direct creator-to-collector relationship
Music/art royalties opaque and delayed
Transparent, instant, programmable splits
Digital tickets easily counterfeited
Verifiable, non-duplicable event access
┌──────────────────────────────────────────────────────────────────────────────┐
│ NFT ECOSYSTEM │
│ │
│ ┌─────────────────────┐ ┌──────────────────────┐ ┌────────────────────┐ │
│ │ Marketplaces │ │ Art / Generative │ │ Gaming │ │
│ │ │ │ │ │ │ │
│ │ • OpenSea │ │ • Art Blocks │ │ • Axie Infinity │ │
│ │ • Blur │ │ • fxhash │ │ • Loot │ │
│ │ • Magic Eden │ │ • Prohibition │ │ • Parallel │ │
│ │ • LooksRare │ │ • Bright Moments │ │ • Sorare │ │
│ │ • X2Y2 │ │ • On-chain art │ │ • Gods Unchained │ │
│ └─────────────────────┘ └──────────────────────┘ └────────────────────┘ │
│ │
│ ┌─────────────────────┐ ┌──────────────────────┐ ┌────────────────────┐ │
│ │ Music / Media │ │ Identity / Social │ │ Infrastructure │ │
│ │ │ │ │ │ │ │
│ │ • Sound.xyz │ │ • ENS │ │ • IPFS / Arweave │ │
│ │ • Catalog │ │ • Lens Protocol │ │ • Pinata │ │
│ │ • Audius │ │ • Farcaster (frames) │ │ • Zora Protocol │ │
│ │ • Royal │ │ • Soulbound (SBTs) │ │ • Manifold │ │
│ │ • Mint Songs │ │ • .eth domains │ │ • Thirdweb │ │
│ └─────────────────────┘ └──────────────────────┘ └────────────────────┘ │
│ │
│ ┌─────────────────────┐ ┌──────────────────────┐ ┌────────────────────┐ │
│ │ PFP Collections │ │ Utility / Access │ │ Finance │ │
│ │ │ │ │ │ │ │
│ │ • CryptoPunks │ │ • Event tickets │ │ • Fractional (now │ │
│ │ • Bored Ape (BAYC) │ │ • Membership passes │ │ Tessera) │ │
│ │ • Azuki │ │ • Subscriptions │ │ • Sudoswap (AMM) │ │
│ │ • Pudgy Penguins │ │ • Loyalty programs │ │ • NFTfi (lending) │ │
│ │ • DeGods │ │ • Gated content │ │ • Blend (Blur) │ │
│ └─────────────────────┘ └──────────────────────┘ └────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────┘
Layer
Technology
Smart Contracts
Solidity 0.8.x
Frameworks
Foundry, Hardhat
Token Standards
ERC-721, ERC-721A, ERC-1155, ERC-6551, ERC-4907, ERC-5192
Optimized Libraries
Solmate, ERC721A (Azuki), OpenZeppelin
Metadata Storage
IPFS, Arweave, On-chain (base64 SVG)
Metadata Pinning
Pinata, NFT.Storage, Lighthouse
Randomness
Chainlink VRF v2.5
Art Generation
p5.js, Processing, generative algorithms, SVG
Image Rendering
Canvas API, Sharp, DALL-E (for AI-assisted)
Frontend
Next.js, React, wagmi, viem, RainbowKit
Indexing
The Graph, Alchemy NFT API, Reservoir
Marketplace Protocol
Seaport (OpenSea), Reservoir, Zora
Networks
Ethereum, Base, Arbitrum, Polygon, Optimism, Zora Network
#
Project
Description
Key Concepts
01
ERC-721 From Scratch
Implement the full ERC-721 standard manually — no imports, pure learning
tokenURI, ownerOf, transferFrom, approve
02
ERC-721A Gas-Optimized Collection
Batch minting with Azuki's ERC-721A — mint 10 NFTs for the gas of 1
Sequential IDs, lazy initialization
03
ERC-1155 Multi-Token
Single contract for fungible + non-fungible tokens — game items, editions
Batch transfers, balanceOfBatch, uri()
04
ERC-6551 Token Bound Accounts
NFTs that own other assets — each NFT gets its own smart contract wallet
TBA registry, account creation, nested NFTs
05
Soulbound Token (ERC-5192)
Non-transferable NFTs for credentials, achievements, and identity
Lock mechanism, bound status, attestation
Generative Art & On-Chain NFTs
#
Project
Description
Key Concepts
06
On-Chain SVG NFT
Art generated and stored entirely on-chain as base64-encoded SVG
SVG generation, base64, tokenURI on-chain
07
Generative Art Engine
Layer-based trait combination — generate 10K+ unique PFPs from attributes
Trait layers, rarity weights, hash-to-art
08
Procedural Pixel Art
Algorithmically generated pixel characters using on-chain seed
Bitpacking, pixel encoding, deterministic
09
Art Blocks-Style Platform
Artists upload generative scripts, collectors mint unique outputs
Script storage, hash-seeded randomness
10
ASCII Art NFT
Text-based art rendered on-chain — each mint produces unique ASCII art
String manipulation, monospace rendering
Dynamic & Interactive NFTs
#
Project
Description
Key Concepts
11
Evolving NFT (Time-Based)
NFT art/metadata changes over time — seed grows into tree, day/night cycle
Block timestamp, staged metadata, reveal
12
Weather NFT (Oracle-Driven)
Art changes based on real-world weather data from Chainlink oracles
External data, dynamic tokenURI, oracle
13
Fitness NFT (Activity-Driven)
NFT evolves based on real-world fitness data — steps, runs, milestones
Off-chain data attestation, level-up logic
14
Composable NFT (Mix & Match)
Combine base NFT with trait NFTs — equip hat, background, accessory
Layer composition, slot system, rendering
15
Burnable → Reveal NFT
Burn one NFT to reveal/mint a new one — migration, redemption mechanics
Burn-to-mint, phased reveals, linked tokens
Music, Video & Media NFTs
#
Project
Description
Key Concepts
16
Music NFT with Royalty Splits
Mint songs as NFTs — royalties auto-split between artist, producer, label
0xSplits, EIP-2981, revenue distribution
17
Video NFT with Gated Streaming
Token-gate video content — only NFT holders can access the full video
Token gating, Lit Protocol, encrypted media
18
Podcast Episode NFTs
Each episode is an NFT — collectors unlock bonus content and community
Media metadata, edition pricing, access
19
Photography Collection
High-resolution photo NFTs with licensing terms embedded in metadata
License metadata, high-res storage, editions
20
AI-Assisted Art Collection
Generate art with AI, store provenance of prompt + model on-chain
AI attribution, prompt hash, model version
#
Project
Description
Key Concepts
21
NFT Marketplace (Full)
List, buy, sell, auction NFTs with royalty enforcement and fee collection
Listing, escrow, auction, EIP-2981
22
English Auction House
Time-bound ascending bid auction with reserve price and auto-settlement
Bid increments, reserve, time extension
23
Dutch Auction Minting
Price starts high and drops over time — collectors mint when price is right
Declining price curve, fair price discovery
24
NFT AMM (Sudoswap-Style)
Automated market maker for NFTs — bonding curve-based instant buy/sell
Bonding curves, liquidity pools, floor price
25
Offer / Bid System
Collection-wide and trait-specific offers — accept best bid on any NFT
Collection offers, trait filtering, escrow
Advanced NFT Infrastructure
#
Project
Description
Key Concepts
26
NFT Fractionalization
Lock an NFT, issue ERC-20 shares — trade fractional ownership of rare NFTs
Vault lock, share mint, buyout mechanism
27
NFT Lending (Collateral)
Use NFTs as collateral to borrow ETH/stablecoins — peer-to-peer loans
Appraisal, LTV, liquidation, loan terms
28
Rental / Delegation (ERC-4907)
Rent NFTs for a set period — use in games or access gated content
User role, expires, rental marketplace
29
Royalty Registry & Enforcer
Enforce on-chain royalties across all marketplaces using EIP-2981 + hooks
EIP-2981, operator filter, royalty math
30
Cross-Chain NFT Bridge
Move NFTs between Ethereum, Base, Arbitrum — lock on source, mint on dest
Lock-mint, burn-unlock, metadata migration
┌─────────────────────────────────────────────────────────────────────────┐
│ NFT = On-Chain + Off-Chain │
│ │
│ ON-CHAIN (Smart Contract) OFF-CHAIN (Metadata + Media) │
│ ┌──────────────────────────┐ ┌──────────────────────────┐ │
│ │ │ │ │ │
│ │ Token ID: 42 │ tokenURI │ metadata.json: │ │
│ │ Owner: 0xAlice... │ ────────► │ { │ │
│ │ Contract: 0xNFT... │ │ "name": "Punk #42", │ │
│ │ │ │ "description": "...", │ │
│ │ Functions: │ │ "image": "ipfs://Qm.."│ │
│ │ • ownerOf(42) │ │ "attributes": [ │ │
│ │ • transferFrom(...) │ │ {"trait_type": │ │
│ │ • approve(...) │ │ "Background", │ │
│ │ • tokenURI(42) │ │ "value": "Blue"}, │ │
│ │ │ │ {"trait_type": │ │
│ │ Events: │ │ "Eyes", │ │
│ │ • Transfer(from,to,id) │ │ "value": "Laser"}, │ │
│ │ • Approval(owner, │ │ ... │ │
│ │ approved,id) │ │ ] │ │
│ │ │ │ } │ │
│ └──────────────────────────┘ └──────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────┐ │
│ │ Image / Media │ │
│ │ │ │
│ │ Stored on: │ │
│ │ • IPFS │ │
│ │ • Arweave │ │
│ │ • On-chain SVG │ │
│ │ • Centralized │ │
│ │ server (risky) │ │
│ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
Creator Smart Contract Collector
│ │ │
├── deploy(name, symbol, ────►│ │
│ baseURI, maxSupply) │ │
│ │ │
│ [Upload art + metadata │ │
│ to IPFS / Arweave] │ │
│ │ │
│ │◄── mint{value: price}() ─────┤
│ │ │
│ │ 1. Check: supply < max │
│ │ 2. Check: msg.value >= price│
│ │ 3. _mint(collector, tokenId)│
│ │ 4. Emit Transfer(0x0, │
│ │ collector, tokenId) │
│ │ │
│ ├── tokenURI(tokenId) ────────►│
│ │ returns: ipfs://Qm.../42 │
│ │ │
│ [Creator receives │ │
│ mint revenue] │ │
│ │ │
│ SECONDARY SALE: │ │
│ │◄── list on marketplace ──────┤
│ │ │
│ │ Buyer purchases: │
│ │ • Sale price → Seller │
│ │ • Royalty (%) → Creator │
│◄── royalty payment ─────────┤ • Fee (%) → Marketplace │
┌──────────────────────────────────────────────────────────────────────────┐
│ GENERATIVE ART ENGINE │
│ │
│ Step 1: DESIGN LAYERS │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Background │ │ Body │ │ Eyes │ │ Accessory │ │
│ │ │ │ │ │ │ │ │ │
│ │ • Blue (30%)│ │ • Red (20%)│ │ • Normal │ │ • None (50%)│ │
│ │ • Green(25%)│ │ • Blue(30%)│ │ (40%) │ │ • Hat (20%) │ │
│ │ • Pink (20%)│ │ • Gold(10%)│ │ • Laser │ │ • Crown(5%) │ │
│ │ • Black(15%)│ │ • Gray(40%)│ │ (10%) │ │ • Shades │ │
│ │ • Rainbow │ │ │ │ • Closed │ │ (25%) │ │
│ │ (10%) │ │ │ │ (30%) │ │ │ │
│ └────────────┘ └────────────┘ │ • Wink(20%)│ └────────────┘ │
│ └────────────┘ │
│ │
│ Step 2: COMBINE TRAITS (seed-based random selection) │
│ │
│ Token #42 seed: keccak256(42 + blockhash) │
│ → Background: Pink (20%) ─────────┐ │
│ → Body: Gold (10%) ──────────────┐│ │
│ → Eyes: Laser (10%) ───────────┐ ││ │
│ → Accessory: Crown (5%) ────┐ │ ││ │
│ │ │ ││ │
│ Step 3: RENDER ▼ ▼ ▼▼ │
│ ┌─────────────────────────────────────┐ │
│ │ ┌───────────┐ │ │
│ │ │ 👑 Crown │ │ Rarity Score: │
│ │ │ ⚡ Laser │ │ Pink(20%) × Gold(10%) × │
│ │ │ Eyes │ │ Laser(10%) × Crown(5%) │
│ │ │ 🟡 Gold │ │ = 0.001% (1 in 100,000) │
│ │ │ Body │ │ │
│ │ Pink Background │ │ This is a GRAIL trait combo! │
│ └─────────────────────────────────────┘ │
│ │
│ Step 4: STORE │
│ • Image → IPFS (ipfs://QmABC.../42.png) │
│ • Metadata → IPFS (ipfs://QmDEF.../42.json) │
│ • On-chain: tokenURI(42) → "ipfs://QmDEF.../42.json" │
└──────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────┐
│ ON-CHAIN SVG NFT │
│ │
│ Everything lives on the blockchain — no IPFS, no servers: │
│ │
│ tokenURI(42) returns: │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ data:application/json;base64,eyJuYW1lIjoiT24tQ2hhaW4gIzQyIiw... │ │
│ └──────────────────────────────────┬─────────────────────────────────┘ │
│ │ decode base64 │
│ ▼ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ { │ │
│ │ "name": "On-Chain #42", │ │
│ │ "description": "Fully on-chain generative art", │ │
│ │ "image": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAw..." │ │
│ │ } │ │
│ └──────────────────────────────────┬─────────────────────────────────┘ │
│ │ decode base64 │
│ ▼ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ <svg width="500" height="500" xmlns="http://www.w3.org/2000/svg">│ │
│ │ <rect width="500" height="500" fill="#FF69B4"/> │ │
│ │ <circle cx="250" cy="250" r="100" fill="#FFD700"/> │ │
│ │ <circle cx="220" cy="230" r="15" fill="red"/> │ │
│ │ <circle cx="280" cy="230" r="15" fill="red"/> │ │
│ │ <text x="250" y="350" text-anchor="middle">👑</text> │ │
│ │ </svg> │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ Advantages: │
│ ✓ Immutable — art lives forever on the blockchain │
│ ✓ No dependency on IPFS/servers │
│ ✓ Composable — other contracts can read and remix the art │
│ ✓ Transparent — anyone can verify the generation algorithm │
│ │
│ Trade-offs: │
│ ✗ Higher gas cost for minting │
│ ✗ Limited to vector/text art (no photos, limited video) │
│ ✗ SVG complexity limited by block gas limit │
└──────────────────────────────────────────────────────────────────────────┘
NFT Marketplace Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ MARKETPLACE FRONTEND │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Browse/Search │ │ My Collection │ │ Create/Mint │ │ Activity Feed│ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
└─────────┼─────────────────┼─────────────────┼─────────────────┼─────────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ SMART CONTRACTS │
│ │
│ ┌──────────────┐ ┌──────────────────┐ ┌─────────────────────────────┐ │
│ │ NFT Contract │ │ Marketplace │ │ Royalty Registry │ │
│ │ (ERC-721/1155)│ │ (Seaport-style) │ │ (EIP-2981) │ │
│ │ │ │ │ │ │ │
│ │ • mint() │ │ • listItem() │ │ • royaltyInfo(tokenId, │ │
│ │ • tokenURI() │ │ • buyItem() │ │ salePrice) │ │
│ │ • approve() │ │ • makeOffer() │ │ → (receiver, amount) │ │
│ │ • transfer() │ │ • acceptOffer() │ │ │ │
│ │ │ │ • cancelListing() │ │ • setDefaultRoyalty() │ │
│ │ │ │ • createAuction() │ │ • setTokenRoyalty() │ │
│ │ │ │ • placeBid() │ │ │ │
│ │ │ │ • settleAuction() │ │ Creator: 5% of every sale │ │
│ └──────────────┘ └──────────────────┘ └─────────────────────────────┘ │
│ │
│ Sale Flow: │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ Buyer pays 1 ETH │ │
│ │ ├── 0.95 ETH → Seller │ │
│ │ ├── 0.025 ETH → Creator (2.5% royalty via EIP-2981) │ │
│ │ └── 0.025 ETH → Marketplace (2.5% platform fee) │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Token Bound Accounts (ERC-6551)
┌────────────────────────────────────────────────────────────────────────┐
│ TOKEN BOUND ACCOUNTS (ERC-6551) │
│ │
│ Traditional NFT: TBA-Enabled NFT: │
│ ┌──────────┐ ┌──────────────────────────────────┐ │
│ │ NFT #42 │ │ NFT #42 │ │
│ │ │ │ ┌────────────────────────────┐ │ │
│ │ metadata │ │ │ Bound Account (0xABC...) │ │ │
│ │ image │ │ │ │ │ │
│ │ │ │ │ Owns: │ │ │
│ │ (that's │ │ │ • 2.5 ETH │ │ │
│ │ it) │ │ │ • 500 USDC │ │ │
│ │ │ │ │ • NFT #88 (sub-item) │ │ │
│ └──────────┘ │ │ • NFT #102 (equipment) │ │ │
│ │ │ • 3 ERC-1155 tokens │ │ │
│ │ │ │ │ │
│ │ │ Can: execute transactions │ │ │
│ │ │ Controlled by: NFT owner │ │ │
│ │ └────────────────────────────┘ │ │
│ └──────────────────────────────────┘ │
│ │
│ When NFT #42 is transferred to Bob: │
│ → Bob automatically controls the bound account │
│ → Bob owns all assets inside (ETH, tokens, sub-NFTs) │
│ → It's like selling a backpack with everything inside it │
│ │
│ Use Cases: │
│ • Game characters that own their inventory │
│ • NFTs with their own transaction history and reputation │
│ • Composable profiles — avatar + accessories + achievements │
│ • Loyalty programs — NFT membership card holds reward tokens │
└────────────────────────────────────────────────────────────────────────┘
Owner Fractionalization Vault Shareholders
│ │ │
├── deposit(NFT #42) ────────►│ │
│ lock NFT in vault │ │
│ │── mint 1,000,000 FRAC ──────►│
│ │ (ERC-20 shares) │
│ │ │
│ │ Each FRAC = 0.0001% │
│ │ of NFT #42 │
│ │ │
│ │ ┌─── Trading ───────────┐ │
│ │ │ FRAC/ETH pool on │ │
│ │ │ Uniswap │ │
│ │ │ Price discovery for │ │
│ │ │ the NFT via shares │ │
│ │ └────────────────────────┘ │
│ │ │
│ BUYOUT MECHANISM: │ │
│ │◄── startBuyout(price) ──────┤
│ │ (requires majority vote) │
│ │ │
│ │── if approved: │
│ │ 1. Buyer pays ETH │
│ │ 2. NFT released to buyer │
│ │ 3. ETH distributed pro-rata│
│ │ to FRAC holders │
┌─────────────────────────────────────────────────────────────────────────┐
│ MUSIC NFT ROYALTY SPLITS │
│ │
│ Song: "On-Chain Dreams" minted as NFT │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ 0xSplits Contract (Immutable Split) │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐│ │
│ │ │ Artist │ │ Producer │ │ Featuring Artist ││ │
│ │ │ 60% │ │ 25% │ │ 15% ││ │
│ │ │ 0xAlice... │ │ 0xBob... │ │ 0xCarol... ││ │
│ │ └──────────────┘ └──────────────┘ └──────────────────┘│ │
│ └────────────────────────────────────────────────────────────┘ │
│ ▲ │
│ │ royaltyInfo() returns split contract │
│ │ │
│ Secondary Sale: Collector sells NFT for 10 ETH │
│ ┌─────────────────────────────────────────────┐ │
│ │ EIP-2981 Royalty: 10% = 1 ETH │ │
│ │ │ │
│ │ → 0xSplits receives 1 ETH │ │
│ │ ├── Alice (Artist): 0.60 ETH │ │
│ │ ├── Bob (Producer): 0.25 ETH │ │
│ │ └── Carol (Featured): 0.15 ETH │ │
│ │ │ │
│ │ All automatic, trustless, instant. │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
nft-projects/
├── 01-erc721-from-scratch/
│ ├── src/
│ │ └── ERC721.sol
│ ├── test/
│ │ ├── ERC721.t.sol
│ │ └── invariant/
│ ├── foundry.toml
│ └── README.md
├── 06-onchain-svg-nft/
│ ├── src/
│ │ ├── OnChainNFT.sol
│ │ ├── SVGRenderer.sol
│ │ └── libraries/
│ │ ├── Base64.sol
│ │ ├── SVGLib.sol
│ │ └── ColorLib.sol
│ ├── test/
│ └── README.md
├── 07-generative-art-engine/
│ ├── contracts/
│ │ └── GenerativeCollection.sol
│ ├── engine/ ← off-chain art generation
│ │ ├── layers/
│ │ │ ├── background/
│ │ │ ├── body/
│ │ │ ├── eyes/
│ │ │ └── accessory/
│ │ ├── generate.ts
│ │ ├── rarity.ts
│ │ └── upload-ipfs.ts
│ ├── test/
│ └── README.md
├── 16-music-nft-royalties/
│ ├── src/
│ │ ├── MusicNFT.sol
│ │ ├── RoyaltySplitter.sol
│ │ └── interfaces/
│ ├── test/
│ └── README.md
├── 21-nft-marketplace/
│ ├── src/
│ │ ├── Marketplace.sol
│ │ ├── AuctionHouse.sol
│ │ └── OfferManager.sol
│ ├── test/
│ ├── frontend/
│ │ ├── src/
│ │ │ ├── components/
│ │ │ ├── hooks/
│ │ │ └── pages/
│ │ └── package.json
│ ├── subgraph/
│ └── README.md
├── 26-nft-fractionalization/
│ ├── src/
│ │ ├── FractionalVault.sol
│ │ ├── BuyoutModule.sol
│ │ └── FRACToken.sol
│ ├── test/
│ └── README.md
├── lib/ # Shared Solidity dependencies
│ ├── forge-std/
│ ├── openzeppelin-contracts/
│ ├── ERC721A/
│ ├── solmate/
│ └── reference/ # ERC-6551 reference
├── interfaces/ # Common NFT interfaces
│ ├── IERC721.sol
│ ├── IERC1155.sol
│ ├── IERC2981.sol
│ ├── IERC4907.sol
│ ├── IERC6551Registry.sol
│ └── IMarketplace.sol
├── libraries/ # Shared utility libraries
│ ├── Base64.sol
│ ├── SVGLib.sol
│ ├── StringLib.sol
│ ├── RarityLib.sol
│ └── MetadataLib.sol
└── README.md
Foundry — curl -L https://foundry.paradigm.xyz | bash && foundryup
Node.js >= 18.x (for art engines, frontends, and IPFS uploads)
Git
IPFS (optional) — npm install -g ipfs or use Pinata API
MetaMask or any EVM wallet
# Clone the repository
git clone https://github.com/pranay123-stack/nft-projects.git
cd nft-projects
# Navigate to a project
cd 06-onchain-svg-nft
# Install dependencies
forge install
# Build
forge build
# Run tests
forge test -vvv
# RPC Endpoints
MAINNET_RPC_URL = https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
BASE_RPC_URL = https://base-mainnet.g.alchemy.com/v2/YOUR_KEY
SEPOLIA_RPC_URL = https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY
# Deployment
PRIVATE_KEY = your_deployer_private_key
ETHERSCAN_API_KEY = your_etherscan_api_key
# IPFS / Metadata Storage
PINATA_API_KEY = your_pinata_key
PINATA_SECRET = your_pinata_secret
ARWEAVE_KEY = your_arweave_key
# Chainlink VRF (for randomness-based mints)
VRF_SUBSCRIPTION_ID = your_sub_id
VRF_COORDINATOR = 0x...
VRF_KEY_HASH = 0x...
# Alchemy NFT API (for indexing)
ALCHEMY_API_KEY = your_alchemy_key
Never commit private keys or API secrets. All projects include .gitignore with .env excluded.
# Compile
forge build
# Run all tests
forge test
# Run with verbosity
forge test -vvvv
# Gas report
forge test --gas-report
# Deploy to testnet
forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify
# Mint an NFT via CLI
cast send $NFT " mint(address)" $RECIPIENT --value 0.08ether --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY
# Read tokenURI
cast call $NFT " tokenURI(uint256)" 1 --rpc-url $SEPOLIA_RPC_URL
Art Engine (Generative Projects)
cd 07-generative-art-engine/engine
# Install
pnpm install
# Generate all images + metadata
pnpm generate --count 10000
# Preview rarity distribution
pnpm rarity-report
# Upload to IPFS via Pinata
pnpm upload --to pinata
# Upload to Arweave
pnpm upload --to arweave
cd frontend
pnpm install
pnpm dev
# Open http://localhost:3000
# Unit Tests — individual functions (mint, transfer, tokenURI)
forge test --match-path " test/unit/*"
# Integration Tests — full mint-list-buy flow
forge test --match-path " test/integration/*"
# Fuzz Tests — random token IDs, amounts, addresses
forge test --match-path " test/fuzz/*"
# Invariant Tests — properties that must always hold
forge test --match-path " test/invariant/*"
# Gas Benchmarks — compare ERC-721 vs ERC-721A vs ERC-1155
forge test --match-path " test/gas/*" --gas-report
// Total supply must equal number of minted - burned tokens
function invariant_supplyAccounting () public {
assertEq (
nft.totalSupply (),
totalMinted - totalBurned
);
}
// Every token must have exactly one owner
function invariant_singleOwner () public {
for (uint i = 1 ; i <= nft.totalSupply (); i++ ) {
address owner = nft.ownerOf (i);
assertTrue (owner != address (0 ), "Token has no owner " );
}
}
// Balance of all holders must sum to total supply
function invariant_balancesSumToSupply () public {
uint256 totalBalance;
for (uint i = 0 ; i < holders.length ; i++ ) {
totalBalance += nft.balanceOf (holders[i]);
}
assertEq (totalBalance, nft.totalSupply ());
}
// Royalty amount must never exceed sale price
function invariant_royaltyBounded () public {
(address receiver , uint256 amount ) = nft.royaltyInfo (1 , 1 ether);
assertLe (amount, 1 ether);
assertTrue (receiver != address (0 ));
}
// Marketplace: listing price must match escrow balance
function invariant_escrowMatchesListings () public {
uint256 totalListingValue = marketplace.totalActiveListingValue ();
uint256 escrowBalance = address (marketplace).balance;
assertGe (escrowBalance, totalListingValue);
}
// Fractionalization: shares * price must equal NFT valuation
function invariant_fractionalAccounting () public {
uint256 totalShares = fracToken.totalSupply ();
assertTrue (totalShares > 0 );
// Vault must hold the original NFT
assertEq (nft.ownerOf (lockedTokenId), address (vault));
}
// ERC-4907 rental: user role must expire correctly
function invariant_rentalExpiry () public {
if (block .timestamp > nft.userExpires (tokenId)) {
assertEq (nft.userOf (tokenId), address (0 ));
}
}
OpenSea Metadata Standard
{
"name" : " My NFT #42" ,
"description" : " A unique generative art piece from the Collection." ,
"image" : " ipfs://QmABC.../42.png" ,
"animation_url" : " ipfs://QmDEF.../42.mp4" ,
"external_url" : " https://mycollection.xyz/token/42" ,
"attributes" : [
{
"trait_type" : " Background" ,
"value" : " Cosmic Purple"
},
{
"trait_type" : " Rarity" ,
"value" : " Legendary"
},
{
"display_type" : " number" ,
"trait_type" : " Generation" ,
"value" : 1
},
{
"display_type" : " boost_percentage" ,
"trait_type" : " Power" ,
"value" : 40
},
{
"display_type" : " date" ,
"trait_type" : " Minted" ,
"value" : 1716000000
}
]
}
Storage
Permanence
Cost
Speed
Best For
On-Chain
Permanent
High (gas)
Instant
SVG art, small metadata
IPFS
Persistent*
Low (pinning fee)
Fast
Images, large metadata
Arweave
Permanent
One-time payment
Moderate
Archival, guaranteed storage
Centralized
Server-dependent
Cheapest
Fastest
Temporary, pre-reveal
* IPFS content persists as long as at least one node pins it.
NFT-Specific Attack Vectors
Attack
Description
Mitigation
Reentrancy on Mint
Re-enter mint function during callback to mint extra tokens
CEI pattern, ReentrancyGuard, checks first
Unlimited Mint
No per-wallet or total supply cap allows infinite minting
maxSupply, maxPerWallet, maxPerTx
Front-Running Rare Mints
Seeing mint tx, calculating token ID, front-running for rarity
VRF randomness, delayed reveal, commit-reveal
Metadata Rug
Creator changes metadata/images after sale via centralized URI
IPFS/Arweave, on-chain art, frozen metadata
Royalty Bypass
Trading via non-EIP-2981 marketplace to skip royalty payments
Operator filter, blocklist, on-chain enforcement
Approval Phishing
Tricking users into approving malicious operators for all NFTs
setApprovalForAll warnings, revoke tools
Stolen NFT Laundering
Quickly transferring stolen NFT through multiple wallets
Transfer cooldowns, stolen asset registries
Signature Replay (Lazy Mint)
Reusing a valid mint signature to mint more than authorized
Nonce tracking, deadline, EIP-712 domain
Flash Loan + Snapshot Attack
Borrow NFT, snapshot vote/airdrop, return NFT same block
Multi-block snapshot, holding period
Integer Overflow in Price
Manipulating auction bid or price calculation
SafeMath (Solidity 0.8+), bounds checking
Tokenuri Injection
Malicious SVG/JSON in on-chain metadata (XSS vector)
Sanitize inputs, escape special characters
Network
Chain ID
Mint Cost
Why
Ethereum
1
$5-50
Premium collections, highest value, most liquidity
Base
8453
~$0.01
Low-cost minting, Coinbase ecosystem
Zora Network
7777777
~$0.001
Purpose-built for NFTs, Zora protocol native
Arbitrum
42161
~$0.05
Low fees, growing NFT ecosystem
Polygon
137
~$0.01
Established NFT market, gaming NFTs
Optimism
10
~$0.05
Attestations, soulbound tokens
Sepolia
11155111
Free
Testing
# 1. Deploy NFT contract
forge script script/Deploy.s.sol \
--rpc-url $BASE_RPC_URL --broadcast --verify
# 2. Set base URI (IPFS metadata)
cast send $NFT " setBaseURI(string)" " ipfs://QmABC.../" \
--rpc-url $BASE_RPC_URL --private-key $PRIVATE_KEY
# 3. Configure royalties (5% to creator)
cast send $NFT " setDefaultRoyalty(address,uint96)" $CREATOR 500 \
--rpc-url $BASE_RPC_URL --private-key $PRIVATE_KEY
# 4. Open minting
cast send $NFT " setMintActive(bool)" true \
--rpc-url $BASE_RPC_URL --private-key $PRIVATE_KEY
# 5. Verify on Etherscan/Basescan
forge verify-contract $NFT src/MyNFT.sol:MyNFT \
--chain base --etherscan-api-key $ETHERSCAN_API_KEY
Concept
Description
NFT (Non-Fungible Token)
Unique digital asset on a blockchain — no two are identical
ERC-721
Standard interface for non-fungible tokens — one token per ID
ERC-721A
Gas-optimized ERC-721 by Azuki — batch mint at near-single-mint cost
ERC-1155
Multi-token standard — fungible and non-fungible in one contract
ERC-6551 (TBA)
Token Bound Accounts — NFTs that own other assets
ERC-4907
Rental standard — separate owner and user roles with expiry
ERC-5192
Soulbound — minimal interface for non-transferable tokens
EIP-2981
Royalty standard — royaltyInfo() returns recipient and amount
tokenURI
Function returning metadata URL (IPFS, Arweave, or data: URI)
Metadata
JSON describing the NFT — name, description, image, attributes
On-Chain NFT
Art and metadata stored entirely on the blockchain (SVG, base64)
Generative Art
Algorithmically created art — unique output from seed + code
Reveal
Delayed metadata reveal — placeholder shown until collection reveal
Floor Price
Lowest listed price for any NFT in a collection
Rarity Score
Numeric score based on statistical rarity of an NFT's trait combination
Provenance
Complete ownership history of an NFT, recorded on-chain
Lazy Minting
NFT created at time of first purchase (not pre-minted by creator)
Dutch Auction
Price starts high and decreases over time until someone buys
English Auction
Ascending bid auction — highest bidder wins at deadline
Fractionalization
Splitting one NFT into many fungible ERC-20 shares
Soulbound Token (SBT)
Non-transferable NFT for credentials, achievements, identity
Token Gating
Restricting access to content/events based on NFT ownership
Airdrop
Free distribution of NFTs to a list of wallet addresses
Allowlist / Whitelist
Pre-approved addresses that can mint before public sale
PFP
Profile Picture — NFT collections used as social media avatars
0xSplits
Protocol for splitting payments between multiple recipients
Top NFT Tokens & Marketplaces
Token
Project
Role in Ecosystem
BLUR
Blur
Leading NFT marketplace, pro trading tools, bid rewards
APE
ApeCoin (BAYC)
Ecosystem token for Bored Ape Yacht Club, Otherside metaverse
LOOKS
LooksRare
NFT marketplace with staking and trading rewards
X2Y2
X2Y2
NFT marketplace with low fees, royalty-optional trading
RARE
SuperRare
Curated 1/1 art marketplace, curation DAO
ZORA
Zora
NFT creation protocol, Zora Network (L2), creator tools
MFLD
Manifold
Creator toolkit for deploying custom NFT contracts
ENS
Ethereum Name Service
.eth domain NFTs — most widely used NFT utility
PENGU
Pudgy Penguins
PFP collection with physical toys and IP expansion
SUDO
Sudoswap
NFT AMM — bonding curve-based instant NFT trading
Collection
Floor (approx.)
What It Pioneered
CryptoPunks
~50 ETH
First NFT collection (2017), cultural icon
Bored Ape (BAYC)
~10 ETH
PFP + membership + IP rights model
Art Blocks
Varies
Generative art on-chain, curated + open
Azuki
~5 ETH
ERC-721A gas optimization, anime aesthetic
Pudgy Penguins
~10 ETH
Physical products + IP licensing from NFTs
Nouns
~15 ETH
Daily auction, on-chain art, DAO treasury
Autoglyphs
~100 ETH
First fully on-chain generative art (Larva Labs)
Loot
~1 ETH
Composable building blocks, bottom-up worldbuild
Contributions are welcome! Whether it's a new NFT standard, art engine, marketplace feature, or security improvement:
Fork the repository
Create a feature branch (git checkout -b feature/new-nft-project)
Follow the existing project structure
Include comprehensive tests (unit + fuzz + invariant)
Add a README.md with architecture, metadata format, and security analysis
Submit a pull request
High-impact contribution ideas:
ERC-7007 (AI-generated NFT standard) implementation
On-chain music player NFT (audio SVG data URI)
Cross-chain NFT bridge with Chainlink CCIP
Dynamic NFT driven by Chainlink Functions (any API data)
NFT lending protocol with appraisal oracle
Gasless minting with ERC-4337 paymaster
This repository is licensed under the MIT License .
Every digital asset deserves provable ownership. Build the infrastructure that makes digital scarcity real.