What Blocky402 Does
Blocky402 is the x402 facilitator for Hedera. It sits between the seller’s@x402/express middleware and the Hedera network and handles two responsibilities:
- Verify — before the seller runs your request, Blocky402 receives the partially signed
TransferTransaction, checks the buyer’s signature, confirms the transfer amounts match thePAYMENT-REQUIREDterms, and reports the payer account to the seller. No funds move at this stage. - Settle — after the seller’s handler returns a successful response, Blocky402 co-signs the same transaction as the Hedera fee payer and submits it to Hedera. It returns the confirmed transaction ID, which the seller embeds in the
PAYMENT-RESPONSEheader.
The buyer never interacts with Blocky402 directly. Your
@x402/fetch client talks only to the seller. The seller’s middleware handles all calls to Blocky402 on your behalf.Why a Facilitator
Hedera requires everyTransferTransaction to carry the signature of the account paying the consensus fee. Without a facilitator, every buyer would need to pre-fund an HBAR balance separately from their service payment budget, then sign twice — once for the transfer and once for the fee. Blocky402 consolidates this:
- The buyer signs only the value transfer (buyer → seller).
- Blocky402 holds an HBAR account and co-signs as the fee payer.
- The facilitator covers the Hedera network fee on the buyer’s behalf.
Endpoints
The seller middleware calls these two endpoints automatically. You configure Blocky402 by pointingFACILITATOR_URL to the correct host — the rest is handled by @x402/express.
POST /verify
POST /verify
Receives the partially signed
TransferTransaction encoded in the PAYMENT-SIGNATURE header. Blocky402 decodes the transaction bytes, verifies the buyer’s ECDSA signature over the transaction body, confirms the transfer amounts and asset match the PAYMENT-REQUIRED terms, checks the buyer account balance on the Hedera network, and returns the verified payer account ID.If verification fails for any reason — wrong signature, insufficient balance, mismatched amounts — Blocky402 returns an error and the seller does not run the handler. The buyer is not charged.POST /settle
POST /settle
Called only after the seller handler returns a successful (
2xx) response. Blocky402 retrieves the previously verified transaction, adds its fee-payer signature, and submits the fully signed transaction to Hedera consensus. It returns a SettleResponse containing:success: truetransaction— the Hedera transaction ID (e.g.,0.0.12345@1700000000.000000001)amount— the settled amount in atomic unitspayer— the buyer’s Hedera account ID
Testnet vs. Mainnet
Choose the environment that matches yourHEDERA_NETWORK setting. Set FACILITATOR_URL in your .env file to the corresponding URL.
.env — testnet configuration (default)
.env — mainnet configuration
How Settlement Appears On-Chain
After Blocky402 settles a transaction, the buyer agent queries the Hedera mirror node to confirm the transfer. A successful settlement produces a HashScan link of the form:- The sender (buyer account) debited exactly
amountatomic units - The receiver (seller’s
payToaccount) credited the same amount - The Blocky402 fee-payer account paid the Hedera consensus fee
- The consensus timestamp and transaction ID match the receipt on the HCS receipts topic
To get a mainnet API key or learn more about the Blocky402 service, visit blocky402.com. The testnet facilitator at
https://api.testnet.blocky402.com is open for use without registration.