Skip to content

Tan0610/Sonic_IP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 Sonic SAT - Decentralized Audio NFT Platform with Identity Verification

A next-generation decentralized platform for recording, tokenizing, and managing audio content on the blockchain with Self Protocol identity verification. Built with Next.js, Filecoin, and IPFS for secure, permanent audio storage with privacy-first identity verification.

Sonic SAT Next.js Filecoin Self Protocol IPFS

⚑ Key Features

  • πŸ†” Self Protocol Identity Verification: Privacy-first identity verification using zero-knowledge proofs
  • πŸŽ™οΈ High-Quality Audio Recording: Record audio directly in browser with real-time waveform visualization
  • πŸ” Blockchain NFT Minting: Tokenize audio as NFTs on Filecoin Calibration testnet
  • πŸ“¦ Decentralized Storage: Permanent storage using Lighthouse and IPFS
  • πŸ›‘οΈ Verification Gates: Only verified users can create and tokenize audio content
  • πŸ’Ό Creator Dashboard: Manage your verified identity and audio NFT collection
  • πŸ”— Multi-Wallet Support: Connect with MetaMask, WalletConnect, and more via RainbowKit
  • 🌐 Production Ready: Enterprise-grade error handling and user experience

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15.3 - React framework with App Router and Turbopack
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first CSS framework
  • RainbowKit - Multi-wallet connection UI
  • Wagmi - React hooks for Ethereum
  • Ethers.js v6 - Ethereum library for blockchain interactions
  • Lucide React - Modern icon library

Identity & Verification

  • Self Protocol - Privacy-first identity verification
  • Zero-Knowledge Proofs - Age and identity verification without revealing personal data
  • Passport/Aadhaar Support - Multiple document types for global accessibility

Storage & Backend

  • Lighthouse SDK - IPFS file storage and encryption
  • IPFS - Decentralized file storage
  • Hardhat - Ethereum development environment
  • Solidity - Smart contract development
  • OpenZeppelin - Secure smart contract libraries

Blockchain & Network

  • Filecoin Calibration - Primary testnet for development and testing
  • Filecoin Mainnet - Production deployment target
  • EVM Compatibility - Works with Ethereum-compatible networks

πŸ“ Project Structure

SONIC_SAT/
β”œβ”€β”€ app/                           # Next.js App Router pages
β”‚   β”œβ”€β”€ buyer/                     # Buyer dashboard page
β”‚   β”œβ”€β”€ store/                     # Main audio recording & tokenization page
β”‚   β”œβ”€β”€ test-verification/         # Self Protocol testing page
β”‚   β”œβ”€β”€ verification-callback/     # Self Protocol callback handler
β”‚   β”œβ”€β”€ page.tsx                   # Homepage
β”‚   β”œβ”€β”€ layout.tsx                 # Root layout with providers
β”‚   β”œβ”€β”€ globals.css                # Global styles and CSS variables
β”‚   β”œβ”€β”€ providers.tsx              # Wagmi and RainbowKit providers
β”‚   └── index.tsx                  # App entry point
β”œβ”€β”€ components/                    # React components
β”‚   β”œβ”€β”€ SelfProtocolVerification.tsx  # Identity verification component
β”‚   β”œβ”€β”€ BuyerDashboardHeader.tsx   # Buyer dashboard header
β”‚   β”œβ”€β”€ BuyerDashboardLayout.tsx   # Buyer dashboard layout
β”‚   β”œβ”€β”€ AppRouter.tsx              # Application routing
β”‚   β”œβ”€β”€ Footer.tsx                 # Site footer
β”‚   β”œβ”€β”€ Header.tsx                 # Site header with wallet connection
β”‚   β”œβ”€β”€ WalletConnect.tsx          # Wallet connection component
β”‚   β”œβ”€β”€ FeatureTag.tsx             # Feature highlight tags
β”‚   └── StatCard.tsx               # Statistics display cards
β”œβ”€β”€ contracts/                     # Solidity smart contracts
β”‚   β”œβ”€β”€ SonicSelfVerification.sol  # Self Protocol verification contract
β”‚   └── SonicIPToken.sol           # Audio NFT token contract
β”œβ”€β”€ contexts/                      # React contexts
β”‚   β”œβ”€β”€ IPContext.tsx              # IP and user data context
β”‚   └── RoleContext.tsx            # User role management context
β”œβ”€β”€ hooks/                         # Custom React hooks
β”‚   └── useEthers.ts               # Ethers.js integration hooks
β”œβ”€β”€ lib/                           # Utility libraries and services
β”‚   β”œβ”€β”€ contractConfig.ts          # Contract addresses and ABIs
β”‚   β”œβ”€β”€ selfProtocolService.ts     # Self Protocol integration service
β”‚   β”œβ”€β”€ sonicIpContract.ts         # IP token contract utilities
β”‚   └── contract.ts                # Legacy contract configuration
β”œβ”€β”€ public/                        # Static assets
β”‚   β”œβ”€β”€ assets/                    # Images and media files
β”‚   β”‚   β”œβ”€β”€ background/            # Background images
β”‚   β”‚   └── logos/                 # Logo files
β”‚   └── favicon.ico                # Site favicon
β”œβ”€β”€ scripts/                       # Deployment and utility scripts
β”œβ”€β”€ .env.local                     # Local environment variables
β”œβ”€β”€ .env.production                # Production environment variables
β”œβ”€β”€ hardhat.config.js              # Hardhat blockchain development config
β”œβ”€β”€ next.config.ts                 # Next.js configuration with webpack
β”œβ”€β”€ tailwind.config.ts             # Tailwind CSS configuration
β”œβ”€β”€ tsconfig.json                  # TypeScript configuration
β”œβ”€β”€ package.json                   # Dependencies and scripts
└── README.md                      # This comprehensive guide

πŸš€ Getting Started - Complete Setup Guide

Prerequisites

Before setting up the project, ensure you have the following installed:

Step-by-Step Installation

1. Clone the Repository

git clone https://github.com/hedauav/SONIC.git
cd SONIC/SONIC_SAT

2. Install Dependencies

# Install all dependencies with legacy peer deps for compatibility
npm install --legacy-peer-deps

# Or if you prefer yarn
yarn install

Important: Use --legacy-peer-deps flag to handle dependency conflicts between packages.

3. Environment Configuration

Create a .env.local file in the root directory with the following variables:

# Lighthouse IPFS Configuration
NEXT_PUBLIC_LIGHTHOUSE_API_KEY=your_lighthouse_api_key_here

# Wallet Connect Configuration
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_walletconnect_project_id

# Self Protocol Configuration
NEXT_PUBLIC_SELF_ENDPOINT=https://api.self.xyz
NEXT_PUBLIC_SELF_APP_NAME=Sonic SAT
NEXT_PUBLIC_SELF_SCOPE=sonic-sat-verification

# Smart Contract Addresses (Filecoin Calibration Testnet)
NEXT_PUBLIC_SONIC_VERIFICATION_CONTRACT=0xe797FD53EE2254af2D2d35399486E53b7e6ba5d5
NEXT_PUBLIC_SONIC_IP_TOKEN_CONTRACT=0x332b7fefb103ce489b20D461bdDf253Fe305678E

# Network Configuration
NEXT_PUBLIC_NETWORK_NAME=Filecoin Calibration
NEXT_PUBLIC_NETWORK_RPC=https://api.calibration.node.glif.io/rpc/v1
NEXT_PUBLIC_CHAIN_ID=314159

4. Get Required API Keys

Lighthouse API Key:

  1. Visit lighthouse.storage
  2. Sign up for an account
  3. Generate an API key from your dashboard
  4. Add it to your .env.local file

WalletConnect Project ID:

  1. Visit cloud.walletconnect.com
  2. Create a new project
  3. Copy the Project ID
  4. Add it to your .env.local file

5. Install Self Protocol Mobile App

For identity verification, you'll need the Self Protocol app:

  • iOS: Search "Self Protocol" in App Store
  • Android: Search "Self Protocol" in Google Play Store

6. Configure MetaMask for Filecoin Calibration

Add Filecoin Calibration testnet to MetaMask:

  • Network Name: Filecoin Calibration
  • RPC URL: https://api.calibration.node.glif.io/rpc/v1
  • Chain ID: 314159
  • Currency Symbol: tFIL
  • Block Explorer: https://calibration.filfox.info/

7. Get Testnet FIL

Get testnet FIL for transactions:

  1. Visit faucet.calibration.fildev.network
  2. Enter your wallet address
  3. Request testnet FIL

8. Run the Development Server

npm run dev

The application will be available at http://localhost:3000

9. Verify Installation

  1. Frontend: Navigate to http://localhost:3000 - should load the homepage
  2. Wallet Connection: Click "Connect Wallet" - should show wallet options
  3. Network: Ensure MetaMask is connected to Filecoin Calibration
  4. Self Protocol: Go to /store page and test identity verification

🎯 Platform Usage Guide

Complete User Flow

1. Identity Verification (Required First Step)

Self Protocol Verification:

  1. Navigate to /store page
  2. Connect your Web3 wallet to Filecoin Calibration
  3. Complete Self Protocol identity verification:
    • Scan QR code with Self Protocol mobile app
    • Take photo of passport or Aadhaar card
    • Complete selfie verification
    • Wait for proof generation
  4. Verification is recorded on blockchain (valid for 30 days)

Alternative Verification:

  • If Self Protocol fails, use the "Alternative Verification" option
  • This provides temporary verification for development/testing

2. Audio Recording & Creation

Recording Process:

  1. After verification, access the recording interface
  2. Grant microphone permissions when prompted
  3. Click record button to start recording
  4. Monitor real-time waveform visualization
  5. Click stop to end recording
  6. Preview your audio with playback controls

Audio Upload:

  1. Click "Upload to IPFS" after recording
  2. Audio is encrypted and stored on IPFS via Lighthouse
  3. Receive IPFS hash for permanent storage
  4. Audio is now ready for tokenization

3. NFT Tokenization

Minting Process:

  1. Enter NFT metadata:
    • Token Name: Descriptive name for your audio NFT
    • Description: Detailed description of the content
    • Creator Info: Your verified identity information
  2. Review gas fees and transaction details
  3. Click "Tokenize & Store on Blockchain"
  4. Confirm transaction in MetaMask
  5. Wait for blockchain confirmation
  6. Receive NFT token ID and transaction hash

4. Collection Management

My Collection Features:

  1. Navigate to collection page
  2. View all your tokenized audio NFTs
  3. Play audio directly from IPFS
  4. View NFT metadata and blockchain details
  5. Share IPFS links with others
  6. Track verification status and expiry

πŸ”§ Smart Contract Development & Deployment

Local Development

1. Compile Contracts

npx hardhat compile

2. Run Local Tests

npx hardhat test

3. Deploy to Local Network

# Start local Hardhat network
npx hardhat node

# Deploy contracts (in another terminal)
npx hardhat run scripts/deploy.js --network localhost

Testnet Deployment (Filecoin Calibration)

1. Configure Hardhat for Filecoin

Update hardhat.config.js with Filecoin Calibration network:

networks: {
  calibration: {
    url: "https://api.calibration.node.glif.io/rpc/v1",
    accounts: [process.env.PRIVATE_KEY],
    chainId: 314159
  }
}

2. Deploy to Calibration Testnet

npx hardhat run scripts/deploy.js --network calibration

3. Update Contract Addresses

After deployment, update the contract addresses in:

  • lib/contractConfig.ts
  • .env.local
  • .env.production

Production Deployment (Filecoin Mainnet)

# Deploy to Filecoin mainnet
npx hardhat run scripts/deploy.js --network filecoin

# Verify contracts (if supported)
npx hardhat verify --network filecoin <CONTRACT_ADDRESS>

πŸ“¦ Build & Deployment

Development Build

npm run dev

Production Build

# Build the application
npm run build

# Start production server
npm run start

# Or deploy to Vercel/Netlify
vercel --prod

Build Verification

# Check for build errors
npm run build

# Run type checking
npm run type-check

# Run linting
npm run lint

🌐 Supported Networks & Contracts

Primary Network

  • Filecoin Calibration Testnet (Development)
    • Chain ID: 314159
    • RPC: https://api.calibration.node.glif.io/rpc/v1
    • SonicSelfVerification: 0xe797FD53EE2254af2D2d35399486E53b7e6ba5d5
    • SonicIPToken: 0x332b7fefb103ce489b20D461bdDf253Fe305678E

Production Network

  • Filecoin Mainnet (Production)
    • Chain ID: 314
    • RPC: https://api.node.glif.io/rpc/v1
    • Contracts: TBD (deploy when ready for production)

πŸ”‘ Complete Environment Variables Reference

Required Variables

Variable Description Example
NEXT_PUBLIC_LIGHTHOUSE_API_KEY Lighthouse IPFS storage API key 7d4a2b8c...
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID WalletConnect project identifier a1b2c3d4...

Self Protocol Configuration

Variable Description Default
NEXT_PUBLIC_SELF_ENDPOINT Self Protocol API endpoint https://api.self.xyz
NEXT_PUBLIC_SELF_APP_NAME Application name for Self Protocol Sonic SAT
NEXT_PUBLIC_SELF_SCOPE Verification scope identifier sonic-sat-verification

Smart Contract Addresses

Variable Description Testnet Address
NEXT_PUBLIC_SONIC_VERIFICATION_CONTRACT Self Protocol verification contract 0xe797FD53EE2254af2D2d35399486E53b7e6ba5d5
NEXT_PUBLIC_SONIC_IP_TOKEN_CONTRACT Audio NFT token contract 0x332b7fefb103ce489b20D461bdDf253Fe305678E

Network Configuration

Variable Description Value
NEXT_PUBLIC_NETWORK_NAME Display name for network Filecoin Calibration
NEXT_PUBLIC_NETWORK_RPC RPC endpoint URL https://api.calibration.node.glif.io/rpc/v1
NEXT_PUBLIC_CHAIN_ID Network chain identifier 314159

🚨 Troubleshooting Common Issues

Self Protocol Issues

"Proof Failed" Error:

  • Ensure good lighting when taking document photos
  • Use passport instead of other documents (higher success rate)
  • Check stable internet connection
  • Update Self Protocol mobile app to latest version
  • Try alternative verification if Self Protocol fails repeatedly

QR Code Not Loading:

  • Check browser console for errors
  • Ensure you're on Filecoin Calibration network
  • Refresh the page and try again
  • Use "Open in Self App" direct link as fallback

Wallet Connection Issues

MetaMask Not Connecting:

  • Ensure MetaMask is installed and unlocked
  • Check you're on the correct network (Filecoin Calibration)
  • Clear browser cache and cookies
  • Try refreshing the page

Network Configuration:

  • Manually add Filecoin Calibration network to MetaMask
  • Ensure RPC URL is correct: https://api.calibration.node.glif.io/rpc/v1
  • Chain ID must be 314159

Build & Development Issues

Dependency Conflicts:

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install --legacy-peer-deps

Environment Variables Not Loading:

  • Ensure .env.local file is in root directory
  • Restart development server after changing environment variables
  • Check variable names start with NEXT_PUBLIC_

IPFS Upload Failures:

  • Verify Lighthouse API key is correct
  • Check network connectivity
  • Ensure sufficient storage quota on Lighthouse account

πŸ”§ Development Scripts

# Development
npm run dev              # Start development server
npm run build           # Build for production
npm run start           # Start production server
npm run lint            # Run ESLint
npm run type-check      # Run TypeScript type checking

# Smart Contracts
npx hardhat compile     # Compile contracts
npx hardhat test        # Run contract tests
npx hardhat node       # Start local blockchain
npx hardhat clean      # Clean compiled artifacts

# Deployment
vercel --prod          # Deploy to Vercel
npm run build && npm run start  # Local production test

🀝 Contributing Guidelines

Development Workflow

  1. Fork & Clone

    git clone https://github.com/your-username/SONIC.git
    cd SONIC/SONIC_SAT
  2. Setup Development Environment

    npm install --legacy-peer-deps
    cp .env.example .env.local  # Configure your environment
  3. Create Feature Branch

    git checkout -b feature/your-feature-name
  4. Development Standards

    • Follow TypeScript strict mode
    • Use Tailwind CSS for styling
    • Write comprehensive tests for new features
    • Ensure Self Protocol integration works
    • Test on Filecoin Calibration testnet
  5. Testing Checklist

    • Wallet connection works
    • Self Protocol verification completes
    • Audio recording functions properly
    • IPFS upload succeeds
    • NFT minting works on testnet
    • No console errors
    • Responsive design works
  6. Submit Pull Request

    • Provide clear description of changes
    • Include screenshots/videos for UI changes
    • Reference any related issues
    • Ensure all tests pass

Code Style Guidelines

  • TypeScript: Use strict typing, avoid any
  • React: Use functional components with hooks
  • CSS: Use Tailwind CSS classes, avoid custom CSS
  • Naming: Use descriptive variable and function names
  • Comments: Document complex logic and Self Protocol integrations

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™ Acknowledgments & Credits

Core Technologies

Special Thanks

  • Filecoin Foundation for testnet support
  • Self Protocol team for identity verification infrastructure
  • Lighthouse team for IPFS storage solutions
  • Open source community for tools and libraries

πŸ“ž Support & Contact

Getting Help

Project Links

Maintainers


πŸš€ Quick Start Summary

# 1. Clone and setup
git clone https://github.com/hedauav/SONIC.git
cd SONIC/SONIC_SAT
npm install --legacy-peer-deps

# 2. Configure environment
cp .env.example .env.local
# Add your API keys to .env.local

# 3. Start development
npm run dev

# 4. Open browser
# Navigate to http://localhost:3000
# Connect wallet to Filecoin Calibration
# Complete Self Protocol verification
# Start creating audio NFTs!

🎡 Welcome to the future of decentralized audio content creation with privacy-first identity verification!


⚑ Powered by Filecoin, IPFS & Self Protocol

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors