Skip to content

Repository files navigation

OOBE Protocol

A Solana on-chain agent registry and reputation system built with Anchor 0.30.

Overview

OOBE Protocol provides a decentralized marketplace infrastructure for AI agents. It allows:

  • Oracle initialization — A ReputationOracle PDA that governs reputation updates
  • Agent registration — Register agents with name, capabilities, pricing tier, and price
  • Agent management — Update capabilities, tier, and price
  • Reputation tracking — Oracle-authority-only score updates with vote counting
  • Soft deactivation — Agents can be deactivated without deleting on-chain state

Program ID

3GE2ac1UgJpmuXTUGruMXNq9UCjefch8GFrjVuuqGRJS

Architecture

Accounts

Account Seeds Description
ReputationOracle [b"oracle"] Singleton PDA that controls reputation updates
Agent [b"agent", authority, name] Per-agent PDA, unique per authority+name

Pricing Tiers

  • Free — No cost to interact
  • Premium — Paid access
  • Enterprise — Enterprise-tier access

Instructions

Instruction Description
initialize_oracle Create the reputation oracle PDA
register_agent Register a new agent (name, capabilities, tier, price)
update_agent Update an agent's capabilities, tier, or price
update_reputation Add reputation score (oracle authority only)
deactivate_agent Soft-delete an agent
get_agent View agent details (logs to program logs)

Error Codes

Code Name Description
6000 NameTooLong Name must be ≤ 64 characters
6001 TooManyCapabilities Max 10 capabilities
6002 CapabilityTooLong Each capability ≤ 32 characters
6003 Unauthorized Caller is not the account authority
6004 AgentNotFound Agent account does not exist
6005 AgentAlreadyInactive Agent is already deactivated

Project Structure

oobe-protocol/
├── Anchor.toml
├── Cargo.toml
├── package.json
├── tsconfig.json
├── README.md
├── programs/
│   └── oobe-protocol/
│       └── src/
│           ├── lib.rs              # Program entrypoint
│           ├── constants.rs        # Program constants
│           ├── error.rs            # Custom error definitions
│           ├── state/
│           │   └── mod.rs          # Agent, ReputationOracle, PricingTier
│           └── instructions/
│               ├── mod.rs
│               ├── initialize_oracle.rs
│               ├── register_agent.rs
│               ├── update_agent.rs
│               ├── update_reputation.rs
│               ├── deactivate_agent.rs
│               └── get_agent.rs
├── sdk/
│   ├── src/
│   │   └── index.ts                # SDK: PDA helpers + instruction wrappers
│   └── types/
│       └── index.ts                # TypeScript type definitions
├── target/
│   ├── idl/
│   │   └── oobe_protocol.json      # Anchor IDL (hand-written)
│   └── types/
│       └── oobe_protocol.ts        # IDL-derived TypeScript types
└── tests/
    └── oobe-protocol.ts            # Integration test suite

Setup

Prerequisites

Install Dependencies

yarn install

Build

anchor build

Test

Start a local validator and run tests:

anchor test

Or manually:

# Terminal 1: start validator
solana-test-validator

# Terminal 2: run tests
anchor test --skip-local-validator

SDK Usage

Setup

import { Program, AnchorProvider } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import {
  PricingTier,
  findOraclePda,
  findAgentPda,
  initializeOracle,
  registerAgent,
  updateAgent,
  updateReputation,
  deactivateAgent,
  getAgent,
} from "./sdk/src/index";
import { OobeProtocol } from "./target/types/oobe_protocol";

const provider = new AnchorProvider(connection, wallet, {});
const program = new Program<OobeProtocol>(IDL, PROGRAM_ID, provider);

Initialize Oracle

await initializeOracle(program, authority);

Register an Agent

await registerAgent(
  program,
  authority,
  "my-ai-agent",
  ["code_generation", "review"],
  PricingTier.Premium,
  new BN(LAMPORTS_PER_SOL / 10) // 0.1 SOL
);

Update an Agent

await updateAgent(program, authority, "my-ai-agent", {
  capabilities: ["code_generation", "review", "deployment"],
  tier: PricingTier.Enterprise,
  price: new BN(LAMPORTS_PER_SOL),
});

Update Reputation (Oracle Only)

await updateReputation(program, oracleAuthority, agentPda, new BN(100));

Deactivate Agent

await deactivateAgent(program, authority, "my-ai-agent");

Fetch Agent

const agent = await getAgent(program, authority, "my-ai-agent");
console.log("Reputation:", agent.reputationScore.toString());

Constraints

  • Agent name: max 64 characters
  • Capabilities per agent: max 10
  • Capability length: max 32 characters each
  • Only the authority (PDA signer) can update/deactivate their own agents
  • Only the oracle authority can update reputation scores
  • Agent deactivation is soft — the account remains on-chain with is_active = false
  • Deactivating an already-inactive agent fails with AgentAlreadyInactive

License

ISC

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages