API too MPC

A tool to turn API's into MPC automatically by just submitting their swagger file

API too MPC

Created At

ETHOnline 2025

Project Description

Our project, "AutoMPC Agent Network," is an automated platform that transforms standard, insecure Web2 APIs into privacy-preserving, monetizable services for the autonomous AI agent economy.

The core problem is twofold: 1) AI agents and applications cannot use sensitive data (e.g., financial, health, or personal) with third-party APIs because it requires exposing the raw data to the API provider. 2) There is no standardized, automated way for AI agents to discover, pay for, and securely consume computational services.

Our solution is an end-to-end pipeline that solves both.

Part 1: Automatic MPC Generation A developer provides their existing OpenAPI (Swagger) specification file. Our tool ingests and parses this file, automatically identifying the API's data structures and computational logic. It then auto-generates a secure Multi-Party Computation (MPC) version of that API. This new service, or "Secure Enclave API," performs the exact same function (e.g., calculating a financial risk score, checking for drug interactions) but does so cryptographically. Multiple parties can provide their encrypted inputs, and the MPC network computes the result without any single party—including the service operator—ever seeing the underlying private data. This democratizes MPC, lowering the barrier of entry from "expert cryptographer" to any developer with a Swagger file.

Part 2: x402 Agent Monetization Crucially, our platform doesn't just create the secure service; it makes it discoverable and economically viable for AI agents. Once the MPC service is deployed, it is automatically wrapped in an x402-compliant endpoint. This wrapper integrates directly with the x402 API, effectively publishing the new, secure API to a decentralized service marketplace.

AI agents can then programmatically discover this service. When an agent wants to use the service, it pays on a per-call basis, with the cost calculated based on the input and output tokens (data complexity) of the request. This leverages the x402 protocol for "agentic use," creating a pay-as-you-go economy for secure computation.

In short: We are building the bridge between the existing Web2 API economy and the emerging Web3 agent economy, using automated MPC generation for privacy and the x402 protocol for autonomous monetization.

How it's Made

This project is a full-stack application composed of a user-facing dashboard, a backend transformation engine, a dynamic infrastructure manager, and a payment integration layer.

  1. Frontend Dashboard (Next.js) The user interface is a modern Next.js 14 application written in TypeScript and styled with Tailwind CSS. This dashboard allows a developer to:

Authenticate and manage their projects.

Upload their swagger.json or openapi.yaml file.

View the status of their generated MPC services.

See analytics on API usage and revenue generated via x402.

  1. Backend: The "Swagger-to-Circuit" (S2C) Engine (Node.js) The backend, built on Node.js with Express, is the brains of the operation. When a Swagger file is uploaded:

Parsing: We use libraries like swagger-parser to validate and parse the API schema.

Code Generation (The "Hacky" Part): This is our core hack. We built a custom code generator we call the "S2C Engine." It maps simple API logic (e.s., endpoints that perform arithmetic, logical comparisons, or basic data aggregation) to a high-level MPC scripting language. Given the time constraints, we didn't build a full compiler for all possible APIs. Instead, we focused on a subset of common data-processing patterns, translating them into a format that our MPC nodes can execute.

Deployment: The engine then containerizes this new MPC circuit and its dependencies into a Docker image.

  1. Infrastructure: Dynamic MPC Nodes The generated Docker images are deployed as a distributed network of computation nodes. For the hackathon, we are simulating this on a cloud provider (e.g., using a simple container orchestration service) to spin up the required "parties" for the MPC protocol. These nodes communicate over a secure channel to execute the computations.

  2. Payment & Integration Layer (x402 API) This is where our partner technology comes in. Once an MPC service is live and has a stable endpoint, our backend makes a call to the x402 API.

Service Registration: We register this new, secure endpoint as a monetizable service within the x402 ecosystem.

Payment Wrapper: We automatically deploy a lightweight API gateway (a "x402 Wrapper") in front of the MPC service. This wrapper's sole job is to handle payments.

Agent Interaction: When an AI agent makes a request, the wrapper intercepts it, checks for a valid x402 payment, and calculates the cost based on the input/output token size. Once payment is confirmed via the x402 protocol, the wrapper proxies the request to the secure MPC nodes, which then perform the computation and return the encrypted result.

How the x402 API Benefited Our Project: The x402 API was the critical missing piece for agent-based monetization. It saved us from having to build a complex, on-chain/off-chain micropayment, invoicing, and identity system. By integrating x402, our services are immediately consumable by any AI agent that speaks the protocol. It allowed us to focus on our core competency—the MPC generation—while x402 handled the entire economic layer, turning our secure services into viable, automated businesses.

background image mobile

Join the mailing list

Get the latest news and updates