zkproofport-ai
proofport-ai
Infraestructura de pruebas ZK nativa para agentes de ZKProofport. Un servicio independiente que genera y verifica pruebas de conocimiento cero dentro de un AWS Nitro Enclave con cifrado de extremo a extremo: el servidor actúa como un repetidor ciego y nunca ve las entradas de la prueba.
Arquitectura
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 │
└─────────────────────────────────────┘Propiedades clave:
Cifrado E2E — X25519 ECDH + AES-256-GCM. En modo
nitro, las entradas en texto plano son rechazadas.Repetidor ciego — El host de Node.js no puede leer las entradas de la prueba. Solo el enclave descifra.
Pago x402 — Flujo de un solo paso: desafío 402 → pago en USDC → generación de prueba. Sin middleware.
Atestación de hardware — El documento de atestación NSM vincula la clave pública TEE a la medición del enclave (PCRs).
Related MCP server: AgentStamp
Estructura de directorios
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.mdInicio rápido
npm (Desarrollo)
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 (Local)
docker compose up --build # Start redis + server
docker compose down # Stop
docker compose down -v # Reset dataPuerto 4002: Servidor Node.js
Puerto 6380 (host) → 6379 (contenedor): Redis
Cifrado E2E (Repetidor ciego)
Las entradas de la prueba están cifradas de extremo a extremo entre el cliente y el Nitro Enclave. El servidor Node.js pasa el blob cifrado sin leerlo.
Protocolo: X25519 ECDH + AES-256-GCM (patrón ECIES)
TEE genera un par de claves X25519 al inicio, vincula la clave pública a la atestación NSM
El cliente obtiene la clave pública TEE de la respuesta 402, verifica la atestación
El cliente genera un par de claves X25519 efímeras, calcula el secreto compartido ECDH, deriva la clave AES mediante SHA-256
El cliente cifra las entradas con AES-256-GCM, envía
{ ephemeralPublicKey, iv, ciphertext, authTag, keyId }El servidor pasa el sobre cifrado al enclave a través de vsock (repetidor ciego)
El enclave descifra, genera la prueba, devuelve la prueba + atestación NSM
Cumplimiento: En modo nitro, las entradas en texto plano son rechazadas con PLAINTEXT_REJECTED.
Flujo de pago x402
Flujo atómico de un solo paso: sin middleware, sin sesiones:
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 }Modos de pago:
Modo | Red | Efecto |
| Ninguna | Todas las solicitudes son gratuitas |
| Base Sepolia | Requiere pago en USDC (testnet) |
| Base Mainnet | Requiere pago en USDC (producción) |
Endpoints REST
Endpoint | Método | Propósito |
| GET | Verificación de estado + estado TEE + modo de pago |
| POST | Generación de prueba x402 de un solo paso |
| GET | Guía dinámica de generación de pruebas (JSON) |
| POST | Endpoint MCP StreamableHTTP |
| POST | Endpoint A2A JSON-RPC |
| GET | Tarjeta de agente OASF |
| GET | Tarjeta de agente A2A |
| GET | Descubrimiento MCP |
| GET | Swagger UI |
| GET | Especificación OpenAPI |
Herramientas MCP
Disponibles a través de /mcp (StreamableHTTP) o el paquete local @zkproofport-ai/mcp (stdio):
Herramienta | Propósito |
| Generación de prueba todo en uno (pago x402 + detección automática de cifrado E2E) |
| Verificación de prueba en cadena |
| Listar circuitos disponibles |
| Solicitar desafío 402 (flujo paso a paso) |
| Realizar pago x402 en USDC (flujo paso a paso) |
| Enviar entradas de prueba (flujo paso a paso) |
| Preparar entradas de circuito (flujo paso a paso) |
Paquetes npm
@zkproofport-ai/sdk — TypeScript SDK for proof generation (ethers v6)
@zkproofport-ai/mcp — Local MCP server for AI agents (stdio transport)Instale el servidor MCP para uso local del agente de IA:
npm install @zkproofport-ai/mcp
npx zkproofport-mcp # Starts stdio MCP serverSistema de guía
GET /api/v1/guide/:circuit devuelve una guía JSON completa para que los agentes de IA clientes preparen todas las entradas de la prueba. Incluye:
Instrucciones paso a paso con ejemplos de código
Constantes (claves de atestador, direcciones de contrato, UID de esquema EAS)
Fórmulas (cálculo de anulador, hash de señal, construcción de árbol de Merkle)
Esquema de entrada con tipos y descripciones
Plantillas de consulta GraphQL de EAS
Los circuitos usan alias: coinbase_kyc → coinbase_attestation, coinbase_country → coinbase_country_attestation, oidc_domain → oidc_domain_attestation.
Protocolo A2A
Endpoint A2A v0.3 JSON-RPC en POST /a2a:
Método | Propósito |
| Enviar tarea de prueba (bloqueante) |
| Enviar tarea de prueba (streaming SSE) |
| Consultar estado de la tarea |
| Cancelar una tarea en ejecución |
| Volver a suscribirse a eventos de tarea |
La tarjeta de agente en /.well-known/agent.json proporciona identidad en cadena ERC-8004 y descubrimiento de capacidades.
Integración TEE (AWS Nitro Enclave)
Modo | Comportamiento |
| Linux estándar, sin TEE, texto plano permitido |
| AWS Nitro Enclave, atestación de hardware, cifrado E2E forzado |
El enclave ejecuta aws/enclave-server.ts (compilado a dist/aws/enclave-server.js) que ejecuta bb prove con --oracle_hash keccak (requerido para compatibilidad con el verificador Solidity). La atestación NSM vincula el hash de la prueba y la clave pública TEE a la medición del enclave (PCR0/PCR1/PCR2).
Cadena de validación de atestación: AWS Nitro Root CA → Regional → Zonal → Instancia → Certificado hoja, verificado con firma COSE ES384.
Circuitos soportados
KYC de Coinbase (coinbase_attestation)
Prueba que el titular ha pasado la verificación KYC de Coinbase.
Alias:
coinbase_kyc,coinbase_attestationEntradas públicas: dirección, alcance
Anulador: Sí (privacidad, prevención de repetición)
País de Coinbase (coinbase_country_attestation)
Prueba que el país KYC del titular coincide con la atestación.
Alias:
coinbase_country,coinbase_country_attestationEntradas públicas: dirección, país, alcance
Anulador: Sí (privacidad, prevención de repetición)
Dominio OIDC (oidc_domain_attestation)
Prueba que el titular posee una dirección de correo electrónico en un dominio específico mediante la verificación OIDC JWT.
Alias:
oidc_domain,oidc_domain_attestationTipo de entrada: OIDC JWT (
id_tokende Google, etc.)Entradas públicas: hash de dominio, alcance
Anulador: Sí (privacidad, prevención de repetición)
Direcciones de contrato
Base Sepolia (Testnet)
Contrato | Dirección |
Verificador KYC |
|
Verificador de país |
|
Identidad ERC-8004 |
|
Reputación ERC-8004 |
|
Base Mainnet (Producción)
Contrato | Dirección |
Identidad ERC-8004 |
|
Reputación ERC-8004 |
|
Identidad de agente ERC-8004
El agente se autorregistra en cadena al inicio a través del contrato de Identidad ERC-8004. La puntuación de reputación aumenta después de cada generación exitosa de prueba.
Variables de entorno
Requeridas
Variable | Descripción |
| Cadena de conexión de Redis |
| Endpoint RPC de la cadena Base |
| RPC para verificación de prueba |
| Endpoint GraphQL de EAS para consultas de atestación |
| Clave privada de la billetera del agente (64 caracteres hex, sin 0x) |
|
|
| URL del servicio público (para la tarjeta de agente) |
Opcionales
Variable | Predeterminado | Descripción |
|
| Puerto del servidor Express |
|
| Entorno de Node |
|
| Ruta CLI de Barretenberg |
|
| Ruta CLI de Nargo |
|
| Directorio de artefactos de circuito |
| (URL raw de GitHub) | URL de descarga de artefactos de circuito |
|
|
|
| — | CID de Nitro Enclave (requerido cuando |
|
| Puerto de Nitro Enclave |
|
| Habilitar verificación de atestación |
| — | Billetera del operador (requerido cuando el pago está habilitado) |
|
| Precio por prueba (USD) |
| — | Contrato de Identidad ERC-8004 |
| — | Contrato de Reputación ERC-8004 |
| — | Clave API de Gemini para chat |
| — | Clave API de OpenAI para chat |
| — | Endpoint OTLP de Phoenix para rastreo |
|
| Cadena de versión del agente |
Despliegue (AWS Nitro Enclave)
proofport-ai se despliega en AWS EC2 con soporte para Nitro Enclave. El despliegue utiliza cambio de ranura azul-verde para tiempo de inactividad cero.
Despliegue azul-verde
aws/deploy-blue-green.shDos ranuras: azul (puertos 4002/3200) y verde (puertos 4003/3201)
Ranura activa rastreada en
/opt/proofport-ai/active-slotLa recarga de Caddy (no reinicio) cambia el tráfico
Drenaje de solicitudes en vuelo antes de cambiar (hasta 660s para generación de prueba)
Reversión automática si falla la verificación de estado del nuevo contenedor
Infraestructura
Caddy — Proxy inverso con HTTPS (Cloudflare Full SSL)
systemd — Servicios:
proofport-ai,proofport-ai-redis,proofport-ai-enclave,vsock-bridgeCloudWatch — Controlador de registros
awslogs, retención de 30 díasGitHub Actions — Flujo de trabajo
deploy-ai-aws.yml(NOdeploy.ymlque es para GCP)
Inicio / Parada
aws/boot-active-slot.sh # Start active slot containers
aws/stop-active-slot.sh # Stop active slot containersPruebas
npm test # Unit tests
npm run test:e2e # E2E against Docker stack
npm run test:watch # Watch modePruebas A2A (a2a-ui + Phoenix)
docker compose -f docker-compose.yml -f docker-compose.test.yml up --build -dServicio | URL | Propósito |
proofport-ai |
| Servidor de agente |
a2a-ui |
| UI de prueba web A2A |
Phoenix |
| Visualización de rastreo |
Bloqueos de versión
Herramienta | Versión |
bb (Barretenberg) |
|
nargo |
|
ethers |
|
@modelcontextprotocol/sdk |
|
Node.js | 20 LTS |
Licencia
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.27552 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.25 PyPIMIT
- 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.598 npm1MIT