Introduction to Blocky402
Understanding the x402 protocol and Blocky402’s role as an open facilitator
What is x402?
The x402 protocol is an open standard for HTTP-native payments using stablecoins. It extends the HTTP 402 status code (Payment Required) to enable pay-per-request APIs without intermediaries.
Key Protocol Features
- Protocol-native: Built on standard HTTP status codes
- Stablecoin payments: USDC, USDT support across chains
- Trust-minimized: On-chain verification, no custody
- Cross-chain: Works across multiple blockchain networks
- No intermediaries: Direct peer-to-peer payments
What is Blocky402?
Blocky402 is an open-source facilitator for the x402 protocol. It provides the infrastructure to verify and settle x402 payments across multiple blockchain networks.
Facilitator Role
A facilitator in the x402 ecosystem:
- Verifies payment signatures and validity
- Settles payments on-chain by broadcasting transactions
- Supports multiple networks and payment schemes
- Operates independently from other facilitators
Why Use Blocky402?
- Open Source: MIT licensed, fully auditable code
- Self-Hostable: Run your own instance for maximum control
- Multi-Chain: Supports 5+ blockchain networks
- Testnet Ready: Fully operational testnet for development
- Protocol Compliant: Implements the x402 standard correctly
- Independent: Not tied to any single provider
How It Works
Three parties take part: a client (a wallet or agent), a resource server (the API that charges), and the facilitator (Blocky402). The client only talks to the resource server. The resource server talks to Blocky402.
1. Resource Server Returns 402
When a client requests a paid resource without paying, the resource server
returns HTTP 402. The payment requirements travel in the PAYMENT-REQUIRED
header as base64-encoded JSON:
HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: <base64>
Decoded, the header holds the accepts list, for example one exact option on
hedera:testnet.
2. Client Creates Payment
The client uses an x402 client SDK (@x402/hedera, @x402/evm, or
@x402/svm) to sign a v2 PaymentPayload. The example below uses Hedera —
the HTTP envelope is identical for every family; only the signer and the
inner payload shape change. @x402/fetch does this for you, then retries the
request with the signed payment in a PAYMENT-SIGNATURE header.
import { ExactHederaScheme } from '@x402/hedera/exact/client';
import { createClientHederaSigner, PrivateKey } from '@x402/hedera';
const signer = createClientHederaSigner(
'0.0.7326075', // payer account id
PrivateKey.fromStringECDSA(walletPrivateKey),
{ network: 'hedera:testnet' },
);
const scheme = new ExactHederaScheme(signer);
const signed = await scheme.createPaymentPayload(2, requirements);
const paymentPayload = {
x402Version: 2,
accepted: requirements, // v2 carries scheme and network here
payload: signed.payload, // { transaction: 'base64-encoded-TransferTransaction' }
};
3. Resource Server Verifies with Blocky402
The resource server (usually through @x402/express paymentMiddleware) sends
the payment to Blocky402 as a JSON body:
const response = await fetch('https://api.testnet.blocky402.com/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
x402Version: 2,
paymentPayload,
paymentRequirements: requirements,
}),
});
4. Resource Server Settles on the Blockchain
If valid, the resource server asks Blocky402 to settle the payment on-chain:
const response = await fetch('https://api.testnet.blocky402.com/settle', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
x402Version: 2,
paymentPayload,
paymentRequirements: requirements,
}),
});
// Returns { success, transaction, network, payer, ... }
5. Access Granted
The resource server returns the resource. The settlement result travels back to
the client in a base64 PAYMENT-RESPONSE header. A client can decode it with
x402HTTPClient.getPaymentSettleResponse.
Still using the older header or paymentHeader inputs? They are deprecated. See
the migration guide.
Supported Networks
Testnet (Available Now):
- Polygon Amoy
- Solana Devnet
- Hedera Testnet
These are the networks the hosted testnet facilitator advertises at
GET /supported. Additional
networks (Base, Arbitrum, Optimism, Avalanche, Ethereum) are implemented and can
be enabled when self-hosting.
Mainnet (Coming Soon):
- Base Mainnet
- Polygon Mainnet
- Solana Mainnet
- Arbitrum Mainnet
- Optimism Mainnet
- Avalanche Mainnet
- Hedera Mainnet
See Networks & Assets for complete network information.
Architecture
Blocky402 runs a single x402 facilitator that registers one exact scheme per
network family using the official x402 SDK packages:
- EVM networks via
@x402/evm - SVM (Solana) networks via
@x402/svm - Hedera networks via
@x402/hedera
The system automatically routes each request to the right scheme based on the network.
Getting Started
Ready to start? Check out the Quickstart Guide to make your first payment.
For detailed API documentation, see the API Reference.