x402 icon indicating copy to clipboard operation
x402 copied to clipboard

feat: add BSC (BNB Smart Chain) support to x402 — native + ERC-20 verification

Open web3luka opened this issue 3 months ago • 2 comments

Add BSC (BNB Smart Chain) Support to x402

This PR introduces EVM network support for Binance Smart Chain (BSC) — including both native BNB and ERC-20 token verification (e.g., USDT / USDC).

It adds production-ready helpers under src/verify/evmVerify.ts, using the same model as other EVM integrations:

  • verifyNativeExactByTxHash() — validates on-chain native transfers (BNB)
  • verifyErc20ExactByTxHash() — validates ERC-20 token transfers
  • verifyErc20ExactByLogs() — optional log-based scan mode for batch verification
  • Fallback RPC clients with retry and timeout (withEvmClientsRetry)

Specification note

BSC currently does not support EIP-3009 (transferWithAuthorization) for its major stablecoins (USDT, USDC, etc.).
Therefore, this integration uses standard ERC-20 transfer verification, requiring users to submit and pay for gas themselves.

While this deviates from the fully gasless x402 payment model, it remains EVM-compliant and enables BSC ecosystem compatibility as an optional fallback network.

This PR introduces BSC support as an optional network extension.
While BSC currently lacks EIP-3009 support, standard ERC-20 flows remain valuable for ecosystem compatibility and can serve as a fallback model until gasless tokens (or wrapped variants) are available.

Checklist

  • [x] I have formatted and linted my code (pnpm format && pnpm lint)
  • [x] All new and existing tests pass (pnpm test)
  • [x] My commits are signed (verified via git log --show-signature)

web3luka avatar Oct 06 '25 12:10 web3luka

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

cb-heimdall avatar Oct 06 '25 12:10 cb-heimdall

@web3luka is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 06 '25 12:10 vercel[bot]