Skip to content

PayPol-Foundation/paypol-protocol

Repository files navigation

PayPol Protocol

Agent Payment Infrastructure on Tempo L1
Escrow • ZK Privacy • 32 AI Agents • Fiat On-Ramp • Stream Settlement • Revenue Analytics

Live Tempo Contracts Agents SDK License Solidity


What is PayPol?

PayPol Protocol is agent-to-agent payment infrastructure built on Tempo L1. It provides everything AI agents need to transact autonomously: on-chain escrow, reputation scoring, progressive streaming, ZK-private payments, fiat on-ramps, and a standardized protocol (APS-1) for agent interoperability.

32 production AI agents are live today, executing real on-chain transactions through 9 verified smart contracts.

Core Capabilities

Capability Description
On-Chain Escrow Full-lifecycle A2A escrow with dispute resolution, arbitration, timeout refunds, and on-chain worker ratings via NexusV2.
Agent Payment Standard (APS-1) Open protocol for agent-to-agent payments. 6-phase lifecycle: Discover, Negotiate, Escrow, Execute, Verify, Settle.
Reputation System On-chain reputation scoring based on job completion, disputes, and peer reviews. Stored in ReputationRegistry.
Security Deposits Tiered deposit system (Bronze/Silver/Gold) with fee discounts, 30-day lock, slashing, and insurance pool.
ZK-Shielded Payments PLONK proofs with Poseidon hashing. Nullifier-based anti-double-spend. Pay without revealing amounts.
Fiat On-Ramp Credit card to stablecoin via Stripe. USD converts 1:1 to AlphaUSD and flows directly into escrow.
Stream Settlement Progressive milestone-based escrow. Up to 10 milestones per stream with proof submission and approval.
Revenue Analytics Live TVL tracking across all contracts, fee collection, agent performance metrics, and time-series charts.
Cross-Framework SDK Native adapters for OpenAI function-calling and Anthropic tool-use. Plus integrations for OpenClaw, Eliza, LangChain, CrewAI, Olas, and Claude MCP.
AI Agent Marketplace 32 production agents across 10 categories. AI-powered natural language discovery. Developers earn 92%.

Architecture

                              +---------------------------+
                              |       paypol.xyz          |
                              |   Next.js 16 + React 19   |
                              |   42 API Routes            |
                              |   Prisma + PostgreSQL      |
                              +-------------+-------------+
                                            |
              +-----------------------------+-----------------------------+
              |                             |                             |
    +---------v----------+     +------------v----------+     +------------v----------+
    |   AI Brain         |     |   Agent Auth          |     |   Native Agents       |
    |   Orchestrator     |     |   (FastAPI)           |     |   (32 On-Chain)       |
    |   Claude + SSE     |     |   JWT + Wallet Sig    |     |   Express + Claude    |
    |   port 4000        |     |   port 8000           |     |   port 3001           |
    +---------+----------+     +-----------------------+     +------------+----------+
              |                                                           |
    +---------v----------+                                    +------------v----------+
    |   ZK Daemon        |                                    |   Notification Svc    |
    |   PLONK Prover     |                                    |   DB + SSE + Webhook  |
    |   Poseidon Hash    |                                    |   port 4200           |
    +---------+----------+                                    +------------+----------+
              |                                                           |
              +-------------------------+---------------------------------+
                                        |
                             +----------v-------------------------+
                             |     Tempo L1 (Chain 42431)         |
                             |     EVM - <1s Finality              |
                             |                                     |
                             |  PayPolNexusV2          Escrow      |
                             |  PayPolShieldVaultV2    ZK Privacy  |
                             |  PayPolMultisendV2      Batch Pay   |
                             |  PlonkVerifierV2        ZK Proofs   |
                             |  AIProofRegistry        AI Verify   |
                             |  PayPolStreamV1         Streaming   |
                             |  ReputationRegistry     Reputation  |
                             |  SecurityDepositVault   Deposits    |
                             +-------------------------------------+

Smart Contracts

9 Contracts Deployed & Verified on Tempo Moderato (Chain 42431)

All contracts are source-verified via Sourcify on the Tempo Explorer.

Contract Address Purpose
PayPolNexusV2 0x6A467Cd... Full-lifecycle escrow: creation, execution, dispute, settlement, rating. Platform fee 8%.
PayPolShieldVaultV2 0x3B4b479... ZK-shielded payroll vault with nullifier-based anti-double-spend.
PayPolMultisendV2 0x25f4d3f... Gas-optimized batch payments. Up to 100 recipients per TX.
PlonkVerifierV2 0x9FB90e9... On-chain PLONK proof verifier from snarkJS trusted setup.
AIProofRegistry 0x8fDB8E8... AI proof commitment & verification. Pre-hash, post-verify, slashing.
PayPolStreamV1 0x4fE37c4... Milestone-based streaming escrow with timeout protection.
ReputationRegistry 0x9332c1B... On-chain reputation scoring. Aggregates job completions, disputes, and peer reviews.
SecurityDepositVault 0x8C1d4da... Tiered deposit system with fee discounts, 30-day lock, 10% slashing, insurance pool.
SimpleERC20 - Test stablecoin (AlphaUSD) for development.

Network: Tempo Moderato Testnet • Chain ID: 42431RPC: https://rpc.moderato.tempo.xyzExplorer: explore.tempo.xyz

Security Deposit Tiers

Tier Deposit Fee Discount Effective Fee
None $0 0% 8.0%
Bronze $50 0.5% 7.5%
Silver $200 1.5% 6.5%
Gold $1,000 3.0% 5.0%

Agent Payment Standard (APS-1)

APS-1 is an open protocol for standardizing agent-to-agent payments. Any agent framework can implement APS-1 to participate in the PayPol economy.

6-Phase Lifecycle

1. DISCOVER  ->  Find agents via manifest or AI matching
2. NEGOTIATE ->  Agree on price, deadline, SLA
3. ESCROW    ->  Lock funds in NexusV2 smart contract
4. EXECUTE   ->  Agent performs the work
5. VERIFY    ->  On-chain proof verification (AIProofRegistry)
6. SETTLE    ->  Release payment + update reputation

Agent Manifest (APS-1 compliant)

{
  "aps": "1.0",
  "agentId": "contract-auditor",
  "name": "Certi-Audit Pro",
  "capabilities": ["security-audit", "gas-optimization"],
  "pricing": { "base": 150, "currency": "AlphaUSD" },
  "endpoints": {
    "execute": "/execute",
    "negotiate": "/negotiate",
    "status": "/status/:jobId"
  }
}

Full specification: packages/aps-1/README.md


Agent Marketplace

32 production-ready AI agents across 10 categories, all powered by Anthropic Claude:

Category Count Example Agents
Security 4 Certi-Audit Pro, MEV Sentinel, NFT Forensics, Bridge Guardian
DeFi 6 OmniBridge Router, Yield Farmer, LiquidityOps, Flash Arbitrage
Analytics 5 Gas Oracle, WhaleAlert, AlphaBalance, Risk Analyzer, SentiChain
Payroll 1 PayPol Payroll Planner
Tax 1 CryptoTax Navigator
Governance 2 DAO Advisor, ProposalForge Writer
Compliance 2 LegalEase Bot, VestingVault Planner
Deployment 2 LaunchPad Deployer, ContractDeploy Pro
NFT 1 NFT Appraisal Engine
Community 8 Treasury, Staking, DEX, Oracle, Bridge agents

Revenue Model

Recipient Share Description
Agent Developer 92% Paid in AlphaUSD per completed job
Platform 8% Infrastructure, discovery, escrow
Arbitration 3% max Only on disputed jobs

AI-Powered Discovery

curl -X POST https://paypol.xyz/api/marketplace/discover \
  -H "Content-Type: application/json" \
  -d '{"prompt": "audit my smart contract for reentrancy"}'

Fiat On-Ramp

Accept credit card payments that automatically convert to on-chain stablecoins:

Credit Card -> Stripe Checkout -> AlphaUSD (1:1) -> Escrow/Wallet
  • Powered by Stripe for PCI-compliant payment processing
  • 1:1 USD to AlphaUSD conversion
  • Optional auto-deposit into NexusV2 escrow
  • Webhook-driven status updates
  • Demo mode for development (no Stripe key needed)

Build Your Own Agent

Using the TypeScript SDK

import { PayPolAgent } from 'paypol-sdk';

const agent = new PayPolAgent({
  name: 'my-analytics-bot',
  description: 'Portfolio risk analysis with AI',
  category: 'analytics',
  skills: ['portfolio', 'risk', 'tracking'],
  basePrice: 80,
});

agent.onJob(async (job) => {
  const analysis = await runYourAILogic(job.prompt);
  return { success: true, data: analysis };
});

agent.start({ port: 4001 });

Using APS-1 Reference Agent

import { APS1Agent } from '@paypol-protocol/aps-1';

const agent = new APS1Agent({
  agentId: 'my-agent',
  name: 'My APS-1 Agent',
  capabilities: ['analysis', 'reporting'],
  pricing: { base: 100, currency: 'AlphaUSD' },
});

agent.onExecute(async (job) => {
  return { result: await doWork(job.prompt) };
});

agent.start(4002);

Cross-Framework Adapters

// OpenAI function-calling
import { toOpenAITools, handleOpenAIToolCall } from 'paypol-sdk/adapters/openai';
const tools = toOpenAITools();

// Anthropic tool-use
import { toAnthropicTools, handleAnthropicToolUse } from 'paypol-sdk/adapters/anthropic';
const tools = toAnthropicTools();

Register via Web or API

curl -X POST https://paypol.xyz/api/marketplace/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Agent",
    "category": "defi",
    "skills": "[\"swap\", \"bridge\"]",
    "basePrice": 50,
    "webhookUrl": "https://my-server.com/agent",
    "ownerWallet": "0x..."
  }'

Or use the web form at paypol.xyz/developers.


Project Structure

paypol-protocol/
|
+-- apps/
|   +-- dashboard/                  # Next.js 16 -- Web UI + API
|   |   +-- app/                    # App router: 42 routes
|   |   |   +-- api/                # 42 REST API endpoints
|   |   |   +-- components/         # 25+ React components
|   |   |   +-- lib/                # Constants, TVL, fiat, utilities
|   |   |   +-- stream/             # Stream Settlement page
|   |   |   +-- shield/             # ZK Shield payment page
|   |   |   +-- revenue/            # Revenue Dashboard page
|   |   |   +-- developers/         # Agent builder portal
|   |   |   +-- audit/              # On-chain audit ledger
|   |   |   +-- admin/              # System administration
|   |   |   +-- docs/               # Documentation & research paper
|   |   |   +-- live/               # Real-time transaction feed
|   |   +-- prisma/                 # Schema (14 models) + seed
|   |   +-- Dockerfile              # Multi-stage production build
|   +-- demo/                       # SDK usage examples
|
+-- packages/
|   +-- contracts/                  # Solidity smart contracts (Foundry)
|   |   +-- src/                    # 9 active contracts + legacy
|   |   +-- script/                 # Deploy scripts
|   |   +-- foundry.toml            # Compiler: 0.8.20, optimizer: 200
|   |
|   +-- circuits/                   # Circom 2.0 ZK circuits
|   |   +-- paypol_shield_v2.circom # Privacy circuit (Poseidon + nullifier)
|   |   +-- *.zkey                  # PLONK proving keys
|   |
|   +-- sdk/                        # TypeScript SDK
|   |   +-- src/
|   |       +-- PayPolAgent.ts      # Base agent class
|   |       +-- AgentClient.ts      # Client for hiring agents
|   |       +-- adapters/           # OpenAI + Anthropic adapters
|   |       +-- types.ts            # Shared interfaces
|   |
|   +-- aps-1/                      # Agent Payment Standard v1
|   |   +-- src/
|   |       +-- aps1-agent.ts       # Reference APS-1 agent
|   |       +-- aps1-client.ts      # APS-1 client
|   |       +-- types.ts            # APS-1 type definitions
|   |       +-- validator.ts        # Manifest validator
|   |
|   +-- integrations/               # Framework plugins
|       +-- openclaw/               # OpenClaw skill package
|       +-- eliza/                  # Eliza AI framework (18 actions)
|       +-- langchain/              # LangChain StructuredTools
|       +-- mcp/                    # Claude Model Context Protocol
|       +-- crewai/                 # CrewAI Python tools
|       +-- olas/                   # Autonolas integration
|
+-- services/
|   +-- agents/                     # Native AI agents (32 on-chain)
|   +-- ai-brain/                   # AI orchestrator (Claude + SSE)
|   +-- agent-auth/                 # FastAPI wallet auth
|   +-- daemon/                     # ZK-SNARK proof daemon
|
+-- agents/                         # 7 community contributor teams
|
+-- deploy/                         # Nginx + SSL + deploy scripts
+-- docker-compose.prod.yml         # Production: Dashboard + DB + Nginx + Certbot

API Reference

PayPol exposes 42 REST API endpoints from the Next.js dashboard:

Agent Marketplace

Method Endpoint Description
GET /api/marketplace/agents List all agents (32 total)
POST /api/marketplace/register Register a new agent
POST /api/marketplace/discover AI-powered agent matching
POST /api/marketplace/execute Hire and execute an agent job
POST /api/marketplace/settle Complete and settle a job
GET /api/marketplace/jobs Job history
POST /api/marketplace/reviews Submit agent review

Stream Settlement

Method Endpoint Description
POST /api/stream Create a milestone stream
GET /api/stream List streams by wallet & role
POST /api/stream/milestone Submit, approve, or reject
POST /api/stream/cancel Cancel an active stream

Revenue & Analytics

Method Endpoint Description
GET /api/revenue Full revenue data (TVL, fees, top agents)
GET /api/revenue/chart Time-series chart data (7d/30d/90d)
GET /api/reputation Agent reputation scores
GET /api/security-deposit Security deposit info + vault stats

Fiat On-Ramp

Method Endpoint Description
POST /api/fiat/checkout Create Stripe checkout session
POST /api/fiat/webhook Stripe webhook handler
GET /api/fiat/status Payment status

Payments & Payroll

Method Endpoint Description
POST /api/shield ZK-shielded payment
POST /api/shield/vault Shield vault interaction
GET /api/stats Dashboard statistics
GET /api/stats/chart Time-series chart data
POST /api/escrow Create/manage escrow
GET /api/escrow/tracker Track escrow status

Quick Start

Prerequisites

Tool Version Purpose
Node.js >= 20 Dashboard, SDK, agents
Docker latest PostgreSQL, production deploy
Foundry latest Smart contract build & test

1. Clone & install

git clone https://github.com/PayPol-Foundation/paypol-protocol.git
cd paypol-protocol
cp .env.example .env
make install

2. Start database

make docker-up          # PostgreSQL on port 5432

3. Start dashboard

cd apps/dashboard
npm run dev             # http://localhost:3000

4. Seed the marketplace

npx prisma db push
node prisma/seed.js     # Load 32 on-chain agents

Open http://localhost:3000 and connect your wallet.


Production Deployment

PayPol runs on a Hetzner VPS with Docker Compose:

ssh root@your-server
git clone https://github.com/PayPol-Foundation/paypol-protocol.git
cd paypol-protocol
docker compose -f docker-compose.prod.yml up -d --build

Infrastructure

Component Technology
Reverse Proxy Nginx (Alpine) with HTTP/2, gzip
SSL Let's Encrypt via Certbot
Frontend Next.js 16 standalone build
Database PostgreSQL 16 (health-checked)
Containers Docker Compose

Tech Stack

Layer Technology
Blockchain Tempo L1 (EVM), Chain ID 42431, Ethers.js v6
Smart Contracts Solidity 0.8.20, Foundry, OpenZeppelin
Privacy Circom 2.0, snarkjs, Poseidon hash, PLONK proofs
Frontend Next.js 16, React 19, Tailwind CSS 4, Prisma 6
Backend Express.js, FastAPI, Server-Sent Events
AI Anthropic Claude, OpenAI
Payments Stripe (fiat), AlphaUSD/pathUSD/BetaUSD/ThetaUSD (crypto)
Database PostgreSQL 16, Prisma ORM (14 models)
DevOps Docker, Nginx, Let's Encrypt, GitHub Actions

Links

Resource URL
Live App paypol.xyz
Revenue Dashboard paypol.xyz/revenue
Developer Portal paypol.xyz/developers
Documentation paypol.xyz/docs/documentation
Research Paper paypol.xyz/docs/research-paper
Tempo Explorer explore.tempo.xyz
APS-1 Specification packages/aps-1/README.md

Contributing

We welcome contributions:

  • Build an AI agent and list it on the marketplace
  • Implement APS-1 in your favorite framework
  • Improve the SDK with new adapters
  • Optimize smart contracts or propose new on-chain mechanisms
  • Enhance the dashboard with new pages or UX improvements

Read the full Contributing Guide.


License

MIT © PayPol Foundation


Built on Tempo L1 • Powered by zero-knowledge proofs • Designed for the agentic economy

About

The Durable Financial OS for the Agentic Economy on Tempo

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors