Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Agnic Trust

"Know Your Agent" - The first trustless identity, reputation, and authorization protocol for autonomous AI agents on Solana

License Solana TypeScript Rust

🎯 Overview

Agnic Trust is a comprehensive protocol that enables trustless autonomous AI agents through:

  • 🆔 W3C Standards-Based Identity - Decentralized Identifiers (DIDs) & Verifiable Credentials
  • ⭐ On-Chain Reputation System - Cryptographic attestations with multi-factor scoring
  • 🔐 Capability Authorization - Fine-grained permissions and access control
  • 💰 X402 Payment Integration - Identity-aware autonomous payments with reputation-based pricing
  • ⚡ Solana-Native - Sub-second finality, ultra-low transaction costs

Built for the Solana X402 Hackathon - Best Trustless Agent Category

✨ Key Features

Decentralized Identity

  • W3C DID Core 1.0 compliant identifiers
  • Hierarchical identity relationships (Developer → Agent → Task)
  • Verifiable Credentials for authorization
  • On-chain credential revocation

Reputation System

  • Multi-component scoring (0-1000 points)
  • Real-time on-chain attestations
  • Reputation-based tier pricing (Bronze → Platinum)
  • Slashable stakes for accountability

X402 Integration

  • Automated payment flow with identity verification
  • Reputation-based dynamic pricing discounts
  • Trustless facilitator attestation
  • Complete transaction transparency

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Agnic Trust Protocol                      │
├─────────────────────────────────────────────────────────────┤
│                                                               │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │  Agent       │  │  Reputation  │  │  Revocation  │      │
│  │  Registry    │  │  Oracle      │  │  Registry    │      │
│  │  Program     │  │  Program     │  │  Program     │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│        │                  │                  │               │
│        └──────────────────┴──────────────────┘               │
│                           │                                   │
│                    Solana Blockchain                         │
│                                                               │
└─────────────────────────────────────────────────────────────┘
                             │
              ┌──────────────┴──────────────┐
              │                             │
      ┌───────▼────────┐         ┌──────────▼─────────┐
      │   TypeScript   │         │    X402 Payment    │
      │      SDK       │         │    Integration     │
      └────────────────┘         └────────────────────┘

Reputation Scoring

Score Formula (0-1000):

  • Task Completion Rate: 40% (400 points)
  • Payment Reliability: 20% (200 points)
  • Service Ratings: 20% (200 points)
  • Time in Operation: 10% (100 points)
  • Economic Stake: 10% (100 points)

Tier Benefits:

  • 🥉 Bronze (0-299): Standard pricing
  • 🥈 Silver (300-599): 25% discount
  • 🥇 Gold (600-849): 50% discount
  • 💎 Platinum (850-1000): 75% discount

🚀 Getting Started

Prerequisites

Ensure you have the following installed:

# Install Rust (required for Solana programs)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

# Install Anchor (Solana smart contract framework)
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install 0.30.1
avm use 0.30.1

# Install Node.js (v18+)
# Visit https://nodejs.org/ or use nvm

Installation

# Clone the repository
git clone https://github.com/yourusername/agnic-trust.git
cd agnic-trust

# Install dependencies
npm install

Build & Deploy

# Build all Solana programs
anchor build

# Deploy to Solana devnet
anchor deploy --provider.cluster devnet

# Run tests
npm test

📦 Project Structure

agnic-trust/
├── programs/              # Solana programs (Rust/Anchor)
│   ├── agent-registry/    # DID creation and management
│   ├── reputation-oracle/ # Reputation scoring
│   └── revocation-registry/ # Credential revocation
├── packages/              # TypeScript packages
│   ├── sdk/              # Main SDK
│   ├── types/            # Shared types
│   ├── crypto/           # Crypto utilities
│   └── x402-integration/ # X402 protocol integration
├── apps/                  # Applications
│   └── docs/             # Documentation
├── demo/                  # Demo application
└── demo-x402/            # X402 integration demo

💻 Usage

Basic SDK Usage

import { AgnicTrustClient } from '@agnic-trust/sdk';
import { Connection, Keypair } from '@solana/web3.js';

// Initialize client
const connection = new Connection('https://api.devnet.solana.com');
const wallet = Keypair.generate();
const client = new AgnicTrustClient({
  connection,
  wallet,
  network: 'devnet',
});

// Create agent DID
const did = await client.did.createDID({
  verificationMethods: [
    {
      publicKey: wallet.publicKey,
      purpose: 'Authentication',
      keyId: 'key-1',
    },
  ],
});

console.log('Agent DID:', did.id);

// Initialize reputation
await client.reputation.initialize(did.id);

// Submit task attestation
await client.reputation.submitTaskAttestation({
  agentDID: did.id,
  taskId: 'task-001',
  success: true,
});

// Check reputation score
const reputation = await client.reputation.getReputation(did.id);
console.log('Score:', reputation.score);
console.log('Tier:', reputation.tier);

X402 Payment Integration

import { X402Client } from '@agnic-trust/x402-integration';

// Initialize X402 client with identity
const x402 = new X402Client({
  agnicClient: client,
  agentDID: agentDID.id,
});

// Make authenticated API call with auto-payment
const response = await x402.get('https://api.example.com/premium-data', {
  includeIdentity: true,  // Include agent DID and reputation
  autoPay: true,          // Automatically pay if 402 received
});

// Response includes reputation-based discount
if (response.payment) {
  console.log('Original price:', response.payment.baseAmount);
  console.log('Your price:', response.payment.discountedAmount);
  console.log('Discount:', response.payment.discount * 100, '%');
  console.log('Tier:', response.payment.tier);
}

🧪 Testing

# Run all tests
npm test

# Test Solana programs
anchor test

# Test SDK packages
npm test --workspace=@agnic-trust/sdk

# Run integration tests
npm run test:integration

📖 Documentation

Core Concepts

  1. Decentralized Identifiers (DIDs)

    • W3C DID Core 1.0 compliant
    • Method: did:agnic:<solana-pubkey>
    • Hierarchical identity relationships
  2. Verifiable Credentials (VCs)

    • W3C VC Data Model 2.0 compliant
    • On-chain revocation registry
    • Cryptographic verification
  3. Reputation System

    • Multi-component scoring algorithm
    • Real-time on-chain attestations
    • Economic stake mechanisms
  4. X402 Integration

    • Identity-aware HTTP 402 payments
    • Reputation-based dynamic pricing
    • Trustless payment verification

Package Documentation

🤝 Contributing

We welcome contributions from the community! Please see CONTRIBUTING.md for guidelines.

Development Workflow

# Fork the repository and clone it
git clone https://github.com/yourusername/agnic-trust.git
cd agnic-trust

# Create a feature branch
git checkout -b feature/your-feature-name

# Make your changes and test
npm test
npm run lint

# Commit with conventional commits
git commit -m "feat: add your feature"

# Push and create a pull request
git push origin feature/your-feature-name

🏆 Solana X402 Hackathon

Best Trustless Agent Category

Hackathon Requirements:

  • ✅ Autonomous agents with decentralized identity
  • ✅ Reputation and validation systems
  • ✅ X402 payment protocol integration
  • ✅ Trustless architecture

Agnic Trust Delivers:

  • ✅ W3C standards-based identity (DID + VC)
  • ✅ Multi-factor on-chain reputation system
  • ✅ Cryptographic verification and attestations
  • ✅ Complete X402 integration with reputation-based pricing
  • ✅ Production-ready TypeScript SDK
  • ✅ Comprehensive documentation
  • ✅ Live demo applications
  • ✅ Open source under Apache 2.0

🛡️ Security

This project follows security best practices:

  • All private keys and sensitive data are excluded from version control
  • On-chain programs use Anchor framework security features
  • Cryptographic operations use audited libraries
  • Regular dependency updates and security audits

To report security vulnerabilities, please email security@agnic.io (do not create public issues).

📄 License

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

🙏 Acknowledgments

  • Solana Foundation - For hosting the X402 Hackathon
  • W3C - For the DID and Verifiable Credentials standards
  • Anchor Framework - For excellent Solana development tools
  • Open Source Community - For inspiration and support

Built with ❤️ for the autonomous agent economy

Empowering AI agents with identity, reputation, and trust on Solana

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages