Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AuditAgent is the first production-ready implementation of autonomous agents on Solana that handle micropayments for premium APIs. Built on the HTTP 402 Payment Required standard with Visa TAP integration

License

Notifications You must be signed in to change notification settings

daveylupes/AuditAgent-

Repository files navigation

AuditAgent X402 (AAX4)

Autonomous payment infrastructure for the x402 economy

AuditAgent is the first production-ready implementation of autonomous agents on Solana that handle micropayments for premium APIs. Built on the HTTP 402 Payment Required standard with Visa TAP integration.

Why AuditAgent?

Traditional API monetization is broken:

  • ❌ Complex subscription models
  • ❌ High payment processing fees
  • ❌ No micropayment support
  • ❌ Lack of payment auditability

AuditAgent solves this with:

  • Autonomous Payments - Agents pay for APIs without human intervention
  • Micropayments - Pay only for what you use, starting at $0.01
  • Cryptographic Proofs - Every payment is verified and auditable
  • On-Chain Settlement - Instant, transparent transactions on Solana
  • Developer-Friendly - Simple SDK, beautiful dashboard, comprehensive docs

Architecture

┌──────────────┐      ┌──────────────┐      ┌──────────────┐
│  Web UI      │◄────►│ AuditAgent   │◄────►│ Solana PDA   │
│  Dashboard   │      │ Orchestrator │      │ Wallet       │
└──────────────┘      └──────────────┘      └──────────────┘
                             │
                             ├──► Premium x402 APIs
                             ├──► VisaTAP Module
                             └──► On-chain Telemetry

Components

  • Solana Program (solana-program/) - Rust program managing PDA wallet state
  • Web Dashboard (web/) - Next.js UI with agent orchestration
  • SDK (sdk/) - Reusable TypeScript client
  • Demo (demo/) - Standalone CLI demo
  • Scripts (scripts/) - Deployment and management tools

Features

✨ Core Features

  • Autonomous x402 payment handling
  • PDA wallet with USDC support
  • On-chain deposit tracking
  • Dynamic priority fees
  • Chained payment requests

🔒 Security & Compliance

  • Visa TAP proof generation
  • Authority-based access control
  • Rent-exempt account management
  • Cryptographic payment signatures

📊 Developer Experience

  • Beautiful real-time dashboard
  • Solana Explorer integration
  • Payment history with TAP proofs
  • Comprehensive TypeScript SDK

Quick Start

See SETUP.md for complete instructions.

# 1. Deploy Solana program
./scripts/deploy-program.sh

# 2. Configure environment
cp web/.env.example web/.env.local
# Edit web/.env.local with your program ID and authority secret

# 3. Initialize agent
cd scripts && npx ts-node initialize-agent.ts

# 4. Fund agent with devnet USDC
./scripts/fund-agent.sh

# 5. Run dashboard
cd web && npm run dev

Visit http://localhost:3000 and click "Trigger Agent" to see it in action!

Project Structure

AuditAgent/
├── solana-program/        # Rust on-chain program
│   ├── src/lib.rs        # PDA wallet logic
│   └── Cargo.toml
├── web/                   # Next.js dashboard
│   ├── src/
│   │   ├── app/          # Pages and API routes
│   │   ├── components/   # React components
│   │   └── lib/          # Agent orchestration
│   └── package.json
├── sdk/                   # TypeScript SDK
│   ├── src/index.ts      # AuditAgentClient
│   └── package.json
├── demo/                  # CLI demo
│   └── src/demo.ts
├── scripts/               # Deployment tools
│   ├── deploy-program.sh
│   ├── initialize-agent.ts
│   └── fund-agent.sh
└── docs/                  # Documentation
    └── TAP-architecture.md

How It Works

  1. Agent Initialization

    • Deploy Solana program to devnet
    • Create PDA wallet from seed "aax4-agent"
    • Fund PDA with devnet USDC
  2. Payment Flow

    • Agent requests premium data
    • Receives 402 Payment Required
    • Automatically pays from PDA wallet
    • Records transaction on-chain
    • Generates TAP proof
    • Receives premium data
  3. Dashboard Updates

    • Real-time balance monitoring
    • Payment history with Explorer links
    • TAP proof verification
    • Transaction fee analytics

Development

# Install dependencies
npm install

# Run tests
npm run test

# Format code
npm run format

# Lint
npm run lint

# Build all workspaces
npm run build

Testing

The project includes comprehensive tests:

  • Unit tests for core features (25+ tests)
  • Integration with Vitest
  • Test coverage for telemetry, TAP, instructions

Run tests:

npm run test

See TESTING.md for details.

API Reference

SDK Usage

import { AuditAgentClient } from '@auditagent/sdk';

const client = new AuditAgentClient({
  programId: process.env.SOLANA_AGENT_PROGRAM_ID!,
  authoritySecret: process.env.SOLANA_AGENT_AUTHORITY_SECRET!,
  usdcMint: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU',
  premiumApiBase: 'http://localhost:3000',
});

const result = await client.runAudit({ 
  resourcePath: '/api/premium-data' 
});

console.log('Transaction:', result.signature);
console.log('Data:', result.primary);
console.log('TAP Proof:', result.tapProof);

Premium API Format

// GET /api/premium-data
// Without payment → 402 Payment Required
{
  "x402Version": 1,
  "resource": "http://localhost:3000/api/premium-data",
  "accepts": [{
    "method": "solana-pay",
    "network": "devnet",
    "asset": "USDC",
    "amount": 1,
    "payTo": "<agent-pda>"
  }]
}

// With payment → 200 OK
{
  "data": { ... },
  "nextResource": "/api/premium-insights", // optional chaining
  "nextResourceLabel": "premium-x402-insights"
}

Deployment

Devnet (Recommended for Testing)

Follow SETUP.md

Mainnet (Production)

  1. Update environment to mainnet:

    NEXT_PUBLIC_SOLANA_CLUSTER=mainnet-beta
    NEXT_PUBLIC_SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
    NEXT_PUBLIC_SOLANA_USDC_MINT=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
  2. Deploy program to mainnet:

    solana config set --url mainnet-beta
    solana program deploy solana-program/target/deploy/solana_program.so
  3. Fund with real USDC

⚠️ Warning: Use proper key management and security practices for mainnet deployment.

Use Cases

For API Providers

  • Monetize any API with micropayments
  • Pay-per-use model - no subscription complexity
  • Instant settlement on Solana
  • Built-in fraud prevention with cryptographic proofs

For Developers

  • Build autonomous agents that consume paid APIs
  • No payment UI needed - agents handle everything
  • Transparent costs - see exactly what you're paying
  • Full audit trail - every payment is on-chain

Example Applications

  • 🤖 AI agents consuming premium data feeds
  • 📊 Real-time analytics and market data APIs
  • 🔐 Paywalled content and research
  • 💹 Trading algorithms with paid signals
  • 🎮 Game APIs with item/data access

Roadmap

See CHANGELOG.md for release history.

Current Status: MVP ✅

  • Autonomous x402 payment handling
  • Solana PDA wallet with USDC
  • On-chain deposit tracking
  • TAP proof generation
  • Real-time dashboard & SDK

Coming Soon

  • Multi-asset support
  • Withdrawal functionality
  • Rate limiting and controls
  • Production facilitator
  • API provider dashboard

Contributing

This is a hackathon project. Contributions welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE for details

Technology

Built on proven, production-ready infrastructure:

  • Solana - High-performance blockchain for instant settlement
  • @faremeter/payment-solana - Battle-tested x402 payment library
  • Visa TAP - Trusted Agent Protocol for payment identity
  • Next.js - Modern React framework for the dashboard
  • TypeScript - Type-safe development across the stack

Community

Enterprise & Partnerships

Interested in production deployment or integration support?

Create an issue labeled enterprise or email the maintainers.

Links

Support

For questions or issues:


Built with ❤️ for the Solana ecosystem

About

AuditAgent is the first production-ready implementation of autonomous agents on Solana that handle micropayments for premium APIs. Built on the HTTP 402 Payment Required standard with Visa TAP integration

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published