BETA — mainnet live (chain 482120); features are still being finished. Transparency →
Bitcoin Swap BETA Chain 482120
Developers · Reference

Limits & errors

Rate limits, HTTP codes, JSON-RPC errors and contract revert codes.

Reference › Limits & errors

Rate limits

Counted per IP using a leaky-bucket algorithm: an average rate plus an allowed instant burst.

EndpointRateBurstWhen exceeded
rpc.btcw.tech (HTTPS)10/second40HTTP 429
rpc.btcw.tech/ws (opening a connection)shares the 10/second above20HTTP 503
btcw.tech/api/v2/*20/second40HTTP 429
btcw.tech/api/*shares the 20/second above20HTTP 503
explorer.btcw.tech/api/*shares the 20/second above100HTTP 429
Pages and static filesunlimited——

HTTPS RPC and WebSocket share one quota; the three APIs on btcw.tech and the explorer share another. A JSON-RPC batch counts as one request.

On 429/503: wait and retry with exponential backoff (e.g. 0.5 s → 1 s → 2 s). Batch many eth_calls together instead of sending them one by one.

API HTTP status codes

CodeWhen
200success
400invalid parameters (/api/v2/swap/quote): missing parameter, amount not an integer, unknown asset… — body contains { "error": "…" }
404path not found — /api/* and /api/v2/* list the available paths in the routes field
405RPC received a GET — use POST only
422quote: no route can fill the order (exceeds liquidity, pool paused, stale price…) — see routes[].error
429 / 503rate limit exceeded (table above). /api/v2/* also returns 503 while the indexer is starting
502the API could not read from RPC — retry later

JSON-RPC errors

CodeMeaning
-32604Method not enabled — namespace not exposed (debug_, trace_, admin_…)
-32601Method not found
3Execution reverted — eth_call / gas estimation reverted; the error code is in error.data (e.g. "0x1f2a2005"), decode it with the table below
-32004Upfront cost exceeds account balance — the wallet doesn't have enough BTCw for value + gas
-32602Invalid call params — malformed parameters

Contract revert codes

The first 4 bytes of error.data. The SDK's decodeError() translates these codes into readable reasons.

SelectorErrorWhere · what to do
0x71c4efedSlippageExceeded(uint256,uint256)ClpPools, OracleAMM — price moved past minOut; request a new quote
0xab35696fContractPaused()ClpPools, OracleAMM — the venue is paused
0xf82ae9a5PoolDisabled(address)ClpPools — this pool is disabled
0xb5e2025eUnknownPool(address)ClpPools — token has no pool
0x305da342ExceedsMaxTrade(uint256,uint256)OracleAMM — over 10 BTCw per trade; split the order or use ClpPools
0xa17e11d5InsufficientLiquidity(uint256,uint256)OracleAMM — not enough liquidity for this order size
0x6fb3b185StalePrice(uint256)OracleAMM — oracle price older than 300 seconds; wait for the next price update
0x1f8f95a0InvalidOraclePrice()OracleAMM — oracle returned an invalid price
0x1f2a2005ZeroAmount()amount too small, result rounds to 0
0x201b580aSameToken()ClpPools — input and output are the same token
0xd92e233dZeroAddress()recipient is the zero address
0xf4b3b1bcNativeTransferFailed()recipient cannot receive BTCw (contract without a receive function)
0xe450d38cERC20InsufficientBalancetoken — insufficient balance
0xfb8f41b2ERC20InsufficientAllowancetoken — not enough approved for the swap contract
0xf80dbaeaExpired(uint256)SwapRouter — past deadline; request a new quote
0x20db8267InvalidPath()SwapRouter — path is empty or longer than 4 hops
0x8e612d4bUnknownVenue(uint8)SwapRouter — venue does not exist (0 ClpPools, 1 OracleAMM, 2 + token vault index)
0x2cd1bb3dUnsupportedHop(uint8,address,address)SwapRouter — that venue does not have this pair
0x626ade30ValueMismatch(uint256,uint256)SwapRouter — msg.value differs from amountIn when paying in BTCw
0x9c8d2cd2InvalidRecipient()SwapRouter — invalid recipient
0xf2fb3812UnexpectedSender()SwapRouter — BTCw sent directly to the router (not via swap)
0x9e87fac8Paused()bridge router — paused
0xfa5cd00fNotAllowed(address)bridge router — allowlist enabled and the wallet is not on it
0x7c98bbbcBadGranularity(uint256,uint256)482120 router — amount not divisible by 1012
0xf97da669PriceJumpTooLarge(int256,int256)BtcwPriceFeed — price update changed by more than 10% (only if you are the updater)
0x9a280f39NotUpdater()BtcwPriceFeed, PriceHub — caller is not an authorized price updater