Operational

x402 Payment Facilitator

Zero-fee micropayments for AI agents and APIs using HBD on the Hive blockchain.

Network: hive:mainnet Asset: HBD Fees: $0 Finality: 3s

How it works

This facilitator verifies and settles HBD payments following the x402 standard. API servers use it to gate endpoints behind micropayments.

1

Client requests a paywalled endpoint

The API server returns HTTP 402 with payment requirements in the x-payment header.

2

Client signs an HBD transfer

The client constructs and signs a Hive transaction (without broadcasting) and retries with the x-payment header.

3

Facilitator verifies the signature

Recovers the public key from the secp256k1 signature and checks it against the sender's on-chain active key.

4

Facilitator broadcasts and settles

The signed transaction is broadcast to the Hive network. The HBD arrives in the recipient's account with zero fees.

Why Hive + HBD

$0
Transaction fees
3s
Block finality
$1
HBD peg (USD)

Every micropayment arrives in full. No gas costs eating into small payments. HBD is Hive's algorithmic stablecoin pegged to the US dollar.

API Endpoints

This facilitator exposes the following endpoints:

GET /health Health check
GET /supported-networks Returns supported networks
POST /verify Verify a signed payment
POST /settle Verify + broadcast + mark nonce spent

Integrate

Install the package:

npm install @hiveio/x402
import express from "express";
import { paywall } from "@hiveio/x402/middleware";

const app = express();

app.get("/api/premium", paywall({
  amount: "0.050 HBD",
  receivingAccount: "your-hive-account",
  facilitatorUrl: "https://x402.ecency.com",
}), (req, res) => {
  res.json({ data: "premium content" });
});
// app/api/premium/route.ts
import { withPaywall } from "@hiveio/x402/middleware/nextjs";

async function handler(req, ctx) {
  return Response.json({
    data: "premium content",
    payer: ctx.payer
  });
}

export const GET = withPaywall({
  amount: "0.050 HBD",
  receivingAccount: "your-hive-account",
  facilitatorUrl: "https://x402.ecency.com",
}, handler);
import { HiveX402Client } from "@hiveio/x402/client";

const client = new HiveX402Client({
  account: "alice",
  activeKey: "5K...",   // Hive active key (WIF)
  maxPayment: 0.1,       // max HBD per request
});

// Transparently handles 402 → sign → retry
const res = await client.fetch(
  "https://api.example.com/premium"
);
const data = await res.json();