Skip to content

topsecretagent007/DNFT-Mint-Site

Repository files navigation

dNFT :: Co-creation Platform

Next.js TypeScript TensorFlow.js Tailwind CSS

A modern dApp that empowers NFT collectors to become co-creators by minting AI-powered derivative NFTs using Neural Style Transfer. Built with Next.js, TypeScript, and TensorFlow.js.

🚀 Features

  • Neural Style Transfer: Apply the style of one NFT to another using ML models running entirely in your browser
  • Derivative NFT Minting: Create unique, verifiable derivative artworks on-chain
  • CosmWasm Integration: Built for Terra/CosmWasm blockchain with Keplr wallet support
  • IPFS Storage: Decentralized storage for your derivative artworks
  • Modern UI: Beautiful, responsive interface built with Tailwind CSS
  • Type-Safe: Full TypeScript implementation for reliability
  • No Backend Required: Everything runs client-side for true decentralization

🎨 How It Works

  1. Connect Wallet: Connect your Keplr wallet to access your NFT collection
  2. Select NFTs: Choose a content NFT (base image) and a style NFT (artistic style)
  3. Customize: Adjust parameters like image sizes and stylization strength
  4. Generate: Neural Style Transfer creates a unique derivative artwork
  5. Mint: Save your creation as an on-chain derivative NFT with IPFS storage

The smart contract stores:

  • Links to the original source NFTs (token_id)
  • Generation method and parameters
  • Provenance chain for complete traceability

This ensures:

  • ✅ Traceback to original artworks
  • ✅ Proof of ownership at minting time
  • ✅ Deterministic recreation from sources
  • ✅ Uniqueness (no duplicate derivatives)

🛠️ Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript 5.6
  • Styling: Tailwind CSS 3.4
  • ML/AI: TensorFlow.js 4.21
  • Blockchain: CosmJS, CosmWasm
  • Storage: IPFS (via Infura)
  • Wallet: Keplr Integration

📦 Installation

# Clone the repository
git clone https://github.com/topsecretagent007/DNFT-Mint-Site.git
cd DNFT-Mint-Site

# Install dependencies
npm install
# or
yarn install
# or
pnpm install

⚙️ Configuration

Create a .env.local file in the root directory:

# Contract Configuration
NEXT_PUBLIC_CONTRACT_ADDRESS=your_contract_address_here

# Network Configuration
NEXT_PUBLIC_CHAIN_ID=phoenix-1
NEXT_PUBLIC_RPC_URL=https://rpc.phoenix-1.terra.dev

# IPFS Configuration
NEXT_PUBLIC_IPFS_HOST=ipfs.infura.io
NEXT_PUBLIC_IPFS_PORT=5001
NEXT_PUBLIC_IPFS_PROTOCOL=https

🚀 Development

# Run development server
npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 in your browser.

🏗️ Build for Production

# Create optimized production build
npm run build
npm run start

# or
yarn build
yarn start

# or
pnpm build
pnpm start

📁 Project Structure

dNFT-web-app/
├── app/                        # Next.js app router
│   ├── layout.tsx             # Root layout
│   ├── page.tsx               # Main page
│   └── globals.css            # Global styles
├── components/                 # React components
│   ├── Hero.tsx               # Hero section
│   ├── InfoSection.tsx        # Info section
│   ├── StyleTransferWorkshop.tsx  # Main workshop
│   ├── ImageSelector.tsx      # NFT image selector
│   ├── WalletConnect.tsx      # Wallet connection
│   └── MintSuccessModal.tsx   # Success modal
├── hooks/                      # Custom React hooks
│   ├── useWallet.ts           # Wallet state management
│   ├── useStyleTransfer.ts    # Style transfer logic
│   └── useNFTs.ts             # NFT operations
├── utils/                      # Utility functions
│   ├── constants.ts           # App constants
│   ├── ipfs.ts                # IPFS upload
│   ├── styleTransfer.ts       # ML engine
│   └── wallet.ts              # Blockchain interaction
├── types/                      # TypeScript types
│   └── index.ts               # Type definitions
├── public/                     # Static assets
│   ├── images/                # Demo images
│   └── saved_model_*/         # TensorFlow models
└── package.json               # Dependencies

🧠 Neural Style Transfer

This app uses two neural networks:

  1. Style Network: Extracts 100-dimensional style representation

    • MobileNet (Fast, 9.6MB)
    • Inception (High Quality, 36.3MB)
  2. Transform Network: Applies style to content image

    • Separable Conv2D (Fast, 2.4MB)
    • Original (High Quality, 7.9MB)

All processing happens in your browser using TensorFlow.js with WebGL acceleration.

🔗 Smart Contract

The dApp uses a custom CW721-compatible contract with metadata extensions:

{
  "mint": {
    "token_id": "content_nft+style_nft",
    "owner": "terra1...",
    "extension": {
      "external_url": "https://ipfs.io/ipfs/...",
      "derivative": {
        "method": "styletransfer",
        "params": "mobilenet:separable:100:256:256",
        "source_ids": ["content_nft", "style_nft"]
      }
    }
  }
}

🌐 Demo Mode

The app starts in demo mode with sample images. Connect your Keplr wallet to:

  • Access your actual NFT collection
  • Mint derivative NFTs on-chain
  • Store artworks on IPFS

📞 Contact & Support

About

DNFT mint site where users can easily mint and manage dynamic NFTs.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors