# B402 Ledger > B402 Ledger is a high-throughput, post-quantum cryptographic micropayment ledger and decentralized marketplace for autonomous AI agents, machine commerce, and API monetization. Built upon HTTP 402 Payment Required and NIST FIPS 204 ML-DSA-44 post-quantum signatures. The platform provides friction-free machine-to-machine micro-settlement without traditional card interchange fees, credit-card locks, or subscription barriers. It includes an immutable double-entry journal with per-wallet SHA-256 hash chaining, an automated Swiss GwG Art. 6 Enhanced Due Diligence (EDD) compliance engine, and an automated Model Context Protocol (MCP) tool registry. - Primary domain: https://b402ledger.com - Payment endpoint: https://pay.b402ledger.com - Protocol status: Production Ready - Cryptographic specification: NIST FIPS 204 ML-DSA-44 (Post-Quantum) - Settlement currency: EUR (sub-cent micro-settlement down to €0.0001) ## Core Capabilities - **Autonomous HTTP 402 Flow**: Clients invoke protected endpoints, receive a `402 Payment Required` challenge with payment parameters, sign and settle via the B402 Ledger, and exchange the signed ML-DSA-44 token for immediate data access in milliseconds. - **Post-Quantum Cryptography (ML-DSA-44)**: Native post-quantum digital signatures per NIST FIPS 204, guaranteeing quantum-resistant authenticity and confidentiality for autonomous agent payments. - **Double-Entry General Ledger**: Immutable, append-only accounting enforced at the database trigger level (`ledger_transactions` and `ledger_entries`) with per-wallet SHA-256 hash chaining and zero UPDATE/DELETE capability. - **Automated Swiss Compliance (GwG Art. 6)**: Automated 3-Key Risk Indicator (KRI) monitoring for velocity spikes, dormancy activation, and micro-structuring, paired with immutable AML officer audit trails. - **Universal Meta-MCP Gateway**: Single entrypoint for AI Agents at `https://mcp.b402ledger.com/sse` conforming to the MCP 2024-11-05 protocol. Exposes dynamic meta-tools (`b402_discover_tools`, `b402_get_tool_spec`, `b402_execute_tool`) with automatic HTTP 402 challenge negotiation and spendable budget caps. - **Autonomous Agent Semantic Discovery**: GIN-indexed lexical and full-text search API at `POST https://b402ledger.com/api/catalog/search` and dynamic OpenAPI 3.1.0 contract generator at `GET https://b402ledger.com/api/catalog/services/:id/openapi.json` with machine-readable pricing and parameter schemas. - **Model Context Protocol (MCP) Directory**: Native catalog of live, monetized MCP servers pluggable directly into Claude Desktop, Cursor, and LLM tool chains. - **Resilient SEPA Payouts**: Automated outbox settlement engine transferring accumulated earnings directly to validated European IBANs via SEPA Instant. ## Key Developer & User Documentation - [Public Catalog](https://b402ledger.com/#catalog-section): Explore live monetized APIs, data feeds, and AI tools with live parameter and output inspectors. - [Meta-MCP Hub SSE Endpoint](https://mcp.b402ledger.com/sse): Universal MCP connection endpoint for Claude Desktop, Cursor, and LLM agent runners. - [Agent Discovery Search API](https://b402ledger.com/api/catalog/search): Programmatic tool discovery engine with price cap and category filtering. - [MCP Directory](https://b402ledger.com/#mcp): Directory of autonomous MCP tools and servers. - [How HTTP 402 Works](https://b402ledger.com/#how-it-works): Step-by-step interactive breakdown of the machine payment handshake. - [Developer Experience for Providers](https://b402ledger.com/#developers): Zero-boilerplate `@bcdme/b402` middleware integration (`B402Guard`) for Node.js Express and Python FastAPI. - [Developer Experience for Consumers](https://b402ledger.com/#developers): Autonomous agent integration using `B402Client` for automatic 402 challenge negotiation. - [Public JWKS Key Discovery](https://pay.b402ledger.com/.well-known/jwks.json): Cryptographic public keys for verifying ML-DSA-44 proof-of-payment tokens offline. - [Swiss GwG Compliance Documentation](https://b402ledger.com/#compliance): Technical architecture satisfying Article 6 of the Swiss Federal Anti-Money Laundering Act. ## Quick Technical Integration ### 1. Protect an Endpoint (Provider / Node.js) ```javascript import express from 'express'; import { B402Guard } from '@bcdme/b402'; const app = express(); app.use(express.json()); // Protect endpoint with autonomous HTTP 402 micropayment guard app.post('/api/analyze', B402Guard({ serviceId: 'urn:b402:my-service', fee: 0.0050 // €0.0050 EUR per execution }), (req, res) => { res.json({ success: true, result: 'computation completed' }); }); app.listen(3000); ``` ### 2. Pay and Consume (Consumer / AI Agent) ```javascript import { B402Client } from '@bcdme/b402'; const client = new B402Client({ apiKey: 'b402_live_sec_...' }); // Automatically intercepts HTTP 402, settles via ML-DSA-44 token, and retries seamlessly: const response = await client.post('https://api.provider.com/api/analyze', { dataset: [12, 45, 99, 102] }); console.log(response.data); ``` ### 3. Connect AI Agent via Universal Meta-MCP (Claude Desktop / Cursor) ```json { "mcpServers": { "b402-gateway": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-sse", "https://mcp.b402ledger.com/sse" ], "env": { "B402_API_KEY": "b402_live_sec_..." } } } } ``` ## Optional - [Robots Configuration](https://b402ledger.com/robots.txt) - [XML Sitemap](https://b402ledger.com/sitemap.xml)