Skip to content

Latest commit

ย 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ChaosChain DVN PoC

Decentralized Verification Network Proof-of-Concept for AI Agent Collaboration

Solidity Hardhat License: MIT Tests


๐Ÿš€ Overview

ChaosChain DVN PoC demonstrates the first Decentralized Verification Network for AI agent collaboration. This system enables Worker Agents to submit verifiable work for evaluation by a network of Verifier Agents, creating immutable Proof-of-Agency records on the blockchain.

๐ŸŽฏ Key Innovation

Unlike traditional blockchain systems that verify transactions, the DVN verifies the quality and correctness of AI agent work, enabling trusted multi-agent collaboration at scale.


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           ChaosChain DVN Architecture                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Off-Chain Components                Smart Contracts (Sepolia)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Worker Agent   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚     DVNRegistryPOC       โ”‚
โ”‚                 โ”‚    Register    โ”‚  (Agent Registration)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                   โ–ฒ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                โ”‚
โ”‚ Verifier Agents โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚                 โ”‚         Register & Stake
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                
        โ”‚                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                          โ”‚       StudioPOC          โ”‚
        โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚   (KiranaAI Use Case)    โ”‚
        โ”‚   โ”‚  IPFS Storage   โ”‚โ—€โ”€โ”€โ”€โ”ค  - Receives PoA Hash     โ”‚
        โ”‚   โ”‚  (PoA Packages) โ”‚    โ”‚  - Collects Fees         โ”‚
        โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚            โ–ฒ                           โ”‚
        โ”‚            โ”‚                           โ–ผ
        โ”‚            โ”‚               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚    DVNConsensusPOC      โ”‚
        โ”‚      โ”‚  Worker Agent   โ”‚โ”€โ”€โ–ถโ”‚   (Consensus Engine)    โ”‚
        โ”‚      โ”‚                 โ”‚   โ”‚  - Processes Results    โ”‚
        โ”‚      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚  - Updates PoA Status   โ”‚
        โ”‚                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚                                       โ”‚ โ–ฒ
        โ”‚                                       โ”‚ โ”‚
        โ”‚                                       โ–ผ โ”‚
        โ”‚                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚   DVNAttestationPOC     โ”‚
             Submit Attestations     โ”‚ (Attestation Recording) โ”‚
                                     โ”‚  - Records VA Votes     โ”‚
                                     โ”‚  - Prevents Double Vote โ”‚
                                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Workflow

  1. Agent Registration: Worker Agents (WAs) and Verifier Agents (VAs) register with DVNRegistryPOC.sol, with VAs performing a mock stake.
  2. Work Package Creation & Upload: A WA performs a task defined by a Studio (e.g., the "KiranaAI-POC-Studio"). The WA then creates a "Work Submission Package" (e.g., a JSON file containing task details, outputs, and context) and uploads this package to IPFS.
  3. Work Submission to Studio: The WA submits a reference to this Work Submission Package (the IPFS hash) to the StudioPOC.sol contract, initiating a new Proof-of-Agency lifecycle. This generates a unique poaId.
  4. Verification Triggered & Attestation:
    • The submission to StudioPOC.sol signals that a new poaId is ready for verification.
    • Registered and staked VAs monitor for these new submissions (e.g., by listening to WorkSubmitted events).
    • VAs fetch the Work Submission Package from IPFS, evaluate it against the Studio's criteria, and submit their attestations (approve/reject) to DVNAttestationPOC.sol, referencing the poaId.
  5. Consensus & Proof-of-Agency Finalization:
    • After attestations are collected, the DVNConsensusPOC.sol contract processes these attestations for the given poaId.
    • Based on its defined consensus logic (e.g., majority vote), it determines if the work is valid.
    • DVNConsensusPOC.sol then instructs StudioPOC.sol to update the status of the poaId to VERIFIED or REJECTED.
  6. Proof-of-Agency Recorded: If the status is VERIFIED, the poaId (linked to the original submission details and its VERIFIED status on-chain in StudioPOC.sol) now serves as the immutable Proof-of-Agency. An event like ProofOfAgencyFinalized confirms this.

Smart Contracts

This PoC is composed of the following core smart contracts deployed on the Sepolia testnet:

Contract Name Description Sepolia Address
DVNRegistryPOC Agent registration and staking management 0x5A6207a7...0aB599fE
StudioPOC KiranaAI inventory verification studio 0x03ed96a2...Acac40De
DVNAttestationPOC Verifier agent attestation recording 0x950B75d0...BCA5541F
DVNConsensusPOC Consensus processing and finalization 0x33807533...Ea0771dDa
IStudioPolicy Standard interface for all Studios (N/A - Interface Only)

โœจ Features

๐Ÿค– Agent Management

  • Worker Agent Registration: Submit work for verification
  • Verifier Agent Registration: Evaluate and attest to submissions
  • Reputation System: Dynamic reputation scoring (100-1000 range)
  • Staking Mechanism: Economic security through ETH staking

๐Ÿช Studio System

  • KiranaAI Integration: Inventory verification use case
  • Flexible Action Types: Support for multiple verification scenarios
  • Fee Structure: 0.0001 ETH verification fees
  • Custom Policies: Studio-specific verification criteria

โš–๏ธ Consensus Engine

  • Configurable Parameters: 3 minimum attestations, 66% threshold
  • Weighted Voting: Stake ร— reputation weighting
  • Timeout Protection: 10-minute attestation windows
  • Reward Distribution: Automatic verifier compensation

๐Ÿ”’ Security & Trust

  • Proof-of-Agency: Immutable verification records
  • Anti-Double-Voting: Prevents duplicate attestations
  • Access Control: Role-based permissions
  • Slashing Protection: Economic penalties for misbehavior

๐Ÿ“‹ Prerequisites

  • Node.js v16+
  • npm or yarn
  • Git
  • Ethereum wallet with Sepolia testnet ETH
  • RPC Provider (Infura, Alchemy, etc.)

๐Ÿš€ Quick Start

1. Installation

# Clone the repository
git clone https://github.com/ChaosChain/chaoschain-dvn.git
cd chaoschain-dvn

# Install dependencies
npm install

# Copy environment template
cp config/environment.example .env

2. Environment Setup

Edit .env with your configuration:

# Sepolia testnet configuration
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_PROJECT_ID
PRIVATE_KEY=your_private_key_without_0x_prefix
ETHERSCAN_API_KEY=your_etherscan_api_key

3. Compile & Test

# Compile contracts
npm run compile

# Run tests
npm test

# Test with gas reporting
REPORT_GAS=true npm test

4. Deploy

# Deploy to Sepolia testnet
npm run deploy:sepolia

# Or deploy locally for testing
npm run deploy:local

๐Ÿงช Testing

The project includes comprehensive test coverage:

# Run all tests
npm test

# Run specific test file
npx hardhat test tests/unit/DVNRegistry.test.js

# Generate coverage report
npm run coverage

Test Results

โœ… 15/15 Tests Passing
โœ… Agent Registration & Management
โœ… Staking Mechanisms
โœ… Work Submission Workflow
โœ… Attestation Recording
โœ… Access Control & Security

๐Ÿ“– Usage Examples

Register a Verifier Agent

const DVNRegistry = await ethers.getContractFactory("DVNRegistryPOC");
const registry = DVNRegistry.attach(contractAddress);

// Register as verifier
const agentId = ethers.utils.formatBytes32String("verifier-001");
await registry.registerAgent(agentId, 1, "https://my-endpoint.com");

// Stake ETH
await registry.mockStake({ value: ethers.utils.parseEther("0.01") });

Submit Work to Studio

const StudioPOC = await ethers.getContractFactory("StudioPOC");
const studio = StudioPOC.attach(studioAddress);

// Submit inventory verification work
const poaId = await studio.submitWork(
  ethers.utils.formatBytes32String("worker-001"),
  "KiranaAI_StockReport",
  "QmIPFSHashOfSubmissionData",
  { value: ethers.utils.parseEther("0.0001") }
);

Submit Attestation

const DVNAttestation = await ethers.getContractFactory("DVNAttestationPOC");
const attestation = DVNAttestation.attach(attestationAddress);

// Verifier attests to submission
await attestation.submitAttestation(
  poaId,
  true, // approved
  "QmIPFSHashOfJustification"
);

๐Ÿช KiranaAI Studio Demo

The PoC includes a complete KiranaAI inventory verification studio that demonstrates:

  • Worker Agents submit store inventory reports
  • Verifier Agents validate inventory accuracy
  • Consensus mechanism determines verification outcome
  • Proof-of-Agency records provide audit trail

Supported Action Types

  • KiranaAI_StockReport - Daily inventory counts
  • KiranaAI_InventoryAudit - Comprehensive audits
  • KiranaAI_ReorderAlert - Automated reorder triggers

๐Ÿ“Š Contract Specifications

Economic Parameters

MINIMUM_STAKE = 0.001 ether;     // Minimum VA stake
VERIFICATION_FEE = 0.0001 ether; // Studio submission fee
INITIAL_REPUTATION = 100;        // Starting reputation
CONSENSUS_THRESHOLD = 66%;       // Approval threshold
ATTESTATION_TIMEOUT = 10 minutes; // Response window

Gas Optimization

  • Optimized for 200 compiler runs
  • Efficient storage patterns
  • Event-based data retrieval
  • Batch operations support

๐Ÿ› ๏ธ Development

Project Structure

chaoschain-dvn/
โ”œโ”€โ”€ contracts/           # Smart contracts
โ”‚   โ”œโ”€โ”€ interfaces/      # Contract interfaces
โ”‚   โ”œโ”€โ”€ DVNRegistryPOC.sol
โ”‚   โ”œโ”€โ”€ StudioPOC.sol
โ”‚   โ”œโ”€โ”€ DVNAttestationPOC.sol
โ”‚   โ””โ”€โ”€ DVNConsensusPOC.sol
โ”œโ”€โ”€ scripts/            # Deployment scripts
โ”œโ”€โ”€ tests/              # Test suite
โ”œโ”€โ”€ docs/               # Documentation
โ”œโ”€โ”€ config/             # Configuration files
โ””โ”€โ”€ agents/             # Python agents (Phase 2)

Available Scripts

npm run compile         # Compile contracts
npm test               # Run test suite
npm run deploy:sepolia # Deploy to Sepolia
npm run deploy:local   # Deploy locally
npm run clean          # Clean artifacts
npm run coverage       # Generate coverage

๐Ÿ”ฎ Roadmap

Phase 1: Smart Contracts โœ… COMPLETE

  • DVN core smart contract system
  • KiranaAI Studio implementation
  • Comprehensive testing suite
  • Sepolia deployment ready

Phase 2: Agent Automation ๐Ÿšง IN PROGRESS

  • Python Worker Agent scripts
  • Python Verifier Agent scripts
  • IPFS integration for metadata
  • End-to-end demo automation

Phase 3: Advanced Features ๐Ÿ“‹ PLANNED

  • Multi-studio support
  • Advanced consensus algorithms
  • ZK-proof integration
  • Cross-chain compatibility

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Make changes and add tests
  4. Ensure all tests pass: npm test
  5. Commit changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Open Pull Request

๐Ÿ“š Documentation


๐Ÿ” Security

Audit Status

  • Internal security review
  • External audit (planned)
  • Bug bounty program (planned)

Report Security Issues

Please report security vulnerabilities to: security@chaoschain.io


๐Ÿ“„ License

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


๐ŸŒŸ Acknowledgments

  • OpenZeppelin for secure contract libraries
  • Hardhat for development framework
  • Ethereum Foundation for blockchain infrastructure
  • IPFS for decentralized storage

๐Ÿ“ž Support & Community


Built with โค๏ธ by the ChaosChain team

Creating the future of verifiable AI agent collaboration ๐Ÿš€

About

No description, website, or topics provided.

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages