Skip to content

hewi333/Solanax402-Hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Learn Earn

An autonomous AI agent that teaches Web3 concepts and rewards learners with SOL on Solana devnet

Built for Solana x402 Hackathon | Track 5: x402 Agent Application


Demo Video

πŸ“Ί Watch Live Demo

See Learn Earn in action: AI-powered education meets autonomous blockchain payments.


What Makes This Special

Learn Earn demonstrates the x402 protocol with production-ready integrations across two sponsor technologies:

πŸ€– Gradient Parallax Inference Integration

Distributed inference platform powering autonomous learning evaluation

  • 120B parameter model (gpt-oss-120b) evaluates student answers
  • Solved Gradient API function calling limitation through custom text parsing
  • Makes autonomous payment decisions without human approval
  • Technical Deep Dive β†’

πŸ’³ Coinbase CDP Integration

Embedded wallets that eliminate onboarding friction

  • Create Solana wallets without browser extensions
  • Zero-setup wallet experience for crypto newcomers
  • Full CDP SDK v2 implementation with auto-funding
  • Technical Deep Dive β†’

πŸ”’ x402 Protocol Integration

HTTP 402 "Payment Required" protocol implementation

  • Proper x402 protocol headers and status codes
  • Autonomous AI agent with payment authority
  • Real-time blockchain payment verification on Solana
  • Technical Deep Dive β†’

The Problem

Traditional educational platforms suffer from:

  • Low completion rates (lack of immediate incentives)
  • High friction for crypto newcomers (complex wallet setup)
  • Centralized certification with no blockchain verification
  • No autonomous payment systems for learning rewards

The x402 opportunity: Enable AI agents to autonomously evaluate learning progress and distribute cryptocurrency rewards without human intervention.


The Solution

An AI agent that autonomously:

  1. Delivers educational content about x402 and Solana
  2. Evaluates student answers using Gradient Parallax inference (120B parameter model)
  3. Decides when to issue rewards (0.01 SOL per correct answer)
  4. Executes blockchain transactions to distribute SOL
  5. Tracks progress and manages session economics

Payment Flow (Hackathon Demonstration):

This closed-loop payment system demonstrates technical feasibility of autonomous agent economics:

  • Treasury airdrops 0.04 SOL to new users
  • Users pay 0.03 SOL to unlock 3 learning modules
  • AI agent rewards 0.01 SOL per completed module
  • Total earned: 0.03 SOL (break even, net +0.01 SOL from airdrop)

Result: Proof-of-concept for autonomous payment loops. See Use Cases for real-world applications.


Key Features

AI-Powered Evaluation

  • Gradient Parallax distributed inference evaluates natural language answers
  • Progressive hint system for incorrect responses
  • OpenAI fallback ensures 99.9% uptime
  • Session state management with persistent storage

Autonomous Payment System

  • AI controls treasury wallet and signs transactions
  • Real-time SOL distribution (400ms Solana finality)
  • Transaction verification on-chain
  • Rate limiting prevents abuse

Flexible Wallet Support

  • Coinbase CDP embedded wallets (zero-extension)
  • Phantom wallet (browser extension)
  • Coinbase Wallet (browser extension)

On-Chain Transparency

  • All transactions verifiable on Solana Explorer
  • Open source codebase for full auditability
  • Treasury wallet publicly visible
  • Real blockchain interactions, not simulated

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Frontend (React + Solana Wallet Adapter)    β”‚
β”‚    Multi-Wallet Support: Phantom | CDP | Coinbase  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Backend AI Agent (Node.js + Express)          β”‚
β”‚  β€’ Gradient Parallax (primary): gpt-oss-120b       β”‚
β”‚  β€’ OpenAI (fallback): gpt-3.5-turbo                β”‚
β”‚  β€’ Payment decision logic                           β”‚
β”‚  β€’ Session management                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ Solana Web3.js
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Solana Devnet Blockchain               β”‚
β”‚  β€’ Treasury wallet (autonomous agent control)       β”‚
β”‚  β€’ User wallets (Phantom, CDP, Mobile)             β”‚
β”‚  β€’ Real SOL transactions (~400ms finality)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Frontend

  • React 19 + Vite
  • Solana Wallet Adapter (multi-wallet)
  • Coinbase Wallet SDK + CDP integration
  • Solana Mobile Wallet Adapter
  • Tailwind CSS + shadcn/ui

Backend

  • Node.js + Express REST API
  • Gradient Parallax inference (gpt-oss-120b, 120B params)
  • OpenAI API (fallback)
  • Solana Web3.js
  • Coinbase CDP SDK v2

Blockchain

  • Solana Devnet
  • Base58-encoded treasury keypair
  • Multiple wallet providers
  • Real transaction confirmations

Quick Start

Try It Live

Deployed App: [Add your deployment URL]

Run Locally

Prerequisites: Node.js 18+, Phantom or Coinbase Wallet

# Clone and install
git clone https://github.com/hewi333/Solanax402-Hackathon.git
cd Solanax402-Hackathon
npm install && cd backend && npm install && cd ..

# Configure environment
cp .env.example .env
cp backend/.env.example backend/.env

# Generate treasury wallet
cd backend && node generate-treasury-wallet.js

# Add keys to .env files (see DEPLOYMENT.md)

# Fund treasury at https://solfaucet.com

# Start services (two terminals)
cd backend && npm start      # Terminal 1: Backend (port 3001)
npm run dev                  # Terminal 2: Frontend (port 5173)

Full setup guide: See DEPLOYMENT.md


Use Cases

Immediate (Hackathon Demonstration)

  • Proof-of-concept: Closed-loop payment system demonstrates technical feasibility
  • x402 Protocol: HTTP 402 implementation with autonomous agent authority
  • Educational demo: Web3 concepts taught with instant SOL rewards

Real-World Applications (Post-Hackathon)

  • Sponsored Learning: Blockchain projects fund educational modules, learners earn tokens
  • Corporate Training: Companies pay for courses, employees earn rewards for completion
  • Developer Onboarding: Protocols reward developers for learning their tech stack
  • Certification NFTs: On-chain credentials proving skill mastery

Long-Term Vision

  • DAO-governed curriculum with community course creation
  • Multi-chain expansion with x402 protocol
  • Target: 100,000+ learners with verifiable on-chain credentials
  • Sustainable economics: Sponsors fund rewards, not closed-loop demonstration

Why This Wins

x402 Protocol Excellence

  • Proper HTTP 402 implementation with protocol headers
  • AI agent has autonomous payment authority
  • Real blockchain verification, not simulated
  • Consumer-facing application (judges can relate)

Technical Achievement

  • Solved Gradient Parallax limitation (no native function calling)
  • Dual-provider inference architecture (99.9% uptime)
  • Production-ready CDP integration (zero-extension onboarding)
  • 120B parameter distributed model makes autonomous decisions

Ecosystem Advancement

  • Lowers barrier for crypto newcomers (embedded wallets)
  • Demonstrates autonomous agent payment loops (technical feasibility)
  • Shows x402 protocol value proposition clearly
  • Fully open source for community building

Differentiation

  • vs Traditional Education: We reward learners, not charge them (net positive)
  • vs Other x402 Projects: Consumer-facing, fully functional, relatable use case
  • vs Centralized Learning: Blockchain-verified progress, autonomous payments

For Judges

3-Minute Demo Flow:

  1. Show wallet options (Phantom, Coinbase extension, CDP embedded)
  2. Create embedded wallet (no extension needed)
  3. Request 0.04 SOL airdrop from treasury (devnet)
  4. Pay 0.03 SOL to unlock learning platform
  5. Complete module 1, receive instant 0.01 SOL reward
  6. Show transaction on Solana Explorer (devnet)
  7. Explain autonomous AI agent decision-making via Gradient Parallax
  8. Demonstrate closed-loop payment system (proof-of-concept)

Track 5 Alignment:

  • βœ… AI agent makes autonomous payment decisions
  • βœ… Agent controls treasury wallet, signs transactions
  • βœ… HTTP 402 protocol properly implemented
  • βœ… Real Solana blockchain integration
  • βœ… Production-ready, scalable architecture

Project Structure

Solanax402-Hackathon/
β”œβ”€β”€ README.md                    # This file
β”œβ”€β”€ DEPLOYMENT.md               # Hosting setup guide
β”‚
β”œβ”€β”€ docs/                        # Sponsor integration showcases
β”‚   β”œβ”€β”€ gradient-integration.md  # Gradient Parallax AI
β”‚   β”œβ”€β”€ coinbase-integration.md  # CDP embedded wallets
β”‚   └── x402-integration.md      # x402 protocol
β”‚
β”œβ”€β”€ src/                        # Frontend React application
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ChatInterface.jsx    # AI-powered learning UI
β”‚   β”‚   β”œβ”€β”€ EmbeddedWalletButton.jsx
β”‚   β”‚   └── RewardsModal.jsx
β”‚   β”œβ”€β”€ learningModules.js       # Educational content
β”‚   └── App.jsx                  # Main app + payment gate
β”‚
└── backend/                    # Node.js server
    β”œβ”€β”€ server.js                # AI agent + API (1540 lines)
    β”œβ”€β”€ generate-treasury-wallet.js
    └── README.md                # API documentation

Documentation

Setup & Deployment

Sponsor Integration Deep Dives


Links

Project

Resources


Team

Built by @hewi333 for Solana x402 Hackathon


Demonstrating autonomous AI agents that manage payments on Solana

Solana x402 Hackathon - November 2025

About

project for solana hackathon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •