zkproofport-ai
proofport-ai
面向 ZKProofport 的智能体原生 ZK 证明基础设施。这是一个独立服务,可在 AWS Nitro Enclave 内生成并验证零知识证明,并提供端到端加密——服务器充当盲中继(blind relay),永远无法看到证明输入。
架构
Client (AI Agent / SDK)
│
│ 1. POST /api/v1/prove → 402 { nonce, price, teePublicKey }
│ 2. Sign EIP-3009 USDC payment
│ 3. Encrypt inputs with TEE X25519 public key (ECIES)
│ 4. POST /api/v1/prove + X-Payment-TX + X-Payment-Nonce + encrypted_payload
│
▼
┌─────────────────────────────────────┐
│ Node.js Server (port 4002) │
│ ─ Verify USDC payment on-chain │
│ ─ Blind relay: pass encrypted │
│ payload to enclave via vsock │
│ ─ Return proof + TEE attestation │
└────────────┬────────────────────────┘
│ vsock
▼
┌─────────────────────────────────────┐
│ AWS Nitro Enclave │
│ ─ X25519 key pair (bound to NSM) │
│ ─ Decrypt inputs (AES-256-GCM) │
│ ─ bb prove (Barretenberg CLI) │
│ ─ NSM attestation of proof hash │
└─────────────────────────────────────┘关键特性:
端到端加密 — X25519 ECDH + AES-256-GCM。在
nitro模式下,明文输入会被拒绝。盲中继 — Node.js 主机无法读取证明输入。只有 Enclave 可以解密。
x402 支付 — 单步流程:402 质询 → USDC 支付 → 证明生成。无需中间件。
硬件证明 — NSM 证明文档将 TEE 公钥绑定到 Enclave 度量(PCRs)。
Related MCP server: AgentStamp
目录结构
proofport-ai/
├── src/
│ ├── index.ts # Express server entry (port 4002)
│ ├── logger.ts # Pino logger
│ ├── swagger.ts # OpenAPI spec
│ ├── tracing.ts # OpenTelemetry tracing
│ ├── a2a/
│ │ ├── agentCard.ts # /.well-known/agent.json, agent-card.json
│ │ ├── proofportExecutor.ts # A2A task executor
│ │ └── redisTaskStore.ts # Redis-backed task persistence
│ ├── chat/
│ │ ├── geminiClient.ts # Gemini API client
│ │ ├── llmProvider.ts # LLM provider interface
│ │ ├── multiProvider.ts # Multi-provider routing
│ │ └── openaiClient.ts # OpenAI API client
│ ├── circuit/
│ │ └── artifactManager.ts # Circuit artifact download/cache
│ ├── config/
│ │ ├── index.ts # Environment config
│ │ ├── circuits.ts # Circuit metadata
│ │ └── contracts.ts # Deployed contract addresses
│ ├── identity/
│ │ ├── agentAuth.ts # Agent JWT authentication
│ │ ├── autoRegister.ts # ERC-8004 auto-registration
│ │ ├── register.ts # Identity registration
│ │ └── reputation.ts # Reputation management
│ ├── input/
│ │ ├── attestationFetcher.ts # EAS GraphQL attestation fetch
│ │ ├── inputBuilder.ts # Circuit input construction
│ │ └── merkleTree.ts # Merkle tree builder
│ ├── mcp/
│ │ ├── server.ts # StreamableHTTP MCP server
│ │ └── stdio.ts # stdio MCP server (local use)
│ ├── payment/
│ │ └── freeTier.ts # Payment mode config
│ ├── proof/
│ │ ├── proofRoutes.ts # x402 single-step proof API
│ │ ├── guideBuilder.ts # Dynamic proof generation guide
│ │ ├── paymentVerifier.ts # On-chain USDC payment verification
│ │ ├── sessionManager.ts # Proof session/nonce management
│ │ └── types.ts
│ ├── prover/
│ │ ├── bbProver.ts # bb CLI direct prover
│ │ ├── tomlBuilder.ts # Prover.toml builder
│ │ └── verifier.ts # On-chain verification (ethers v6)
│ ├── redis/
│ │ ├── client.ts # Redis client
│ │ ├── cleanupWorker.ts # Expired data cleanup
│ │ ├── constants.ts # Redis key prefixes
│ │ ├── proofCache.ts # Proof result caching
│ │ ├── proofResultStore.ts # Proof result persistence
│ │ └── rateLimiter.ts # Rate limiting
│ ├── skills/
│ │ ├── skillHandler.ts # Skill routing
│ │ └── flowGuidance.ts # Step-by-step flow guidance
│ ├── tee/
│ │ ├── index.ts # TEE mode config
│ │ ├── attestation.ts # NSM attestation validation (COSE Sign1)
│ │ ├── detect.ts # TEE environment detection
│ │ ├── enclaveBuilder.ts # Enclave image builder
│ │ ├── enclaveClient.ts # Nitro Enclave vsock client
│ │ ├── encryption.ts # AES-256-GCM encryption utilities
│ │ ├── teeKeyExchange.ts # X25519 ECDH key exchange
│ │ └── validationSubmitter.ts # TEE validation on-chain
│ └── types/
│ └── index.ts
├── packages/
│ ├── sdk/ # @zkproofport-ai/sdk (npm)
│ └── mcp/ # @zkproofport-ai/mcp (npm)
├── aws/
│ ├── enclave-server.ts # TypeScript TEE prover (Nitro Enclave)
│ ├── Dockerfile.enclave # Enclave image
│ ├── deploy-blue-green.sh # Zero-downtime deployment
│ ├── boot-active-slot.sh # Systemd boot script
│ ├── stop-active-slot.sh # Systemd stop script
│ ├── build-enclave.sh # Enclave build helper
│ ├── ec2-setup.sh # EC2 instance setup
│ ├── Caddyfile # Reverse proxy config
│ ├── docker-compose.aws.yml # AWS Docker Compose
│ ├── vsock-bridge.py # vsock-to-TCP bridge
│ └── systemd/ # Systemd service files
├── sign-page/ # Next.js signing page (WalletConnect)
├── tests/
│ ├── e2e/ # Full E2E tests (REST, MCP, A2A, proof, verify)
│ ├── a2a/ # A2A unit tests
│ ├── identity/ # ERC-8004 identity tests
│ ├── integration/ # Integration tests
│ ├── payment/ # Payment tests
│ ├── tee/ # TEE tests
│ └── *.test.ts # Unit tests
├── docker-compose.yml # Local dev: server + redis
├── docker-compose.test.yml # Test stack: + a2a-ui + Phoenix
├── Dockerfile # Node.js server image
└── README.md快速入门
npm (开发)
npm install
npm run dev # Hot reload with tsx
npm run build # Build TypeScript
npm start # Production
npm test # Run tests
npm run test:e2e # E2E tests against Docker stackDocker Compose (本地)
docker compose up --build # Start redis + server
docker compose down # Stop
docker compose down -v # Reset data端口 4002: Node.js 服务器
端口 6380 (主机) → 6379 (容器): Redis
端到端加密 (盲中继)
证明输入在客户端和 Nitro Enclave 之间进行端到端加密。Node.js 服务器在不读取的情况下传递加密数据块。
协议: X25519 ECDH + AES-256-GCM (ECIES 模式)
TEE 在启动时生成 X25519 密钥对,并将公钥绑定到 NSM 证明
客户端从 402 响应中获取 TEE 公钥,并验证证明
客户端生成临时 X25519 密钥对,计算 ECDH 共享密钥,通过 SHA-256 派生 AES 密钥
客户端使用 AES-256-GCM 加密输入,发送
{ ephemeralPublicKey, iv, ciphertext, authTag, keyId }服务器通过 vsock 将加密信封传递给 Enclave(盲中继)
Enclave 解密,生成证明,返回证明 + NSM 证明
强制执行: 在 nitro 模式下,明文输入会被 PLAINTEXT_REJECTED 拒绝。
x402 支付流程
单步原子流程——无中间件,无会话:
POST /api/v1/prove { circuit, inputs }
↓
402 { nonce, price, payTo, teePublicKey }
↓
Client signs EIP-3009 TransferWithAuthorization (USDC)
↓
POST /api/v1/prove { circuit, encrypted_payload }
+ X-Payment-TX: <txHash>
+ X-Payment-Nonce: <nonce>
↓
200 { proof, publicInputs, proofWithInputs, attestation, timing, verification }支付模式:
模式 | 网络 | 效果 |
| 无 | 所有请求免费 |
| Base Sepolia | 需要 USDC 支付 (测试网) |
| Base Mainnet | 需要 USDC 支付 (生产环境) |
REST 端点
端点 | 方法 | 用途 |
| GET | 健康检查 + TEE 状态 + 支付模式 |
| POST | x402 单步证明生成 |
| GET | 动态证明生成指南 (JSON) |
| POST | StreamableHTTP MCP 端点 |
| POST | A2A JSON-RPC 端点 |
| GET | OASF 智能体卡片 |
| GET | A2A 智能体卡片 |
| GET | MCP 发现 |
| GET | Swagger UI |
| GET | OpenAPI 规范 |
MCP 工具
可通过 /mcp (StreamableHTTP) 或本地 @zkproofport-ai/mcp 包 (stdio) 使用:
工具 | 用途 |
| 一体化证明生成 (x402 支付 + E2E 加密自动检测) |
| 链上证明验证 |
| 列出可用电路 |
| 请求 402 质询 (分步流程) |
| 进行 x402 USDC 支付 (分步流程) |
| 提交证明输入 (分步流程) |
| 准备电路输入 (分步流程) |
npm 包
@zkproofport-ai/sdk — TypeScript SDK for proof generation (ethers v6)
@zkproofport-ai/mcp — Local MCP server for AI agents (stdio transport)安装 MCP 服务器以供本地 AI 智能体使用:
npm install @zkproofport-ai/mcp
npx zkproofport-mcp # Starts stdio MCP server指南系统
GET /api/v1/guide/:circuit 返回一份全面的 JSON 指南,供客户端 AI 智能体准备所有证明输入。包括:
带有代码示例的分步说明
常量(证明者密钥、合约地址、EAS 模式 UID)
公式(无效符计算、信号哈希、Merkle 树构建)
带有类型和描述的输入模式
EAS GraphQL 查询模板
电路使用别名:coinbase_kyc → coinbase_attestation,coinbase_country → coinbase_country_attestation,oidc_domain → oidc_domain_attestation。
A2A 协议
A2A v0.3 JSON-RPC 端点位于 POST /a2a:
方法 | 用途 |
| 提交证明任务 (阻塞) |
| 提交证明任务 (SSE 流式传输) |
| 查询任务状态 |
| 取消正在运行的任务 |
| 重新订阅任务事件 |
位于 /.well-known/agent.json 的智能体卡片提供 ERC-8004 链上身份和能力发现。
TEE 集成 (AWS Nitro Enclave)
模式 | 行为 |
| 标准 Linux,无 TEE,允许明文 |
| AWS Nitro Enclave,硬件证明,强制执行 E2E 加密 |
Enclave 运行 aws/enclave-server.ts (编译为 dist/aws/enclave-server.js),该程序执行带有 --oracle_hash keccak (Solidity 验证器兼容性所需) 的 bb prove。NSM 证明将证明哈希和 TEE 公钥绑定到 Enclave 度量 (PCR0/PCR1/PCR2)。
证明验证链: AWS Nitro 根 CA → 区域 → 区域性 → 实例 → 叶证书,使用 COSE ES384 签名验证。
支持的电路
Coinbase KYC (coinbase_attestation)
证明持有者已通过 Coinbase KYC 验证。
别名:
coinbase_kyc,coinbase_attestation公共输入: address, scope
无效符: 是 (隐私,防重放)
Coinbase 国家/地区 (coinbase_country_attestation)
证明持有者的 KYC 国家/地区与证明相符。
别名:
coinbase_country,coinbase_country_attestation公共输入: address, country, scope
无效符: 是 (隐私,防重放)
OIDC 域名 (oidc_domain_attestation)
通过 OIDC JWT 验证证明持有者拥有特定域名的电子邮件地址。
别名:
oidc_domain,oidc_domain_attestation输入类型: OIDC JWT (来自 Google 等的
id_token)公共输入: domain hash, scope
无效符: 是 (隐私,防重放)
合约地址
Base Sepolia (测试网)
合约 | 地址 |
KYC 验证器 |
|
国家/地区验证器 |
|
ERC-8004 身份 |
|
ERC-8004 声誉 |
|
Base Mainnet (生产环境)
合约 | 地址 |
ERC-8004 身份 |
|
ERC-8004 声誉 |
|
ERC-8004 智能体身份
智能体在启动时通过 ERC-8004 身份合约自动在链上注册。每次成功生成证明后,声誉分数都会增加。
环境变量
必需
变量 | 描述 |
| Redis 连接字符串 |
| Base 链 RPC 端点 |
| 用于证明验证的 RPC |
| 用于证明查询的 EAS GraphQL 端点 |
| 智能体钱包私钥 (64 位十六进制字符,无 0x) |
|
|
| 面向公众的服务 URL (用于智能体卡片) |
可选
变量 | 默认值 | 描述 |
|
| Express 服务器端口 |
|
| Node 环境 |
|
| Barretenberg CLI 路径 |
|
| Nargo CLI 路径 |
|
| 电路工件目录 |
| (GitHub 原始 URL) | 电路工件下载 URL |
|
|
|
| — | Nitro Enclave CID (当 |
|
| Nitro Enclave 端口 |
|
| 启用证明验证 |
| — | 运营商钱包 (启用支付时必需) |
|
| 每个证明的价格 (USD) |
| — | ERC-8004 身份合约 |
| — | ERC-8004 声誉合约 |
| — | 用于聊天的 Gemini API 密钥 |
| — | 用于聊天的 OpenAI API 密钥 |
| — | 用于追踪的 Phoenix OTLP 端点 |
|
| 智能体版本字符串 |
部署 (AWS Nitro Enclave)
proofport-ai 部署到支持 Nitro Enclave 的 AWS EC2。部署使用 蓝绿插槽切换 以实现零停机时间。
蓝绿部署
aws/deploy-blue-green.sh两个插槽:蓝色 (端口 4002/3200) 和绿色 (端口 4003/3201)
活动插槽记录在
/opt/proofport-ai/active-slot中Caddy 重载(非重启)切换流量
切换前排空正在进行的请求(证明生成最长 660 秒)
如果新容器健康检查失败,则自动回滚
基础设施
Caddy — 带有 HTTPS 的反向代理 (Cloudflare Full SSL)
systemd — 服务:
proofport-ai,proofport-ai-redis,proofport-ai-enclave,vsock-bridgeCloudWatch — 日志驱动
awslogs,保留 30 天GitHub Actions —
deploy-ai-aws.yml工作流 (非deploy.yml,那是 GCP 用的)
启动 / 停止
aws/boot-active-slot.sh # Start active slot containers
aws/stop-active-slot.sh # Stop active slot containers测试
npm test # Unit tests
npm run test:e2e # E2E against Docker stack
npm run test:watch # Watch modeA2A 测试 (a2a-ui + Phoenix)
docker compose -f docker-compose.yml -f docker-compose.test.yml up --build -d服务 | URL | 用途 |
proofport-ai |
| 智能体服务器 |
a2a-ui |
| A2A Web 测试 UI |
Phoenix |
| 追踪可视化 |
版本锁定
工具 | 版本 |
bb (Barretenberg) |
|
nargo |
|
ethers |
|
@modelcontextprotocol/sdk |
|
Node.js | 20 LTS |
许可证
Apache 2.0
Available Tools
7 toolsgenerate_proofA
All-in-one ZK proof generation. Handles: prepare inputs, request challenge, and submit proof in a single call. Use this when you want the simplest path to a proof. For fine-grained control over each step, use prepare_inputs, request_challenge, and submit_proof individually.
CIRCUITS:
"coinbase_kyc": Proves the user passed Coinbase KYC verification, optionally binding the wallet's signature to ONE EIP-712 action (as giwa_attestation). Without action it signs the request signal hash.
"coinbase_country": Proves the user's country of residence is (or is not) in a given list, optionally binding the wallet's signature to ONE EIP-712 action (as coinbase_kyc). Requires country_list and is_included.
"oidc_domain": Proves the user authenticated via OIDC and their email belongs to a specific domain. Requires jwt and scope.
"human_passport": Proves the wallet holds an unexpired Human Passport score at or above min_score, without revealing the wallet or the exact score; optionally binds ONE EIP-712 action (as coinbase_kyc). Requires min_score and chain (the chain id the person recorded the score on).
"giwa_attestation": GIWA attestation, optionally binding the wallet's signature to ONE EIP-712 action. Without action it signs the request signal hash. With one, the proof carries that action's hash, so a contract can check WHICH instruction was authorised -- not merely that somebody eligible signed something. Uses a GIWA-attested wallet; verified on GIWA Sepolia (chain 91342).
WITH ACTION: Returns awaiting_approval with an approval URL for the HUMAN to review and sign in their wallet. Keep the request parameters unchanged, query get_action_approval, then repeat with approval_id when approved. ATTESTATION_KEY cannot authorize an action on the human's behalf. Ordinary proofs without action retain automatic signing.
SIGNAL HASH: without an action the wallet signs signal_hash = keccak256(scope ++ circuitId ++ request_id). It contains no wallet address. Pass request_id when the verifier issued one; otherwise a fresh one is minted and returned as requestId.
NULLIFIER: wallet circuits require oprf_domain (the service the proof is for). The nullifier is one per wallet per (oprf_domain, scope), computed with the OPRF network before the wallet signs; a service whose environment has no OPRF network refuses before anything is signed or paid.
RETURNS: awaiting_approval or the full ProofResult with proof bytes, public inputs, timing information, and the requestId, scope and oprfDomain the proof answers. Use verify_proof separately to verify on-chain.
Inputs: scope (required), circuit (required), jwt, chain, +12 more.
get_action_approvalA
Read the status of a human wallet approval created by this MCP client. This operation never starts a proof or payment.
Inputs: approval_id (required).
get_supported_circuitsA
List all ZK circuits supported by ZKProofport, including verifier addresses and authorized signers. No parameters required. Call this first to discover available circuits before starting proof generation.
Inputs: no named parameters.
prepare_inputsA
Step 1 of the step-by-step flow. WITH ACTION: human wallet approval is required; returns awaiting_approval until resumed with approval_id. Approved action witnesses stay in private local storage; pass the returned prepared_inputs_id to submit_proof. The action hash is public: an action whose proof is shown off-chain should not contain the wallet's address. WITHOUT ACTION: the credential key signs signal_hash = keccak256(scope ++ circuitId ++ request_id), no wallet address; the first result block is the inputs for submit_proof, the second names request_id and scope for the verifier. Handle private witness inputs only in trusted local code, never expose them to the dApp, model or logs. Call this BEFORE request_challenge. For oidc_domain provide jwt and scope.
Inputs: scope (required), circuit (required), jwt, chain, +8 more.
request_challengeA
Step 2 of the step-by-step flow: Request a challenge from the server. Pass inputs: {} to discover the live payment offers, nonce and optional TEE key without transmitting private witness inputs. You MUST pass the returned "nonce" to submit_proof — without it the server just issues another challenge. MCP submit_proof does not sign payments or encrypt inputs; use generate_proof or the SDK for paid/encrypted orchestration.
Inputs: inputs (required), circuit (required).
submit_proofA
Step 3 of the step-by-step flow: Submit prepared inputs to generate the ZK proof. The TEE server runs the Noir circuit and returns the UltraHonk proof. This step may take 30-90 seconds. The TEE server builds Prover.toml from these inputs.
You MUST pass the nonce returned by request_challenge. POST /api/v1/prove answers every request that arrives without that nonce with a fresh 402 challenge, so a submission that omits it can never produce a proof.
Inputs: nonce (required), circuit (required), inputs, prepared_inputs_id.
verify_proofA
Step 4 (optional): Verify a ZK proof on-chain against ZKProofport's own pinned verifier contract for the circuit and chain. Pass the full generate_proof result object directly. The result's verifierAddress is only compared with the pinned one: a different address is refused, never called. Issuer anchors are checked too (OIDC provider key against Google/Microsoft's published keys; Coinbase/GIWA signer-list root). Returns { valid: true } if the proof is valid, otherwise { valid: false, error }.
Inputs: result (required), min_score.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
generate_proof deliberately overlaps with the prepare_inputs → request_challenge → submit_proof trio, but the description explicitly frames it as the convenience path versus fine-grained control, and each step tool has a distinct stated role and ordering. get_action_approval, verify_proof, and get_supported_circuits are clearly separate concerns, leaving only the intentional all-in-one/stepwise duality as potential confusion.
All seven tools follow a clean snake_case verb_noun pattern: generate_proof, prepare_inputs, request_challenge, submit_proof, verify_proof, get_action_approval, get_supported_circuits. Verbs (generate/prepare/request/submit/verify/get) match the actual operations with no mixed conventions.
Seven tools is well-scoped for a ZK proof server: discovery, an all-in-one path, a three-step manual flow, verification, and approval polling. Each tool maps to a real, non-redundant operation within that workflow.
The surface covers the full proof lifecycle from circuit discovery through generation and on-chain verification, including human-in-the-loop approval status. Minor gaps: no way to cancel or revoke a pending approval, no proof/status listing, and payment/encryption orchestration is explicitly deferred to the SDK, leaving MCP users unable to complete paid flows unaided.
Maintenance
Related MCP Connectors
A paid remote MCP for ZeroID, built to return verdicts, receipts, usage logs, and audit-ready JSON.
MCP server for the Z1N Protocol - on-chain identity for AI agents on Polygon
MCP server for verifying EUDI/Talao wallet data via OIDC4VP (pull) for AI agents.
Remote MCP server exposing 330 production AI-agent services for web/data processing, validation, AI utilities, blockchain/crypto utilities, and x402 pay-per-use access.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server for wallet auth: read wallet state on-chain, evaluate against conditions, return an ECDSA-signed boolean with a post-quantum companion signature. Condition-based access across 37 chains (EVM, Solana, XRPL, Bitcoin, Tron, Stellar, Sui). No balances, no identity, no shared secrets; verifiable offline via JWKS. 27 tools: wallet attestation, trust profiles, payment verification.27450 npm2MIT
- AlicenseAqualityDmaintenanceTrust intelligence MCP server for AI agents. 19 tools for identity stamps, reputation scoring (0-100), agent registry, forensic audit trails, ERC-8004 bridge, and A2A passports via x402 USDC micropayments.192Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP Server for AI agent identity and authorization. Create, verify, and manage agent identities with trust scores and scoped authorization tokens.MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server for agentic commerce, enabling AI agents to discover services, make x402 payments with USDC across multiple chains, and manage crypto wallets and token swaps.906 npm1MIT