Skip to content

cridiv/Dallnk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dallnk - Decentralized Data Bounty Platform

A decentralized data sharing and verification platform built on Filecoin with AI-powered validation

Next.js Filecoin AI Powered TypeScript

🌟 Overview

Dallnk is a revolutionary decentralized platform that connects data requesters with data providers through a transparent bounty system. Built on the Filecoin network for decentralized storage and powered by advanced AI agents for automated verification, Dallnk ensures data integrity, accessibility, and fair compensation.

🎯 Key Features

  • πŸ—„οΈ Decentralized Storage: Built on Filecoin's robust infrastructure using Storacha/IPFS
  • πŸ€– AI-Powered Verification: Automated data validation using Gemini 2.0 Flash
  • πŸ’° Smart Contract Bounties: Transparent, automated payment system
  • πŸ” Secure Transactions: Blockchain-based trust and transparency
  • πŸ“Š Real-time Tracking: Monitor bounty status and submissions in real-time
  • 🎨 Modern UI: Responsive design with smooth animations

πŸ“‹ Table of Contents

πŸ—οΈ Architecture

graph TB A[User Interface] --> B[Next.js Frontend] B --> C[Smart Contract Layer] B --> D[AI Verification Service] B --> E[Filecoin Storage] C --> F[Filecoin Testnet] D --> G[Gemini AI API] E --> H[Pinata/IPFS] subgraph "Decentralized Infrastructure" F H end subgraph "AI Services" G end 
Loading

Core Components

  1. Frontend Layer: Next.js 15.5.4 with TypeScript and TailwindCSS
  2. Blockchain Layer: Filecoin testnet smart contracts
  3. Storage Layer: Pinata with IPFS
  4. AI Layer: Google Gemini 2.0 Flash for data verification
  5. Authentication: MetaMask wallet integration

πŸ“ Filecoin Integration

Decentralized Storage Architecture

Dallnk leverages Filecoin's decentralized storage network to ensure data permanence, accessibility, and censorship resistance.

Storage Flow

// Storage Implementation (app/utils/web3storage.ts) interface StorageResult { success: boolean; cid?: string; error?: string; } // Upload to Filecoin via Pinata export const uploadToFilecoin = async ( file: File, email: string ): Promise<StorageResult> => { // Creates IPFS CID and stores on Filecoin network // Returns permanent content identifier };

Key Storage Features

1. IPFS Content Addressing

// Each file gets a unique Content Identifier (CID) const cid = "bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi"; const ipfsUrl = `https://w3s.link/ipfs/${cid}`;

2. Decentralized Retrieval

// Files accessible from any IPFS gateway const gateways = [ "https://w3s.link/ipfs/", "https://ipfs.io/ipfs/", "https://gateway.pinata.cloud/ipfs/", ];

3. Storage Verification

  • Cryptographic Proof: Each file upload generates a unique hash
  • Immutability: Content cannot be altered without changing the CID
  • Redundancy: Files replicated across multiple Filecoin storage providers

Storage Benefits

Traditional Storage Filecoin Storage
Centralized servers Distributed network
Single point of failure Redundant storage
Vendor lock-in Interoperable
Censorship risk Censorship resistant
Limited lifecycle Permanent storage

πŸ€– AI Agent System

Intelligent Data Verification

Dallnk employs advanced AI agents powered by Google's Gemini 2.0 Flash model to automatically verify data submissions against bounty requirements.

AI Verification Pipeline

// AI Verification Flow (app/api/verify/route.ts) interface VerificationRequest { cid: string; // IPFS content identifier requirements: string; // Bounty requirements fileType: string; // MIME type fileSize: number; // File size in bytes } interface VerificationResult { isValid: boolean; // Verification outcome confidence: number; // AI confidence score (0-1) reasoning: string; // Detailed explanation issues?: string[]; // Identified concerns }

AI Analysis Criteria

1. Format Compatibility

// AI evaluates file format against requirements const formatAnalysis = { expectedTypes: ["CSV", "JSON", "PDF"], actualType: "text/csv", compatibility: true, score: 0.95, };

2. Content Relevance

// Semantic analysis of data relevance const contentAnalysis = { requirements: "Financial quarterly data", dataDescription: "Q3 2024 revenue reports", relevanceScore: 0.87, keywordMatch: true, };

3. Quality Assessment

// Data quality indicators const qualityMetrics = { fileSize: "appropriate", // Size vs content type structure: "well-formatted", // Data organization completeness: "comprehensive", // Information coverage reliability: 0.91, // Overall quality score };

AI Security Features

Server-Side Processing

// Secure API endpoint (app/api/verify/route.ts) export async function POST(request: NextRequest) { // API key secured server-side const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY); // Comprehensive prompt engineering const prompt = `  Analyze this data submission for a bounty request:  - IPFS CID: ${cid}  - Requirements: ${requirements}  - File Type: ${fileType}  - File Size: ${fileSize} bytes    Provide structured verification with confidence scoring.  `; }

Fallback Mechanisms

// Graceful degradation when AI unavailable const fallbackVerification = { basicFormatCheck: true, sizeValidation: true, defaultApproval: false, // Conservative approach humanReviewRequired: true, };

AI Verification Advantages

  • Automated Processing: Instant verification without human intervention
  • Consistent Standards: Uniform evaluation criteria across all submissions
  • Scalability: Handle thousands of submissions simultaneously
  • Cost Efficiency: Reduce manual review overhead
  • 24/7 Availability: Continuous operation without downtime

πŸ’Ό Smart Contract Layer

Bounty Management System

Smart contracts handle all bounty lifecycle management on the Filecoin testnet.

Contract Architecture

// Core data structure struct DataRequest { uint256 id; string description; string requirements; uint256 bounty; address requester; address assignedMiner; string ipfsHash; bool isVerified; bool isPaid; uint256 timestamp; }

Key Functions

// Bounty creation announceDataRequest(description: string, requirements: string) // Data submission submitDataForRequest(requestId: uint256, ipfsHash: string) // Verification (by bounty creator) verifySubmittedData(requestId: uint256, isValid: bool) // Payment release confirmAndPay(requestId: uint256)

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • MetaMask wallet
  • Filecoin testnet tokens (tFIL)

Installation

  1. Clone the repository
git clone https://github.com/cridiv/Dallnk.git cd Dallnk/dallnk-frontend
  1. Install dependencies
npm install
  1. Environment setup
# Create .env.local file DALLNK_GEMINI_API_KEY=your_gemini_api_key PINATA_JWT=your_pinata_jwt
  1. Run development server
npm run dev
  1. Access the application
http://localhost:3000 

Network Configuration

Configure MetaMask for Filecoin testnet:

{ "chainId": "0x4CB2F", "chainName": "Filecoin Testnet", "rpcUrls": ["https://api.calibration.node.glif.io/rpc/v1"], "nativeCurrency": { "name": "testnet filecoin", "symbol": "tFIL", "decimals": 18 }, "blockExplorerUrls": ["https://calibration.filscan.io/"] }

πŸ“– API Documentation

Bounty Management APIs

Create Bounty

POST /api/bounty/create { "description": "Financial quarterly data needed", "requirements": "CSV format with revenue data", "bounty": "10" // tFIL amount }

AI Verification

POST /api/verify { "cid": "bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi", "requirements": "Detailed requirements string", "fileType": "text/csv", "fileSize": 1024000 } Response: { "isValid": true, "confidence": 0.87, "reasoning": "File format and content align with requirements", "issues": [] }

Storage APIs

File Upload

// Upload to Filecoin via Pinata const result = await uploadToFilecoin(file, email); // Returns: { success: true, cid: "bafybeig..." }

File Download

// Download from IPFS const url = `https://w3s.link/ipfs/${cid}`; await downloadFromIPFS(cid, filename);

πŸ“š Usage Guide

For Data Requesters

  1. Connect Wallet: Link your MetaMask wallet
  2. Create Bounty: Define requirements and set reward amount
  3. Review Submissions: Use AI-powered verification
  4. Release Payment: Approve and pay for accepted data

For Data Providers

  1. Browse Bounties: Explore available data requests
  2. Upload Data: Submit files to Filecoin storage
  3. Await Verification: AI agent validates your submission
  4. Receive Payment: Get compensated for approved data

Workflow Example

// 1. Data Requester creates bounty const bounty = await createBounty({ description: "E-commerce transaction data", requirements: "JSON format, 2023 data, minimum 10k records", amount: ethers.parseEther("25"), // 25 tFIL }); // 2. Data Provider submits data const submission = await submitData({ bountyId: bounty.id, file: transactionData, description: "Q1-Q4 2023 e-commerce transactions", }); // 3. AI verification runs automatically const verification = await verifyWithAI({ cid: submission.cid, requirements: bounty.requirements, }); // 4. Bounty creator reviews and approves if (verification.isValid && verification.confidence > 0.8) { await acceptSubmission(bounty.id); await releasePayment(bounty.id); }

🌐 Deployment

Vercel Deployment (Recommended)

  1. Connect repository to Vercel
  2. Set environment variables:
    DALLNK_GEMINI_API_KEY=your_key_here NPINATA_JWT=your_jwt 
  3. Deploy: Automatic deployment on git push

Build Configuration

// package.json { "scripts": { "build": "next build", "start": "next start" } }

Production Considerations

  • API Rate Limits: Implement rate limiting for AI verification
  • Storage Quotas: Monitor Pinata usage limits
  • Gas Optimization: Optimize smart contract interactions
  • Error Handling: Comprehensive error tracking and recovery

πŸ”§ Configuration

TailwindCSS Setup

// tailwind.config.js module.exports = { content: ["./app/**/*.{js,ts,jsx,tsx,mdx}"], theme: { extend: { colors: { "filecoin-blue": "#0090ff", "ai-purple": "#7c3aed", }, }, }, };

Next.js Configuration

// next.config.js /** @type {import('next').NextConfig} */ const nextConfig = { experimental: { serverActions: true, }, images: { domains: ["w3s.link", "ipfs.io"], }, };

πŸ›‘οΈ Security

Data Protection

  • End-to-End Encryption: Files encrypted before upload
  • Access Control: Smart contract-based permissions
  • Immutable Records: Blockchain transaction history

AI Security

  • Server-Side Processing: API keys never exposed to client
  • Input Validation: Comprehensive request sanitization
  • Rate Limiting: Prevent API abuse

Smart Contract Security

  • Audit Ready: Clean, documented contract code
  • Access Controls: Role-based permission system
  • Reentrancy Protection: Secure payment mechanisms

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Code Standards

  • TypeScript: Strict type checking enabled
  • ESLint: Consistent code formatting
  • Testing: Comprehensive test coverage
  • Documentation: Clear code comments

πŸ“„ License

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

πŸ™ Acknowledgments

  • Filecoin Foundation: For decentralized storage infrastructure
  • Google AI: For Gemini API access
  • Next.js Team: For the excellent React framework
  • Pinata: For seamless IPFS integration

πŸ‘¨β€πŸ’» Authors

Aderemi Ademola – (X: @crid_iv) Olaniyi Ezekiel – (X: @) Peters Joshua – (X: @joshpet77)


Built with ❀️ by the Dallnk team

Empowering decentralized data sharing through AI and blockchain technology

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •