Consensus Protocol is live: x402 Proxy and WebSocket service

Hello Everyone,

I am proud to announce Consensus servers are live for testing. Consensus is a decentralized x402 Proxy and WebSocket service. It is hosted sovereignly and made available to the internet via manual port forwarding.

You can interact with the server right now by using the following command:

curl https://consensus.canister.software/

You should see a response:

{
  "name": "Consensus x402 Server",
  "version": "2.0.0",
  "status": "running",
  "payment_networks": {
    "evm": {
      "chain": "Base Sepolia",
      "address": "0x9cd64438C8e66E7e85EB097b516541Cd50780845"
    },
    "solana": {
      "chain": "Devnet",
      "address": "J6EHzeiWxrffitfscuaZty9A9AKQVPte7G9VEoHubuGw"
    }
  },
  "facilitator": "https://facilitator.payai.network"
}

Currently using the PayAI facilitator, which does not yet support ICP native payments. There was @zensh 's PR to add ICP to the CDP facilitator but it seems it was closed. For now, hosting a custom facilitator isn’t feasible alongside everything else involved in running and growing the network — but ICP payment support remains on the roadmap.

Getting Started

Install the official TypeScript SDK and CLI:

npm install @canister-software/consensus-cli

The SDK provides two main primitives:

ProxyClient — Middleware that routes your outbound HTTP requests through Consensus node instances, with x402 payments handled automatically:

import express from "express";
import { ProxyClient } from "@canister-software/consensus-cli";

const app = express();
app.use(ProxyClient(fetchWithPayment, { cache_ttl: 300 }));

app.get("/price", async (_req, res) => {
  const response = await fetch("https://api.example.com/price"); // automatically intercepted!
  res.json(await response.json());
});

You can also explicitly control which requests get proxied by overriding the default strategy with the manual flag

import express from "express";
import { ProxyClient } from "@canister-software/consensus-cli";

const app = express();
app.use(ProxyClient(fetchWithPayment, { strategy: "manual" }));

app.get("/price", async (req, res) => {
  // Use req.consensus.fetch() to explicitly proxy this request
  const response = await req.consensus.fetch("https://api.example.com/price");
  res.json(await response.json());
});

app.get("/public", async (_req, res) => {
  // Use regular fetch — bypasses Consensus entirely
  const response = await fetch("https://api.example.com/public");
  res.json(await response.json());
});

In manual mode, Consensus does not intercept global fetch(). You decide per-request what gets proxied by calling req.consensus.fetch() directly, giving you fine-grained control over costs.

SocketClient — A managed WebSocket client for opening paid sessions with automatic reconnection:

import { SocketClient } from "@canister-software/consensus-cli";

const client = SocketClient(fetchWithPayment);
const auth = await client.requestToken({ model: "time", minutes: 5 });
const session = await client.connect(auth);

session.on("message", (msg) => console.log(msg));
session.send("hello");

Core Features

The preliminary documentation is available at https://docs.consensus.canister.software to provide more in depth details of what i will explain below.

1. Deduplicating Proxy with Customizable Cache

Consensus can identify identical requests via canonicalization and ensure the request is executed only once. You can tell Consensus how long to remember a response by using the cache_ttl parameter, this can be as short as 1 second. Once the response is cache, payment is not required for cache hits.

2. WebSocket-on-Demand (Most Innovative Feature)

Consensus can dynamically price HTTP → WebSocket upgrades. This means you can pay for exactly what you need—whether that’s time, data, or both.

Example

Let’s say we want to open a WebSocket to stream some data for a short time. we don’t know exactly how much data, but we know it’s less than 100 MB.

Three pricing models are available:

  • hybrid: Specify both time and data (e.g., 60 minutes, 600 MB)
  • time: Specify time only and use default data limits
  • data: Specify an amount of data and use a default time limit

Example request:

https://consensus.canister.software/ws?model=time&minutes=5&megabytes=0
  1. Consensus responds with an x402 price for the session. In this case, the price is $0.0025 (time-based @ ~$0.0005 per minute).

  2. After payment, Consensus responds with:

    • A single-use token valid for 60 seconds
    • A connection URL: https://consensus.canister.software/ws-connect?token=xyz...
  3. The token is validated, and the connection is upgraded from HTTPS to WSS.

  4. The session is bound to the limits specified in the token. Once the time is up or if the user exceeds the default data limit, the socket connection is terminated.

Demo: https://x.com/demali_icp/status/2018910877219422297?s=20

3. Decentralized Network

Consensus is decentralized — anyone can join the network by running a node instance.

How to join:

  • Pay a joining fee (fee doubles with each new node until it plateaus at ~16 active instances)
  • Pass benchmark tests for fetch latency and WebSocket latency
  • Pass a CPU benchmark for hashes per second — node-to-server communication is encrypted via mTLS, so sufficient compute is required
  • Obtain TLS certificates via Certbot with a custom domain identifying your instance
  • Register your IP address with the network — a stable IP is required to be eligible for direct routing (this typically requires a business ISP package). Nodes with dynamic IPs can still join and earn revenue but cannot be designated instances, meaning users cannot explicitly route requests through them via nodexyz.consensus.canister.software

Revenue sharing:

Revenue is distributed directly to node instances based on contribution — proportional to the compute served by each instance.

Tokenomics is still being finalized. There are currently no active node instances and the onboarding process is underway.

If you would like to contribute,you can :

  • Testing the live server
  • Joining the network as a node instance operator.
  • Improving benchmarking and security practices
  • Providing feedback and ideas.
  • Contributioning via github.

If you are an individual with compute resources and access to stable IPs and would like to participate in the network you can send me a message directly!

Links:

Looking forward to your feedback! I welcome any questions i will do my best to answer them below.

2 Likes