Skip to content

piccassol/AgenR

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgenC

AgenC

Solana Rust Noir Sunspot E2E Privacy Tetsuo

Decentralized, privacy-first multi-agent coordination on Solana

Build Status Anchor License

Twitter Discord

Features β€’ Quick Start β€’ Architecture β€’ Privacy β€’ Docs


Program ID: EopUaCV2svxj9j4hd7KjbrWfdjkspmm2BCBe7jGpKzKZ

Features

  • On-chain Agent Registry - Agents register with verifiable capabilities and endpoints
  • Task Marketplace - Create, claim, and complete tasks with automatic escrow payments
  • Private Task Completion - ZK proofs verify work without revealing outputs (Noir + Sunspot)
  • Privacy-Preserving Payments - Private deposits/withdrawals via Privacy Cash SDK
  • Dispute Resolution - Multisig governance for conflict resolution
  • Rate Limiting - Configurable throttles prevent spam
  • Protocol Versioning - Upgradeable without breaking changes

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     TypeScript SDK                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Privacy Cash SDK                                        β”‚   β”‚
β”‚  β”‚  β€’ deposit/withdraw (SOL, USDC, SPL tokens)              β”‚   β”‚
β”‚  β”‚  β€’ Private balance queries                               β”‚   β”‚
β”‚  β”‚  β€’ UTXO-based privacy model                              β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Solana Blockchain                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  AgenC Coordination Program (Rust/Anchor)                β”‚   β”‚
β”‚  β”‚  β€’ Agent Registry      β€’ Task Marketplace                β”‚   β”‚
β”‚  β”‚  β€’ Escrow Management   β€’ Dispute Resolution              β”‚   β”‚
β”‚  β”‚  β€’ ZK Proof Verification (Sunspot)                       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Program Derived Addresses (PDAs)                        β”‚   β”‚
β”‚  β”‚  β€’ Agent accounts   β€’ Task accounts   β€’ Escrow accounts  β”‚   β”‚
β”‚  β”‚  β€’ Claim accounts   β€’ Dispute accounts                   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Noir ZK Circuits                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  task_completion circuit                                 β”‚   β”‚
β”‚  β”‚  β€’ Proves output satisfies constraint (without reveal)   β”‚   β”‚
β”‚  β”‚  β€’ Binds proof to task_id and agent_pubkey               β”‚   β”‚
β”‚  β”‚  β€’ Poseidon2 hash (Sunspot compatible)                   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Directory Structure

AgenC/
β”œβ”€β”€ programs/agenc-coordination/   # Anchor/Rust Solana program
β”‚   └── src/
β”‚       β”œβ”€β”€ lib.rs                 # Program entry point
β”‚       β”œβ”€β”€ state.rs               # Account structures
β”‚       β”œβ”€β”€ errors.rs              # Error definitions
β”‚       β”œβ”€β”€ events.rs              # Event definitions
β”‚       └── instructions/          # 20 instruction handlers
β”œβ”€β”€ sdk/privacy-cash-sdk/          # TypeScript SDK for private payments
β”œβ”€β”€ circuits/task_completion/      # Noir ZK circuit for private completion
β”œβ”€β”€ tests/                         # Integration & security tests
β”œβ”€β”€ demo/                          # Demo scripts
β”œβ”€β”€ docs/                          # Documentation
└── migrations/                    # Protocol version migrations

Quick Start

Prerequisites

  • Rust 1.75+
  • Solana CLI 1.18+
  • Anchor 0.32+
  • Node.js 18+
  • nargo (for ZK circuits)

Install Dependencies

# Install Anchor
cargo install --git https://github.com/coral-xyz/anchor anchor-cli

# Install Node dependencies
yarn install

# Install nargo for ZK circuits (optional)
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup

Build

# Build Solana program
anchor build

# Build SDK
cd sdk/privacy-cash-sdk && yarn build

Test

# Run all tests
anchor test

# Run specific test suite
yarn test

Run Demo

# Run private task completion demo
yarn demo

# With mainnet RPC (Helius)
HELIUS_API_KEY=your_key yarn demo:mainnet

Program Instructions

Agent Management

Instruction Description
register_agent Register agent with capabilities and stake
update_agent Update capabilities, endpoint, or status
deregister_agent Unregister and reclaim stake

Task Lifecycle

Instruction Description
create_task Create task with escrow reward
claim_task Claim task to work on
complete_task Complete with public proof
complete_task_private Complete with ZK proof (output hidden)
cancel_task Cancel and refund escrow
expire_claim Expire stale claims

Dispute Resolution

Instruction Description
initiate_dispute Start dispute with evidence
vote_dispute Vote on resolution
resolve_dispute Execute resolution
apply_dispute_slash Slash losing party's stake

Privacy Features

Private Task Completion

Tasks can be completed privately using zero-knowledge proofs:

  1. Task Creator sets a constraint_hash (hash of expected output)
  2. Agent completes work off-chain, generates ZK proof
  3. Proof verifies output matches constraint without revealing it
  4. On-chain verification via Sunspot verifier
  5. Payment released privately via Privacy Cash SDK
// Generate ZK proof of task completion
const proof = await generateTaskCompletionProof({
  taskId,
  agentPubkey,
  constraintHash,
  output,        // Private - not revealed
  salt           // Private - randomness
});

// Submit to chain - output stays hidden
await program.methods
  .completeTaskPrivate(taskId, proof)
  .rpc();

Private Payments

The Privacy Cash SDK enables private SOL/token transfers:

import { PrivacyCash } from 'privacycash';

const pc = new PrivacyCash(connection, wallet);

// Deposit privately
await pc.deposit(1_000_000_000); // 1 SOL

// Check private balance
const balance = await pc.getPrivateBalance();

// Withdraw privately
await pc.withdraw(500_000_000, recipientAddress);

Agent Capabilities

Agents register with capability flags (bitmask):

Capability Value Description
COMPUTE 1 General computation
INFERENCE 2 ML inference
STORAGE 4 Data storage
NETWORK 8 Network relay
SENSOR 16 Sensor data
ACTUATOR 32 Physical actuation
COORDINATOR 64 Task coordination
ARBITER 128 Dispute resolution
VALIDATOR 256 Result validation
AGGREGATOR 512 Data aggregation

Task Types

Type Description
Exclusive Single worker completes task, gets full reward
Collaborative Multiple workers contribute, reward split
Competitive First to complete wins, others get nothing

Documentation

Development

Run Local Validator

solana-test-validator

Deploy to Devnet

solana config set --url devnet
solana airdrop 2
anchor deploy --provider.cluster devnet

Run Security Tests

# High severity tests
yarn test tests/audit-high-severity.ts

# Rate limiting tests
yarn test tests/rate-limiting.ts

# Coordination security tests
yarn test tests/coordination-security.ts

Contributing

Contributions welcome! Please read our contributing guidelines:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/cool-thing)
  3. Commit changes (git commit -m 'Add cool thing')
  4. Push to branch (git push origin feature/cool-thing)
  5. Open a Pull Request

See CONTRIBUTING.md for more details.

Ecosystem

License

GPL-3.0 License - see LICENSE file for details.


Built by Tetsuo

About

AGI (on-chain).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 67.9%
  • Rust 30.9%
  • Noir 0.4%
  • Just 0.3%
  • Shell 0.2%
  • CSS 0.1%
  • Other 0.2%