Skip to content

shriyaabalaji/AdventureChain

Repository files navigation

AdventureChain 🗺️

Your Onchain Quest Log of Adventures and Side Quests - A personal, onchain record of exploration and growth built on Base.

🌐 Live Demo | 📖 Documentation

AdventureChain is a soulbound NFT application that allows users to mint a unique "quest" onchain each day they complete an adventure. Each quest is a small, immutable record of your journey—permanently stored on Base L2.

Try it now: Visit https://adventure-chain.vercel.app/

Table of Contents

Overview

AdventureChain enables users to create a permanent, onchain record of their daily adventures and side quests. Each quest is:

  • Non-transferable (soulbound) - Your adventure log is permanently yours
  • Daily limit - One quest per day to encourage consistent exploration
  • Rich metadata - Adventure type, timestamp, and optional notes stored onchain
  • Visualized - Beautiful bracelet visualization showing your journey
  • Social - Share adventures with friends, create groups, and send challenges

Built on Base L2 for low fees and fast transactions, making daily quest logging practical and seamless.

Features

  • Daily Quest Minting - Mint one quest per day when you complete an adventure
  • Soulbound NFTs - Quests are non-transferable, permanently yours
  • Rich Adventure Types - Categorize your adventures (Explore, Quest, Discover, Learn, Create, etc.)
  • Optional Notes - Add personal reflections to each quest
  • Bracelet Visualization - Beautiful visual representation of your adventure journey
  • Social Features - Add friends, create groups, and send challenges
  • Base L2 Integration - Low fees make daily minting practical
  • Mini App Support - Works as a Base Mini App and Farcaster Mini App
  • OnchainKit Integration - Seamless wallet connection and transactions
  • Onchain Metadata - All quest data stored onchain with custom tokenURI

Problem Being Solved

The Challenge

People want to grow, explore, and try new things, but:

  1. Life gets busy - Easy to forget daily adventures
  2. No permanent record - Notes apps or journals can be lost
  3. Lack of motivation - No satisfying visual representation of progress
  4. Isolated tracking - Existing apps are siloed and boring
  5. No social engagement - Can't share or challenge friends

Our Solution

AdventureChain provides:

  • Immutable onchain record - Your adventure log can't disappear
  • Visual satisfaction - See your bracelet grow over time
  • Daily commitment - One quest per day encourages consistency
  • Social engagement - Challenge friends, create groups, share adventures
  • Composable data - Onchain data can power future tools and visualizations
  • No vendor lock-in - Your data lives onchain, not in a proprietary database

Layer 2 Advantages

Base L2 provides critical advantages for AdventureChain:

  1. Low Fees - Daily minting is economically feasible (fractions of a cent vs. dollars on L1)
  2. Fast Finality - Transactions confirm quickly, providing immediate feedback
  3. Full EVM Compatibility - Standard tooling works out of the box
  4. Scalability - Can handle millions of users minting daily
  5. Ecosystem Integration - Works seamlessly with Base app, wallets, and tools

Without L2, daily minting would cost prohibitive amounts in gas fees, making the concept impractical for regular use. Base's low fees enable users to mint quests daily without financial burden.

EVM Stack Usage

  • Solidity 0.8.19 - Smart contract development
  • OpenZeppelin Contracts - Battle-tested ERC-721 implementation
  • Hardhat - Development environment and deployment
  • viem/wagmi - Type-safe Ethereum interactions
  • OnchainKit - Base-specific wallet and UI components
  • Base SDK / MiniKit - Base Mini App framework
  • Next.js 15 - React framework with API routes
  • React 19 - Modern React with hooks and server components

Architecture Overview

┌─────────────────────────────────────────┐
│         Frontend (Next.js)              │
│  ┌──────────────┐  ┌──────────────┐     │
│  │ Quest Form   │  │ Bracelet     │     │
│  │              │  │ Viewer       │     │
│  └──────┬───────┘  └──────┬───────┘     │
│         │                 │             │
│  ┌──────┴─────────────────┴──────┐      │
│  │   React Hooks (useCurioChain)  │     │
│  └──────────────┬─────────────────┘     │
└─────────────────┼───────────────────────┘
                  │
        ┌─────────┴──────────┐
        │  OnchainKit/wagmi  │
        └─────────┬──────────┘
                  │
        ┌─────────┴──────────┐
        │   Base L2 Network  │
        └─────────┬──────────┘
                  │
        ┌─────────┴──────────┐
        │ CurioChain.sol     │
        │ (ERC-721 Soulbound)│
        └────────────────────┘

Data Flow

  1. User Action: User fills out quest form and clicks "Complete Adventure"
  2. Transaction: Frontend calls mintBead() via wagmi hook
  3. Smart Contract: Contract validates (daily limit check) and mints NFT
  4. Event Emitted: BeadMinted event with all metadata
  5. Frontend Update: Query contract for updated quest list and display

Key Components

  • Smart Contract (contracts/CurioChain.sol):

    • Manages quest minting
    • Enforces daily limits
    • Prevents transfers (soulbound)
    • Stores metadata onchain with custom tokenURI
  • Frontend Hooks (lib/hooks/useCurioChain.ts):

    • Wrapper around wagmi hooks
    • Provides easy-to-use functions for minting and querying
    • Handles loading states and errors
  • UI Components:

    • MintBeadForm: Form for creating new quests
    • ChainVisualization: Visual display of all quests as a bracelet
    • FriendsView: Manage and view friends' adventure logs
    • GroupsView: Create groups and view combined bracelets
    • ChallengesView: Send and manage challenges

Prerequisites

Before getting started, ensure you have:

  • Node.js 18+ and npm/yarn/pnpm
  • A Base app account
  • A Farcaster account (optional, for Mini App features)
  • Coinbase Developer Platform account for OnchainKit API key
  • A wallet with some ETH on Base Sepolia (for testing)
  • Vercel account (for deployment)

Setup Instructions

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/adventurechain.git
cd adventurechain

2. Install Dependencies

npm install

3. Set Up Environment Variables

Copy the example environment file:

cp env.example .env.local

Edit .env.local and add your configuration:

NEXT_PUBLIC_ONCHAINKIT_API_KEY=your_api_key_here
NEXT_PUBLIC_CHAIN=sepolia
PRIVATE_KEY=your_private_key_for_deployment  # Keep this secret!
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
NEXT_PUBLIC_URL=http://localhost:3000

Getting your OnchainKit API Key:

  1. Go to Coinbase Developer Platform
  2. Create a new project
  3. Copy your API key to NEXT_PUBLIC_ONCHAINKIT_API_KEY

4. Compile Smart Contracts

npm run compile

This compiles the AdventureChain smart contract using Hardhat.

Local Development

Start the Development Server

npm run dev

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

Connect Your Wallet

  1. The app will prompt you to connect your wallet
  2. Make sure you're connected to Base Sepolia network
  3. Authenticate using Farcaster (for Mini App features)

Testing the App

  1. Complete a Quest:

    • Select an adventure type
    • Add optional notes
    • Click "Complete Adventure"
    • Approve the transaction in your wallet
  2. View Your Adventure Log:

    • Click the "Adventure Log" tab
    • See all your quests in chronological order as a bracelet
  3. Social Features:

    • Add friends by wallet address
    • Create groups
    • Send challenges to friends or groups

Contract Deployment

Deploy to Base Sepolia (Testnet)

  1. Get Testnet ETH:

  2. Update Environment Variables:

    PRIVATE_KEY=your_wallet_private_key
    BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
  3. Deploy the Contract:

    npm run deploy:sepolia
  4. Save the Contract Address:

    • Copy the deployed address from the console
    • Update lib/contract.ts with the new address:
      export const CURIOCHAIN_CONTRACT_ADDRESS: Record<number, Address> = {
        [baseSepolia.id]: "YOUR_DEPLOYED_ADDRESS_HERE" as Address,
        // ...
      };
    • Or set NEXT_PUBLIC_CONTRACT_ADDRESS_SEPOLIA in .env.local
  5. Verify on BaseScan (optional):

    npx hardhat verify --network baseSepolia YOUR_CONTRACT_ADDRESS

Deploy to Base Mainnet

  1. Update Environment Variables:

    PRIVATE_KEY=your_wallet_private_key
    BASE_MAINNET_RPC_URL=https://mainnet.base.org
    NEXT_PUBLIC_CHAIN=mainnet
  2. Deploy:

    npm run deploy:base
  3. Update Contract Address in lib/contract.ts or environment variables

Environment Variables

Variable Description Required
NEXT_PUBLIC_ONCHAINKIT_API_KEY Coinbase Developer Platform API key Yes
NEXT_PUBLIC_CHAIN Network: sepolia or mainnet Yes
PRIVATE_KEY Wallet private key for deployment For deployment
BASE_SEPOLIA_RPC_URL Base Sepolia RPC endpoint Optional
BASE_MAINNET_RPC_URL Base Mainnet RPC endpoint Optional
NEXT_PUBLIC_CONTRACT_ADDRESS_SEPOLIA Deployed Sepolia contract address After deployment
NEXT_PUBLIC_CONTRACT_ADDRESS_MAINNET Deployed Mainnet contract address After deployment
NEXT_PUBLIC_URL App URL (for production) For production

Deployment

Live Demo

AdventureChain is currently deployed and accessible at: 🌐 https://adventure-chain.vercel.app/

Anyone can visit this link to use AdventureChain directly in their browser. Connect your wallet to Base Sepolia and start completing adventures!

Deploy to Vercel

  1. Push to GitHub (if not already):

    git add .
    git commit -m "AdventureChain implementation"
    git push
  2. Deploy to Vercel:

    vercel --prod
  3. Add Environment Variables in Vercel Dashboard:

    • Go to your project settings
    • Add all environment variables from .env.local
    • Update NEXT_PUBLIC_URL with your Vercel URL (e.g., https://adventure-chain.vercel.app)
  4. Update Contract Address:

    • Update the contract address in your code or environment variables
    • Redeploy if needed

Update Mini App Manifest

  1. Your deployed URL: https://adventure-chain.vercel.app

  2. Update minikit.config.ts with your production URL

  3. Follow Base Mini App guide for account association

Acknowledgments

  • Built with Base infrastructure
  • Uses OnchainKit for wallet integration

About

An Onchain Quest Log of Adventures and Side Quests - Built on Base L2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors