What is Enigma?
Enigma is a non-custodial API billing platform built on Solana. It turns any HTTP endpoint into a paid product in about three minutes — with zero code changes to your upstream service.
If you've built an API and want to charge for it, Enigma handles everything: authentication, per-request metering, USDC settlement, and revenue collection. Payment lands directly in a program-derived account (PDA) that only you control — Enigma never touches your funds.
How it works
Enigma sits between callers and your real API as a smart proxy. On every request:
The caller sends a payment authorization alongside the HTTP request. Enigma validates it before forwarding anything upstream.
Enigma submits an on-chain transaction, crediting the developer's PDA vault with USDC. Sub-second finality means this completes within the request lifecycle.
The caller receives your API's response. Your revenue sits in your PDA, ready to sweep anytime. No invoicing. No waiting.
Key concepts
| concept | what it means |
|---|---|
proxy url | Your metered endpoint. Format: <your-enigma-host>/{user}/{api} — share with callers. The current devnet deployment is hosted at enigma-production-efad.up.railway.app; a stable mainnet domain is TBD. |
pda vault | A program-derived USDC token account on Solana, seeded by your wallet. Only you can sweep it. |
upstream url | Your real API. Enigma forwards requests here after payment is confirmed. Never exposed to callers. |
price / request | USDC amount a caller pays per proxied request. Set by you, stored on-chain, changeable anytime. |
collect_balance | The on-chain instruction that sweeps your PDA revenue to your wallet, minus the platform fee. |
Quick Start
Zero to a paid API in under five minutes.
Open the app and connect a Solana wallet (Phantom or Solflare) or sign in with email OTP. Your on-chain user account is initialized automatically on first registration; the wallet pays a small Solana rent deposit for the PDA vault.
In the dashboard, click + new api. Enter a name (this becomes part of your proxy URL), the upstream URL Enigma should forward to, and a per-request price in USDC. Set 0 for free-but-metered.
That's it. The dashboard shows your proxy URL: <your-host>/{username}/{api-name}. Callers pay on every request, you earn automatically. Revenue accrues in your PDA vault — claim it from the dashboard's earnings card whenever you like.
A first-party SDK (JS, Python, Rust, Go) is planned for v0.2 so you can register and manage APIs from code. The snippet below previews the planned ergonomics — none of these packages resolve yet.
You need a Solana keypair and devnet (or mainnet) USDC. See Wallet & USDC Setup for a step-by-step guide if you're new to Solana.
Enigma authenticates callers via the x402 payment protocol, not API keys. Your client signs a payment payload for each request; the proxy validates and settles it on Solana before forwarding upstream. A first call without payment returns 402 Payment Required with the price tag.
The reference implementation lives at demo/call.mjs in the repo. Drop in your buyer wallet's base58 secret and you're ready to call paid endpoints:
Register an API
Register any HTTP endpoint as a paid, metered API. No code changes to your upstream required.
Prerequisites
- ✓ A Solana wallet (Phantom or Solflare) or email OTP account
- ✓ ~0.005 SOL for transaction fees and PDA rent
- ✓ A publicly reachable HTTP endpoint (or tunneled via ngrok, cloudflare tunnel, etc.)
Via the dashboard
Connect your wallet or use email OTP. Registering your first API creates your PDA vault on-chain automatically.
Enter a name (used in your proxy URL) and your upstream base URL. The name forms a permanent part of your proxy address — choose carefully.
Enter a USDC amount. Set 0 for a free but metered API — useful for analytics or gating before a paid launch.
Your endpoint is live at <your-host>/{username}/{api-name}. All sub-paths forward verbatim: /alice/weather/v1/now → upstream.url/v1/now.
Via the SDK roadmap
Pricing & Fees
You set the price. Enigma takes a small platform fee at collection time. Everything else goes directly to your wallet.
Platform fee structure
| parameter | value | note |
|---|---|---|
platform_fee_bps | 1000 bps (10%) | Currently 1000 bps; lives in the on-chain global config and is adjustable via update_global_config. Deducted at collect time, not per-request. |
minimum_price | 0 USDC | Free APIs are supported — pure metering with no fee taken |
fee_destination | Enigma platform vault | Split happens atomically in collect_balance on-chain |
payout_latency | ~400ms | Solana finality. Collect whenever you want. |
Changing your price
Price changes are instant — the next request is billed at the new rate. There is no migration, no notice period required.
Collecting Revenue
Your earnings accumulate in a Solana PDA vault. Sweep to your wallet at any time.
From the dashboard
Open the dashboard and find the earnings card. It shows your live PDA balance; click claim to invoke collect_balance on-chain. The wallet you're signed in with signs the transaction; the platform fee (currently 10%) goes to Enigma's vault and the remainder lands in your wallet's USDC associated token account — atomically, in one transaction.
From code
The dashboard's claim button is a thin wrapper around the on-chain instruction. For headless use, build the same transaction yourself using the program ID below and submit it via any Solana RPC. The reference implementation is at ui/lib/enigma-program.ts (function buildCollectBalanceTransaction) — it derives your PDA and ATA, constructs the collect_balance instruction, and returns a signable transaction.
Planned SDK ergonomics roadmap
No minimum balance is required — collect after one request or a thousand.
Buyer Guide
Calling an Enigma-proxied API is nearly identical to calling the upstream directly — point your client at the proxy URL and let an x402 helper sign each request from your Solana wallet.
URL pattern
Everything after the API name is forwarded verbatim — query params, headers, body, and HTTP method all pass through unchanged.
With curl (no payment)
A bare curl hits the proxy but returns 402 Payment Required with a JSON price tag in the body. The buyer must satisfy x402 to receive the upstream response:
With an x402 client
Use a Solana-aware x402 client (e.g. @x402/fetch + @x402/svm) to sign payment payloads automatically. The full working example lives at demo/call.mjs.
Agent & script usage roadmap
Today, agents sign each x402 payment with a Solana keypair — no wallet pop-up, no per-call human interaction (see demo/call.mjs). A session-level spend authorization is on the roadmap so an agent can declare an upper bound up front and avoid signing each payload individually:
Wallet & USDC Setup
Enigma settles in USDC on Solana. Here's how to get set up if you're new to the ecosystem.
Option A — Self-custody (recommended)
Phantom (phantom.app) and Solflare (solflare.com) are wired into the dashboard today. Any wallet that exposes the Solana wallet-adapter standard should work; support for more wallets is on the roadmap.
Buy SOL on Coinbase, Kraken, or Binance, then swap to USDC via Jupiter (jup.ag). Alternatively, bridge USDC from Ethereum using Wormhole or Circle's CCTP.
Open the dashboard, click sign in, choose your wallet, and approve the connection. The first time you register an API, a small on-chain transaction initializes your user account (PDA + USDC ATA) — a one-time setup cost.
Option B — Email OTP
Sign in with an email address — no wallet required. Enigma creates a Solana account for you. Transfer USDC from an external wallet to fund it.
Installation roadmap
The Enigma SDK is in design — JavaScript / TypeScript, Python, Rust, and Go are planned for v0.2 on a single release cadence. None of the package commands below resolve yet. They preview the planned ergonomics.
@x402/fetch — see demo/call.mjs) for buyer-side calls.
Requires Node 18+ or Bun 1+. Full TypeScript types included.
Requires Python 3.10+. Async-first via asyncio; sync wrappers available.
Async-native with Tokio. MSRV: Rust 1.75.
Requires Go 1.22+. Context-aware; all calls accept context.Context.
Provider SDK roadmap
For API providers — registering endpoints, managing pricing, and collecting revenue. Planned shape; not yet released.
Caller SDK roadmap
For API consumers — calling paid endpoints with automatic payment handling. Planned shape; today, use an x402 client directly (see demo/call.mjs).
Configuration roadmap
All SDK clients will share a common configuration interface. Preview only — these options are part of the v0.2 SDK design.
| option | type | description |
|---|---|---|
privateKey | string | Solana private key (base58). Required for provider operations. Never expose in client-side code. |
apiKey | string | Enigma API key (enig_live_… or enig_test_…). Required for caller operations. |
network | 'devnet' | 'mainnet' | Defaults to 'devnet'. Switch to 'mainnet' at launch. |
timeout | number (ms) | Request timeout applied to each proxied call. Default: 30000. |
retries | number | Retry count on upstream 5xx errors. Payment is refunded on retry. Default: 1. |
rpcUrl | string | Custom Solana RPC endpoint. Defaults to Enigma's managed RPC. |
Authentication
Enigma has two distinct authentication models — one for callers (paying for proxy requests) and one for providers (managing their APIs).
Caller auth — x402 payment protocol
Proxied requests are gated by the x402 payment protocol, not API keys. The flow:
- 1. The first request returns
402 Payment Requiredwith a JSON price tag (network, recipient PDA, amount in USDC). - 2. Your client signs a payment payload with your Solana keypair and re-sends the request with a
PAYMENTheader. - 3. The Enigma proxy validates the payment, settles it on Solana (sub-second devnet finality), then forwards your request upstream. The settlement signature is returned in the
PAYMENT-RESPONSEheader.
In practice, you don't implement this by hand — use @x402/fetch with the SVM scheme, point it at a signer, and call the proxy URL like a normal fetch. See demo/call.mjs for a working 50-line example.
Provider auth — wallet signature or email OTP
Provider operations (registering APIs, updating prices, collecting revenue) authenticate via the dashboard:
| method | how it works |
|---|---|
| Solana wallet | Phantom or Solflare — connect, sign the transaction, your wallet pubkey is your provider identity. |
| Email OTP | Sign in with email; the backend issues a Solana account custodied during v0.1. Convert to a self-custodial wallet anytime. |
Future API-key auth roadmap
A first-party API key system (for headless dashboards, CI, scripts that prefer key-based auth over wallet signatures) is on the roadmap. The planned prefix scheme:
| prefix | environment | funds |
|---|---|---|
enig_live_ | Mainnet | Real USDC |
enig_test_ | Devnet | Test tokens — no real value |
Endpoints
Base URL: your Enigma deployment host (devnet: enigma-production-efad.up.railway.app). The routes below are the surface area today — flat, no /v1 prefix.
Proxy (x402-priced)
Discovery
Provider management
user_name and the Solana public key tied to the account.{ name, upstream, price_per_request, description?, category? }update_global_config / collect_balance instructions). There is no separate HTTP endpoint for them; the dashboard wraps the on-chain calls. Headless wrappers are part of the SDK roadmap.
Email OTP
{ email }{ email, otp }Planned roadmap
Trust Model
Enigma is built on one principle: the platform should never be able to steal from its users.
How funds flow
When a caller pays for a request, USDC moves from their account directly into a program-derived token account (PDA) seeded by the developer's public key. At no point does USDC pass through Enigma's own wallet.
| entity | can drain developer PDA? |
|---|---|
| Enigma platform | no — no admin key exists |
| Other developers | no — PDA seeded by your key only |
| API callers | no — can only pay in, never withdraw |
| You (the developer) | yes — only you can invoke collect_balance |
collect_balance directly via any Solana RPC — no Enigma infrastructure needed. The program is immutable once deployed.
Non-Custodial Design
Every dollar you earn sits in a program-derived account (PDA) derived from your wallet address. The math that generates this address ensures only you can authorize a withdrawal.
PDA seed derivation
Verify your PDA on-chain
Inspect your PDA and its USDC balance at any time using any Solana RPC or explorer:
The program ID is 9H7DLg3YkfVQgdVZxhiwdd5GtoAWrJvrQURtZKY7N5tu (devnet). Source code is publicly auditable on GitHub.
FAQ
pricePerRequest: 0 for free-but-metered access. Register a separate API name for the paid version, or use the upcoming tiered pricing feature (Q3 roadmap) for rate-limited free + paid overages on one endpoint.demo/call.mjs). A session-level spend-cap helper (client.authorize()) is on the roadmap so agents can declare an upper bound once and avoid per-call signing.collect_balance directly via any Solana RPC — no Enigma servers required. The program is immutable once deployed, and your funds are always recoverable.