Skip to content

publishednft/publishednftwebapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,233 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Published NFT - Flow Blockchain Bookstore Platform

🏆 Flow Forte Hacks 2025 Hackathon Submission

Flow Testnet Smart Contracts Cadence 1.0 Flow Forte Next.js 14 WebXR Dapper Intergration

📊 Executive Summary

Published NFT is the world's most advanced NFT bookstore platform built on Flow blockchain, featuring VR/AR immersive reading, 14 autonomous onchain agents, AI-powered content generation, and a hybrid analytics system combining FindLabs, Alchemy, SimpleHash, and Dune Analytics.

🚀 Innovation Highlights

1. 🥽 VR/AR Immersive Reading (World's First WebXR NFT Books)

Transform NFT books into immersive VR/AR experiences with natural hand tracking.

Supported Devices:

  • VR: Meta Quest 2/3/Pro, Apple Vision Pro, HTC Vive, Valve Index
  • AR: iPhone (iOS 17+), Android ARCore

Key Features:

  • 👋 Hand Tracking - Pinch to flip pages
  • 🎮 Controller Support - All VR controllers
  • 🌍 Immersive Environments - Library, space, forest
  • 📖 Natural Interactions - Point, click, grab
  • ⚡ Performance - 90 FPS in VR

Components: components/vr-ar-toggle-button.tsx, components/xr-immersive-book-viewer.tsx, components/xr-book-scene.tsx


2. ⚡ Flow Forte v0.43.2 - 14 Autonomous Agents

No offchain schedulers needed - Fully autonomous onchain agents with native time triggers.

Agent Interval Purpose
ReaderRewardsAgent 10 min Auto-distribute $PAGE tokens
TimeLockNFTAgent Daily Rental expiration automation
PublishedDailyAgent Daily Daily newspaper minting
NFTStakingAgent Real-time Staking rewards
PriceOracleAgent Hourly Price feed updates
TradingSessionAgent Session Trading management
...and 8 more Various Full platform automation

Autonomous Agent Operations (Detailed Examples)

How Flow Forte Agents Work:

Flow Forte's scheduled transactions enable fully autonomous onchain agents with native time-based triggers. No offchain schedulers, no cron jobs, no background workers - just pure onchain automation.

1. RentalExpirationAgent (Daily at Midnight UTC)

access(all) resource RentalExpirationAgent {
    access(all) let schedule: UFix64 = 86400  // 24 hours

    access(all) fun execute() {
        // Scan all active rentals
        for rental in activeRentals {
            if getCurrentBlock().timestamp > rental.expirationTime {
                // Automatically return NFT to original owner
                let nft <- rental.collection.withdraw(withdrawID: rental.nftID)
                rental.owner.deposit(token: <-nft)

                emit RentalExpired(nftID: rental.nftID, renter: rental.renter)
            }
        }
    }
}

Real-World Example:

  • User rents "Pride and Prejudice" NFT for 7 days (rental fee: 1 FLOW)
  • Day 1-7: User reads book in VR, earns $PAGE rewards
  • Day 8 at midnight: Agent automatically transfers NFT back to owner's collection
  • Result: Trustless rental system, no manual returns, zero disputes

2. TimeLockNFTAgent (Daily)

Operation: Manages time-locked NFTs for vesting schedules and author releases.

Real-World Example:

  • Author creates Genesis Pass with 30-day lock period
  • Buyers can view metadata but cannot transfer/sell for 30 days
  • Day 31: Agent automatically unlocks all passes
  • Use Cases: ICO vesting, team allocations, pre-release books

3. ReaderRewardsAgent (Every 10 Minutes)

access(all) resource ReaderRewardsAgent {
    access(all) let interval: UFix64 = 600  // 10 minutes
    access(all) var rewardPerMinute: UFix128 = 0.001  // 24 decimal precision

    access(all) fun execute() {
        // Get all active reading sessions from last 10 minutes
        let sessions = getActiveReadingSessions()

        for session in sessions {
            // Calculate reward with UFix128 precision (no rounding errors)
            let reward = UFix128(session.minutesRead) * self.rewardPerMinute

            // Mint $PAGE tokens to reader
            let tokens <- PageToken.mintTokens(amount: reward)
            session.reader.deposit(from: <-tokens)
        }
    }
}

Real-World Example:

  • User reads "Quran" NFT in VR for 8 minutes
  • Every 10 minutes: Agent calculates rewards
  • Calculation: 8 min × 0.001 $PAGE/min = 0.008 $PAGE
  • Result: User earns passive income while reading sacred texts

4. PublishedDailyAgent (Daily at 6 AM UTC)

Operation: Fully automated daily NFT newspaper minting and distribution.

Workflow:

  1. 6:00 AM UTC: Agent wakes up
  2. Fetches latest news from academic-search-mcp (AI research papers)
  3. Generates article summaries with Anthropic Claude
  4. Creates cover image with AI
  5. Mints "Published Daily #305" NFT
  6. Airdrops to 100+ subscribers automatically

Real-World Example:

  • Every morning, new edition is minted
  • Subscribers receive NFT in their wallets
  • Contains AI-curated tech/science news
  • Fully autonomous: No manual publishing workflow

5. NFTStakingAgent (Real-time on stake/unstake events)

access(all) resource NFTStakingAgent {
    access(all) fun calculateRewards(
        nftValue: UFix128,
        stakedDays: UFix64,
        annualAPY: UFix128
    ): UFix128 {
        // UFix128 precision prevents rounding errors in micro-rewards
        let dailyRate = annualAPY / 365.0
        let reward = nftValue * UFix128(stakedDays) * dailyRate
        return reward
    }

    access(all) fun onUnstake(stakingPosition: StakingPosition) {
        let rewards = self.calculateRewards(
            nftValue: stakingPosition.nftValue,
            stakedDays: stakingPosition.durationDays,
            annualAPY: 0.03  // 3% APY for Genesis Pass
        )

        // Mint reward tokens with 24-decimal precision
        let rewardTokens <- PageToken.mintTokens(amount: rewards)
        stakingPosition.owner.deposit(from: <-rewardTokens)
    }
}

Real-World Example:

  • User stakes Genesis Pass V2 NFT (value: 25 FLOW, APY: 3%)
  • Staking duration: 30 days
  • Calculation: 25 FLOW × 30 days × (0.03 / 365) = 0.246575342465753424 $PAGE
  • UFix128 precision: All 24 decimals preserved (no rounding errors)
  • On unstake: Agent automatically mints and transfers exact reward amount

6. PriceOracleAgent (Hourly)

Operation: Fetches real-time floor prices from NFT marketplaces and updates onchain price feeds.

Data Sources:

  • NFTStorefrontV2 listings
  • FindLabs API
  • SimpleHash marketplace data
  • Alchemy NFT API

Real-World Example:

  • Hour 1: GenesisPassV2 floor price = 25.0 FLOW
  • Hour 2: New listing at 24.5 FLOW → Agent updates price feed
  • Hour 3: All marketplace integrations use latest price
  • Use Cases: Accurate loan collateral valuations, staking value calculations

7. TradingSessionAgent (Every 5-30 Minutes)

Operation: Manages active trading sessions and auto-cancels expired offers.

Real-World Example:

  • User A proposes swap: Genesis Pass ↔ BOAST6
  • NFT goes into escrow
  • User B doesn't respond for 30 minutes
  • Agent action: Returns Genesis Pass to User A, cancels trade
  • Benefit: No NFTs stuck in escrow forever

8. PageTokenAgent (Daily at Midnight UTC)

Operation: Automated tokenomics distribution based on protocol revenue.

Distribution Rules:

Protocol Revenue (100 $PAGE)
├─ Stakers: 40 $PAGE (40%)
├─ Treasury: 30 $PAGE (30%)
├─ Team: 20 $PAGE (20%)
└─ Community: 10 $PAGE (10%)

Real-World Example:

  • Daily protocol revenue: 100 $PAGE tokens
  • Agent executes:
    • Mints 40 $PAGE → Distributes to all stakers proportionally
    • Transfers 30 $PAGE → Treasury vault
    • Transfers 20 $PAGE → Team multi-sig wallet
    • Transfers 10 $PAGE → Community rewards pool
  • All automatic: No manual distribution transactions

9. ListingMonitorAgent (Real-time on marketplace events)

Operation: Detects suspicious marketplace activity and prevents wash trading.

Detection Patterns:

  • Same wallet buying/selling same NFT 10+ times/hour
  • Price manipulation (listing at 1000× floor price)
  • Coordinated pump-and-dump patterns

Real-World Example:

  • Wallet 0xABC buys Genesis Pass for 25 FLOW
  • Same wallet sells to 0xDEF for 26 FLOW
  • 0xDEF sells back to 0xABC for 27 FLOW
  • Agent flags: Wash trading detected after 3rd transaction
  • Action: Alerts moderators, potentially blocks wallet

10. PersonalStakingAgent (User-level, runs on user actions)

Operation: Each user gets their own personal staking agent for automated position management.

Features:

  • Auto-compounds rewards daily
  • Rebalances portfolio based on APY changes
  • Alerts user when better staking opportunities available

Real-World Example:

  • User stakes 3 NFTs: Genesis Pass (3% APY), BOAST6 (5% APY), Jeweled Hoard (7% APY)
  • Personal agent tracks all 3 positions individually
  • Daily: Auto-compounds earned rewards
  • Weekly: Checks if APY rates changed, suggests rebalancing
  • Result: Maximize yield without manual management

11. NFTSwapAgentV2 (Executes when both parties accept)

Operation: Atomic P2P NFT swaps with zero counterparty risk.

access(all) fun executeSwap(swapID: UInt64) {
    let swap = swaps[swapID]

    // Atomic execution (both transfers or neither)
    let nftA <- swap.userA.collection.withdraw(withdrawID: swap.nftA_ID)
    let nftB <- swap.userB.collection.withdraw(withdrawID: swap.nftB_ID)

    swap.userB.collection.deposit(token: <-nftA)
    swap.userA.collection.deposit(token: <-nftB)

    emit SwapCompleted(swapID: swapID, userA: swap.userA, userB: swap.userB)
}

Real-World Example:

  • User A has Genesis Pass (25 FLOW value)
  • User B has BOAST6 + Jeweled Hoard (25 FLOW combined value)
  • Both accept swap
  • Agent executes atomically:
    • Genesis Pass → User B
    • BOAST6 + Jeweled Hoard → User A
  • Result: Trustless multi-NFT swaps, zero escrow risk

12. PublishedDailyAgentV2 (Enhanced Daily at 6 AM UTC)

Operation: Advanced daily edition with full AI automation pipeline.

Workflow:

  1. Academic-search-mcp finds trending research papers
  2. Anthropic Claude generates article summaries
  3. xAI Grok writes creative headlines
  4. Google Gemini creates cover image
  5. Agent mints NFT with all content
  6. Distributes to subscribers via airdrop
  7. Posts to social media (X, Lens, Farcaster)

Real-World Example:

  • 6:00 AM: "AI Discovers New Cancer Treatment" (trending research)
  • 6:05 AM: Agent generates 500-word summary
  • 6:10 AM: Cover image created (futuristic medical lab)
  • 6:15 AM: "Published Daily #306" minted
  • 6:20 AM: Airdropped to 100 subscribers
  • Fully autonomous: Zero human intervention

13. TradingAgent (Real-time market making)

Operation: Automated trading strategies for $PAGE token liquidity.

Strategy:

  • Buy $PAGE when price drops >10% (support floor)
  • Sell $PAGE when price rises >20% (take profits)
  • Maintain 50/50 FLOW/$PAGE liquidity pool

Real-World Example:

  • $PAGE price: 1.00 FLOW
  • Price drops to 0.85 FLOW (-15%)
  • Agent buys: 100 $PAGE from treasury funds
  • Price stabilizes at 0.90 FLOW
  • Result: Automated market support, price stability

14. NFTListingAgent (Conditional auto-listing)

Operation: Users set rules for automatic marketplace listings.

User-Defined Rules:

// User sets rule
if (floorPrice > 30 FLOW) {
  listMyGenesisPass(price: floorPrice * 0.95)  // List 5% below floor
}

if (holdingTime > 90 days) {
  listAllBooks(priceStrategy: "gradualDecrease")
}

Real-World Example:

  • User owns Genesis Pass
  • Sets rule: "List if floor price > 30 FLOW at 29 FLOW"
  • Floor price reaches 32 FLOW
  • Agent automatically: Creates marketplace listing at 29 FLOW
  • Listing fills immediately (below floor)
  • Result: Automated profit-taking, no manual monitoring

Agent Coordination Example: Complete NFT Rental Lifecycle

Scenario: User rents "Pride and Prejudice" NFT for 7 days

Day 1 (00:00 UTC):

  1. User pays 1 FLOW rental fee
  2. NFT transferred to user's collection
  3. TradingSessionAgent records rental in escrow

Day 1-7: 4. User reads book in VR (8 hours total) 5. ReaderRewardsAgent (every 10 min) → Distributes 0.48 $PAGE tokens 6. User stakes earned $PAGE 7. NFTStakingAgent → Tracks staking position

Day 8 (00:00 UTC): 8. RentalExpirationAgent wakes up 9. Detects expired rental 10. Automatically returns NFT to original owner 11. PageTokenAgent → Distributes rental revenue (0.4 FLOW to owner, 0.3 FLOW to treasury)

Result: Entire rental lifecycle automated by 4 coordinating agents. Zero manual intervention.


Flow Actions: AIGenerationActions contract - Composable workflows for AI content generation.

UFix128 Precision: 24 decimal places for accurate royalties and micro-transactions.


3. 📚 97 Smart Contracts - 453K Lines of Cadence

Religious Text NFT Collections (World's First)

6 sacred text collections with complete readable content onchain:

Collection Features Testnet Address
QuranCollection Complete Quran with verses 0x4c55dc21a9da7476
TorahCollection Torah with chapters 0x4c55dc21a9da7476
HolyBibleCollection Holy Bible indexed 0x4c55dc21a9da7476
BhagavadGitaCollection Sanskrit + English 0x4c55dc21a9da7476
DhammapadaCollection Buddhist teachings 0x4c55dc21a9da7476
GuruGranthSahibCollection Sikh scriptures 0x4c55dc21a9da7476

Features: Free public minting (one per wallet), complete text onchain, MetadataViews compliant.

Premium Literary Collections

  • GenesisPassV2 - $25 premium access pass
  • Boast6EbookNFTV2 - Sports magazine ($7 DUC)
  • JeweledHoardCollection - Fantasy eBook
  • 49SyllablesOnLifeCollectionV3 - Poetry
  • PrideandPrejudiceeBook - Classic literature
  • ...and 26 more collections

4. 📊 Hybrid Analytics System

Multi-provider architecture for comprehensive NFT analytics:

Provider Cost Features
FindLabs FREE ✅ NFT events, real-time data (always enabled)
Alchemy Paid Metadata, holder tracking
SimpleHash Paid Sales history, marketplace data
Dune Analytics Paid Custom SQL (Flow EVM ready)

Benefits: 5-min caching, provider failover, cross-validation, future-proof.

Implementation: lib/analytics/ - Unified FlowAnalytics class with 4 providers.


5. 💳 Dual Payment Infrastructure

Web3 + Web2 payment methods for maximum conversion:

Dapper Wallet (DUC):

  • 12 frontend purchase hooks
  • Dual authorization pattern
  • Auto collection setup
  • 3 live collections (BOAST6, Jeweled Hoard, Genesis Pass)

Crossmint (Fiat):

  • Credit/Debit cards
  • Apple Pay / Google Pay
  • Email-based wallets
  • No crypto needed

Architecture:

User Purchase
    ├─ Web3: Dapper (DUC) → Flow wallet
    └─ Web2: Crossmint → Credit card → Flow blockchain

6. 🤖 AI Integration (4 Providers)

Multi-provider AI for content generation and reading assistance:

Providers:

  • Anthropic Claude - Reading assistant, Q&A, summaries
  • xAI Grok - Creative content generation
  • Google Gemini - Multi-modal storybook creation
  • OpenAI GPT - Text generation

Features:

  • /api/ai/summarize - Chapter summaries
  • /api/ai/answer - Q&A about books
  • /api/ai/study-materials - Flashcards, quizzes
  • /api/generate-cover - AI book covers
  • /api/generate-storybook - Full storybooks

MCP Servers: 14+ configured (flow-mcp, three-js-mcp, ebook-mcp, academic-search-mcp, etc.)


7. 📖 3D Visualization & EPUB Reading

9 EPUB Readers:

  • epub-reader-working.tsx - Production reader
  • epub-reader-with-ai.tsx - AI assistant integrated
  • epub-reader-with-rewards.tsx - Earn $PAGE tokens
  • advanced-epub-reader.tsx - 3D page flipping
  • ...and 5 more implementations

9 3D Components:

  • 3d-book-cover.tsx - Realistic 3D covers
  • 3d-showroom.tsx - Virtual showroom
  • 3d-bookshelf.tsx - Interactive shelf
  • ...and 6 more visualizations

Technology: Three.js v0.180.0, @react-three/fiber v8.18.0, EPUB.js v0.3.93


📈 Metrics & Achievements

Smart Contracts

  • Total Files: 656 Cadence files
  • Lines of Code: 453,610 lines
  • Deployed Contracts: 97 contracts
  • Autonomous Agents: 14 agents
  • NFT Collections: 40+ collections
  • Testnet Address: 0x4c55dc21a9da7476

Frontend

  • React Components: 297 components
  • API Routes: 80+ endpoints
  • 3D Components: 9 implementations
  • EPUB Readers: 9 implementations
  • VR/AR Components: 6 WebXR components

Integrations

  • AI Providers: 4 (Claude, Grok, Gemini, GPT)
  • Analytics: 4 (FindLabs, Alchemy, SimpleHash, Dune)
  • MCP Servers: 14+ configured
  • Payment Methods: 2 (Dapper, Crossmint)
  • Wallets: 5 (Dapper, Lilico, Flow Wallet, MetaMask, RainbowKit)

🚀 Deployment Status

Testnet

  • Network: Flow Testnet
  • Address: 0x4c55dc21a9da7476
  • Deployed: 97 contracts live
  • Flow CLI: v2.7.1 (latest)
  • FCL: v1.20.1 (latest)

Frontend

  • Platform: Vercel
  • Framework: Next.js 14.2.16
  • Build: ✅ Production Ready
  • Database: PostgreSQL + Drizzle ORM

Features Live

  • ✅ VR/AR WebXR reading
  • ✅ Religious text NFT claiming (free)
  • ✅ Dapper purchases (3 collections)
  • ✅ Crossmint fiat payments
  • ✅ Analytics dashboard
  • ✅ AI reading assistant
  • ✅ 3D book visualization
  • ✅ EPUB reader with rewards

🔗 Important Links

Deployed Contracts: https://testnet.flowscan.io/account/0x4c55dc21a9da7476 GitHub Repository: https://github.com/PublishedNFT/flow-bookstore Flow CLI: v2.7.1 FCL: v1.20.1 Cadence: 1.0


👥 Team

Published NFT Development Team

Specializations:

  • Smart Contract Development (Cadence)
  • Frontend Development (Next.js, React, TypeScript)
  • 3D Graphics & WebXR (Three.js)
  • AI Integration (Anthropic, xAI, Gemini, OpenAI)
  • Flow Forte Agents
  • Analytics Integration
  • Payment Infrastructure

Contact: mg@publishednft.io


🙏 Acknowledgments

  • Flow Foundation - Best blockchain for killer apps
  • Dapper Labs - Wallet integration
  • Crossmint - Fiat payments
  • Anthropic - Claude AI & MCP
  • FindLabs - Free NFT analytics
  • Dune Analytics - Flow EVM preparation
  • Alchemy - NFT API
  • SimpleHash - Multi-chain data
  • Vercel - Hosting
  • Flow Community - Support

Published NFT represents the pinnacle of Flow development:

  1. Technical Excellence - 97 contracts, 453K lines, 297 components
  2. Innovation - World's first WebXR books, sacred texts
  3. Flow Forte Mastery - 14 agents, Actions, UFix128
  4. Complete Integration - FindLabs, Dune, Alchemy, Dapper, Crossmint, 4 AI
  5. Production Ready - Live on testnet with real transactions
  6. Social Impact - Free religious texts for global education
  7. Future Vision - Flow EVM ready, WebAuthn prepared

About

Published NFT eBook Marketplace

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •