npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fastxyz/x402-facilitator

v0.1.1

Published

x402 payment protocol - facilitator SDK for verifying and settling payments on-chain

Readme

x402-facilitator

Facilitator SDK for the x402 HTTP payment protocol — verify signatures and settle payments on-chain.

Install

npm install @fastxyz/x402-facilitator

Quick Start

As Express Middleware

import express from 'express';
import { createFacilitatorServer } from '@fastxyz/x402-facilitator';

const app = express();
app.use(express.json());  // Required!

app.use(createFacilitatorServer({
  evmPrivateKey: process.env.FACILITATOR_KEY as `0x${string}`,
}));

app.listen(4020, () => {
  console.log('Facilitator running on http://localhost:4020');
});

As Library

import { verify, settle } from '@fastxyz/x402-facilitator';

// Verify a payment
const verifyResult = await verify(paymentPayload, paymentRequirement);
if (!verifyResult.isValid) {
  console.error('Invalid:', verifyResult.invalidReason);
}

// Settle an EVM payment
const settleResult = await settle(paymentPayload, paymentRequirement, {
  evmPrivateKey: '0x...',
});
console.log('Settled:', settleResult.txHash);

Configuration

interface FacilitatorConfig {
  evmPrivateKey?: `0x${string}`;             // Needed for EVM settlement
  fastRpcUrl?: string;                       // Override Fast verification RPC
  committeePublicKeys?: Record<string, string[]>;
}

For Ethereum Sepolia verification, you can also override the default RPC with the ETH_SEPOLIA_RPC environment variable.


API Endpoints

POST /verify

Verify a payment signature or certificate.

Request:

{
  "paymentPayload": "base64-or-object",
  "paymentRequirements": {
    "scheme": "exact",
    "network": "base",
    "maxAmountRequired": "100000",
    "payTo": "0x..."
  }
}

Response:

{
  "isValid": true,
  "payer": "0x...",
  "network": "base"
}

POST /settle

Settle an EVM payment on-chain. Not needed for Fast payments.

Response (success):

{
  "success": true,
  "txHash": "0x...",
  "network": "base",
  "payer": "0x..."
}

GET /supported

List supported payment kinds.

Response:

{
  "paymentKinds": [
    {
      "x402Version": 1,
      "scheme": "exact",
      "network": "base",
      "extra": {
        "asset": "0x...",
        "name": "USD Coin",
        "version": "2"
      }
    },
    {
      "x402Version": 1,
      "scheme": "exact",
      "network": "fast-mainnet"
    }
  ]
}

Verification Logic

EVM Payments (EIP-3009)

  1. Recover signer from EIP-712 signature
  2. Check from matches recovered signer
  3. Check to matches paymentRequirement.payTo
  4. Check value >= maxAmountRequired
  5. Check validAfter <= now < validBefore
  6. Verify on-chain USDC balance

Fast Payments

  1. Validate certificate structure
  2. Verify sender signature
  3. Verify committee signatures
  4. Check recipient, amount, token match
  5. No settlement needed (already on-chain)

Settlement Logic

EVM Payments

  1. Re-verify payment
  2. Check nonce not already used
  3. Call transferWithAuthorization() on USDC
  4. Wait for confirmation
  5. Return transaction hash

Fast Payments

No-op — transaction already on-chain when certificate was created.


Supported Networks

Mainnet

| Network | Type | Chain ID | |---------|------|----------| | fast-mainnet | Fast | — | | arbitrum | EVM | 42161 | | base | EVM | 8453 |

Testnet

| Network | Type | Chain ID | |---------|------|----------| | fast-testnet | Fast | — | | ethereum-sepolia | EVM | 11155111 | | arbitrum-sepolia | EVM | 421614 |


Wallet Setup

The facilitator wallet needs:

  • ETH for gas on each supported EVM chain
  • No USDC needed (uses transferWithAuthorization)
# Get facilitator address
npx ts-node -e "
  import { privateKeyToAccount } from 'viem/accounts';
  console.log(privateKeyToAccount(process.env.FACILITATOR_KEY).address);
"

# Fund on Base mainnet
cast send --rpc-url https://mainnet.base.org \
  --private-key $FUNDER_KEY \
  $FACILITATOR_ADDRESS \
  --value 0.05ether

Troubleshooting

Verification Errors

| Error | Cause | Fix | |-------|-------|-----| | invalid_signature | Signature verification failed | Check client wallet | | recipient_mismatch | Wrong payTo address | Check server config | | insufficient_amount | Payment too low | Check price config | | insufficient_funds | Payer has no USDC | Client needs to fund |

Settlement Errors

| Error | Cause | Fix | |-------|-------|-----| | authorization_already_used | Nonce reused | Client must use fresh nonce | | facilitator_not_configured | Missing evmPrivateKey | Add key to config | | settlement_failed | On-chain tx failed | Check facilitator has gas |


License

MIT