Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Cygnus

Machine Economy Stack — An autonomous agentic ecosystem on Stellar enabling machine-to-machine commerce.

Version License Node.js TypeScript Stellar


Overview

Project Cygnus enables AI agents to autonomously transact, trade, lend, and manage credit on Stellar blockchain.

Feature Description
Sub-100ms Payments Off-chain payment channels for micropayments
Autonomous Agents AI-driven trading and lending decisions
Verifiable Identity W3C DID/VC standards for accountability
Smart Contracts Soroban-based loans, escrows, and credit scoring

Architecture

System Overview

flowchart TB
    subgraph APP["Application Layer"]
        UI[Dashboard]
        CLI[CLI Tools]
    end

    subgraph AGENTS["Agent Layer"]
        AM[Agent Manager]
        AR[Agent Runtime]
    end

    subgraph PROTOCOLS["Protocol Layer"]
        X402[X402 Payments]
        MASUMI[Masumi Identity]
        SOKOSUMI[Sokosumi Coordination]
    end

    subgraph CONTRACTS["Smart Contracts"]
        LOAN[Loan]
        ESCROW[Escrow]
        CREDIT[Credit Score]
    end

    subgraph STELLAR["Stellar Blockchain"]
        SCP[Soroban + SCP]
    end

    APP --> AGENTS
    AGENTS --> PROTOCOLS
    PROTOCOLS --> CONTRACTS
    CONTRACTS --> STELLAR


Loading

Data Flow

sequenceDiagram
    participant User
    participant Dashboard
    participant Agent
    participant Protocol
    participant Stellar

    User->>Dashboard: Initiate Action
    Dashboard->>Agent: Request
    Agent->>Protocol: Process
    Protocol->>Stellar: Submit TX
    Stellar-->>Protocol: Confirm
    Protocol-->>Agent: Result
    Agent-->>Dashboard: Update
    Dashboard-->>User: Display
Loading

Agent Decision Flow

flowchart LR
    subgraph INPUT["Input"]
        OPP[Opportunity]
        REQ[Request]
    end

    subgraph PROCESS["Processing"]
        EVAL[Evaluate]
        RISK[Assess Risk]
        DECIDE[Decide]
    end

    subgraph OUTPUT["Output"]
        EXEC[Execute]
        LOG[Log]
    end

    INPUT --> PROCESS --> OUTPUT


Loading

Quick Start

Prerequisites

  • Node.js v20+
  • Rust & Cargo (for contracts)
  • Stellar CLI

Installation

# Clone and install
git clone https://github.com/yourusername/project-cygnus.git
cd project-cygnus
npm install

# Install dashboard
cd dashboard && npm install && cd ..

# Build
npm run build

Configure Stellar

# Add testnet
stellar network add --global testnet \
  --rpc-url https://soroban-testnet.stellar.org:443 \
  --network-passphrase "Test SDF Network ; September 2015"

# Generate and fund keypair
stellar keys generate --global alice --network testnet
stellar keys fund alice --network testnet

Run

# Start agent service (port 3402)
npm run dev start testnet

# Start dashboard
cd dashboard && ./start.sh

Access: http://localhost:5173


Project Structure

project-cygnus/
├── agents/          # Agent implementations
│   ├── runtime/     # Core runtime
│   └── logic/       # Decision logic
├── contracts/       # Soroban smart contracts
│   ├── loan/
│   ├── escrow/
│   └── credit-scoring/
├── protocols/       # Protocol layer
│   ├── x402/        # Payment proofs
│   ├── x402-flash/  # Payment channels
│   ├── masumi/      # Identity (DID/VC)
│   └── sokosumi/    # Coordination
├── src/             # Backend services
├── dashboard/       # Web UI
├── tests/           # Test suites
└── docs/            # Documentation

Core Components

Protocol Stack

flowchart LR
    subgraph X402["X402"]
        X1[Payment Proofs]
        X2[Flash Channels]
    end

    subgraph MASUMI["Masumi"]
        M1[DIDs]
        M2[Credentials]
    end

    subgraph SOKOSUMI["Sokosumi"]
        S1[Service Discovery]
        S2[Coordination]
    end

    X402 --> STELLAR[(Stellar)]
    MASUMI --> STELLAR
    SOKOSUMI --> STELLAR


Loading

Smart Contracts

Contract Purpose Key Functions
Loan P2P lending create_loan, repay_loan, liquidate
Escrow Trade protection create, confirm, dispute
Credit Risk scoring update_score, get_limit

API Reference

Endpoints

Method Path Description
GET /health Health check
GET /agents List agents
GET /agents/:id Agent details
POST /agents/:id/fund Fund agent
GET /metrics Prometheus metrics

Example

# List agents
curl http://localhost:3402/agents

# Fund an agent
curl -X POST http://localhost:3402/agents/agent-1/fund \
  -H "Content-Type: application/json" \
  -d '{"amount": "100", "sourcePublicKey": "GABC..."}'

Performance

Metric Target
Settlement Finality 3-5 seconds
Payment Channel Latency <100ms
Agent Decision Time <1 second

Development

npm run dev          # Development server
npm run build        # Build TypeScript
npm run lint         # Lint code
npm run test         # Run tests

Build Contracts

cd contracts/loan
cargo build --release --target wasm32-unknown-unknown

Deployment

Docker

docker build -t project-cygnus .
docker-compose up -d

Kubernetes

kubectl apply -f k8s/

See DEPLOYMENT_GUIDE.md for details.


Advanced Architecture & Infrastructure Diagrams

1. NUMA Architecture
flowchart TB
    subgraph Node0[NUMA Node 0]
        CPU0[CPU 0]
        CPU1[CPU 1]
        MEM0[(Local Memory 0)]
        CPU0 <--> MEM0
        CPU1 <--> MEM0
    end
    
    subgraph Node1[NUMA Node 1]
        CPU2[CPU 2]
        CPU3[CPU 3]
        MEM1[(Local Memory 1)]
        CPU2 <--> MEM1
        CPU3 <--> MEM1
    end
    
    Node0 <-->|QPI / UPI Interconnect| Node1
Loading
2. Hypervisor Architecture
flowchart TB
    subgraph VMs[Virtual Machines]
        subgraph VM1
            APP1[Apps]
            OS1[Guest OS]
            APP1 --> OS1
        end
        subgraph VM2
            APP2[Apps]
            OS2[Guest OS]
            APP2 --> OS2
        end
    end
    
    HV[Hypervisor / VMM]
    HW[Physical Hardware: CPU, RAM, Disk, NIC]
    
    VM1 --> HV
    VM2 --> HV
    HV --> HW
Loading
3. Virtualization Stack
flowchart TD
    subgraph UserSpace[User Space]
        App[Application]
        Lib[Libraries / Bins]
    end
    
    subgraph Guest[Guest OS]
        GKernel[Guest Kernel]
        VDrivers[Virtual Drivers]
    end
    
    subgraph Host[Host OS]
        KVM[KVM Module]
        QEMU[QEMU Hardware Emulator]
        HKernel[Host Kernel]
    end
    
    App --> Lib
    Lib --> GKernel
    GKernel --> VDrivers
    VDrivers --> QEMU
    QEMU <--> KVM
    KVM --> HKernel
Loading
4. Container Runtime Flow
flowchart LR
    CLI[Docker/Podman CLI] -->|API| Daemon[Container Daemon]
    Daemon -->|gRPC| Containerd[containerd]
    Containerd -->|Exec| Shim[containerd-shim]
    Shim -->|Fork/Exec| Runc[runc]
    Runc -->|Create| Cont[Container Process]
Loading
5. OCI Container Architecture
flowchart TB
    subgraph OCI[Open Container Initiative]
        ImageSpec[Image Specification]
        RuntimeSpec[Runtime Specification]
    end
    
    Registry[(Container Registry)]
    Engine[Container Engine]
    Runc[OCI Runtime: runc]
    
    Registry -->|Image Pull| Engine
    Engine -->|Follows| ImageSpec
    Engine -->|Passes Bundle to| Runc
    Runc -->|Follows| RuntimeSpec
    Runc --> Container[Running Container]
Loading
6. CRI Architecture
flowchart LR
    Kubelet[Kubelet]
    
    subgraph CRI[Container Runtime Interface]
        API[gRPC API]
    end
    
    subgraph Runtime[CRI Runtime]
        Containerd[containerd / CRI-O]
        Shim[Shim]
        Runc[runc / crun]
    end
    
    Kubelet -->|ImageService API| CRI
    Kubelet -->|RuntimeService API| CRI
    CRI --> Containerd
    Containerd --> Shim
    Shim --> Runc
Loading
7. eBPF Program Flow
flowchart TD
    subgraph UserSpace[User Space]
        Loader[eBPF Loader App]
        Maps[(eBPF Maps)]
    end
    
    subgraph KernelSpace[Kernel Space]
        Verifier[eBPF Verifier]
        JIT[JIT Compiler]
        Prog[eBPF Program]
        Hook[Kernel Hook Point]
    end
    
    Loader -->|bpf syscall| Verifier
    Verifier --> JIT
    JIT --> Prog
    Prog -->|Attaches to| Hook
    Prog <-->|Read/Write| Maps
    Loader <-->|Read/Write| Maps
Loading
8. Service Discovery Flow
flowchart LR
    subgraph ControlPlane[Control Plane]
        SD[(Service Registry)]
    end
    
    Provider[Service Provider]
    Consumer[Service Consumer]
    LB[Load Balancer]
    
    Provider -->|1. Register| SD
    Provider -->|2. Send Heartbeat| SD
    Consumer -->|3. Discover| SD
    SD -.->|4. Return Endpoints| Consumer
    Consumer -->|5. Route Request| LB
    LB -->|6. Forward| Provider
Loading
9. Distributed Tracing Architecture
flowchart TD
    subgraph Apps
        A1[Microservice A]
        A2[Microservice B]
        A3[Microservice C]
        
        A1 -->|HTTP Request| A2
        A2 -->|gRPC Request| A3
    end
    
    Agent[Tracing Agent]
    Collector[Trace Collector]
    DB[(Storage Backend)]
    UI[Trace UI]
    
    A1 -.->|Span| Agent
    A2 -.->|Span| Agent
    A3 -.->|Span| Agent
    
    Agent --> Collector
    Collector --> DB
    UI --> DB
Loading
10. OpenTelemetry Flow
flowchart LR
    subgraph App[Application]
        SDK[OpenTelemetry SDK]
        Inst[Instrumentation]
        Inst --> SDK
    end
    
    subgraph OTel[OpenTelemetry Collector]
        Rec[Receivers]
        Proc[Processors]
        Exp[Exporters]
        
        Rec --> Proc --> Exp
    end
    
    subgraph Backends[Observability Backends]
        Jaeger[Jaeger - Traces]
        Prom[Prometheus - Metrics]
        Loki[Loki - Logs]
    end
    
    SDK -->|OTLP| Rec
    Exp --> Jaeger
    Exp --> Prom
    Exp --> Loki
Loading

Team

|------|------| | Dijo S Benelen | Lead Developer & Architecture | | Hemhalatha V R | Smart Contracts & Protocol | | Vishnu Priyan | Frontend & Dashboard |


Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/name
  3. Commit changes: git commit -m 'Add feature'
  4. Push: git push origin feature/name
  5. Open Pull Request

See CONTRIBUTING.md for guidelines.


License

MIT License — see LICENSE

Acknowledgments


Built for the Machine Economy

About

An autonomous agentic ecosystem on the Stellar blockchain enabling machine-to-machine commerce, AI trading, and decentralized credit

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages