BNB Smart Chain
BNB Smart Chain
FAQ
Authentication & Access
- How do I get a key? Sign up at TheRPC.io, open the Dashboard, go to API Keys, and generate one for your BNB Smart Chain endpoint.
- Can I hold several keys? Yes — issue a separate key per app or environment so usage stays isolated and a single leak does not expose everything.
- A key leaked, now what? Revoke it immediately from the dashboard and generate a fresh one; the old token stops working for chainId 56 at once.
API Usage
- HTTP or WebSocket? Use HTTP for single, simple BNB Smart Chain reads; use WebSocket when you need real-time subscriptions to new heads or logs.
- Hitting rate limits? Retry with exponential backoff, and if
-32029recurs, consider upgrading your plan for more headroom. - What timeouts work well? Roughly 30 seconds for an HTTP call, a 60-second WebSocket ping/pong heartbeat, and about 30 seconds for subscription operations.
Error Handling
The table below lists the standard JSON-RPC codes the BNB Smart Chain endpoint can return: -32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, -32603 internal error, and the -32000 to -32099 server-error band. Four habits keep error handling sane. Always inspect the error field before trusting result. Retry transient failures with backoff. Log the full code and message for diagnosis. And set sensible timeouts so a stalled call cannot hang your worker.
Common Error Response
Standard JSON-RPC Error Codes
| Code | Meaning |
|---|---|
-32700 | Parse error |
-32600 | Invalid request |
-32601 | Method not found |
-32602 | Invalid params |
-32603 | Internal error |
-32000 to -32099 | Server error |
Technical Questions
- Tracking a pending tx? Poll
eth_getTransactionReceiptuntil it returns non-null, or subscribe viaeth_subscribefor a real-time push when it lands. - Keeping order? Sequence sends with an explicit nonce plus an application-level queue, reading the next nonce from
eth_getTransactionCount. - Surviving a reorg? Wait several confirmations tracked through
eth_blockNumber, listen tonewHeadsovereth_subscribe, and re-verify a block witheth_getBlockByNumberbefore treating it as final.
Transaction Tracking Example
Performance
- Optimizing usage? Batch related reads, switch real-time needs to WebSocket, cache stable BNB Smart Chain results, and tune polling intervals to the ~3-second block cadence rather than spinning tighter.
- Running high throughput? Pool connections, queue requests to smooth bursts, monitor rate-limit headers continuously, and move heavy workloads onto dedicated infrastructure.
Network Specific
- Switching networks? Just change the endpoint URL — the same API key and JSON-RPC request format carry across chains, and you can confirm the active one with
net_version. - Which chain ID is BNB Smart Chain? Mainnet is 56 (testnet is 97); your existing code needs no edits beyond the host, and
eth_chainIdreturns0x38to verify you are on chainId 56.
Development & Integration
- Which libraries? For JavaScript reach for web3.js or ethers.js, for Python use web3.py, for Java use web3j; other languages are covered in the Tools & SDKs reference.
- How should I test? Start against the chainId 97 testnet with a test key, wire in error handling early, sanity-check connectivity with
eth_blockNumber, and watch performance before promoting to mainnet.