BNB Smart Chain

BNB Smart Chain

Quick Start

TheRPC is a managed JSON-RPC gateway sitting in front of geth-equivalent BNB Smart Chain nodes. You skip running and syncing your own validator and point your app at a single authenticated URL instead. Builders shipping PancakeSwap integrations or Venus lending dashboards lean on it for the chain's roughly three-second blocks and low fees, without babysitting any infrastructure. This guide walks you from zero to a verified response. Grab a key, set the endpoint, then run one of the snippets below in curl, JavaScript, or Python. A few minutes, start to finish.

Step 1: Get an API Key

Head to TheRPC.io and create a free account. Once signed in, open the Dashboard and look for the API Keys area, where you can generate a fresh key or copy an existing one. The value is an opaque token string tied to your account and plan. You drop that token straight into the request URL. Every BNB Smart Chain call routes through https://bsc.therpc.io/YOUR_API_KEY, so the key lives in the path rather than a separate config field.

Step 2: Choose Your Network

TheRPC serves many networks, each behind its own subdomain. BNB Smart Chain mainnet (chainId 56) answers at the bsc host. To configure your environment, set the endpoint variable to https://bsc.therpc.io/YOUR_API_KEY with your real key swapped in, and keep the bare token handy for any header-based clients. The testnet (chainId 97) is reachable the same way when you want to rehearse before mainnet.

Step 2: Choose Your Network

API_ENDPOINT="https://bsc.therpc.io/YOUR_API_KEY"
API_KEY="YOUR_API_KEY"

Step 3: Make Your First Call

The three snippets below all issue the same eth_blockNumber call so you can confirm BNB Smart Chain connectivity in whichever language you already use. There is a shell version with curl, a Node.js version, and a Python one. Pick the one that fits your stack and run it. For idiomatic clients in other languages, see the Tools & SDKs reference.

Using Curl

curl --request POST https://bsc.therpc.io/YOUR_API_KEY \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'

Using JavaScript

const axios = require('axios');
const config = {
url: 'https://bsc.therpc.io/YOUR_API_KEY',
apiKey: 'YOUR_API_KEY',
};
async function getBlockNumber() {
const response = await axios.post(
config.url,
{
jsonrpc: '2.0',
method: 'eth_blockNumber',
params: [],
id: 1,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${config.apiKey}`,
},
},
);
console.log('Latest Block Number:', response.data.result);
}

Using Python

import requests
config = {
'url': 'https://bsc.therpc.io/YOUR_API_KEY',
'api_key': 'YOUR_API_KEY'
}
def get_block_number():
response = requests.post(
config['url'],
headers={
'Content-Type': 'application/json',
'Authorization': f"Bearer {config['api_key']}"
},
json={
'jsonrpc': '2.0',
'method': 'eth_blockNumber',
'params': [],
'id': 1
}
)
return response.json()['result']

Step 4: Using Web3 Libraries

Once you move past a single block-number check, raw HTTP gets tedious. Web3 libraries handle ABI encoding, wei conversion, nonce sequencing, and BEP-20 contract calls for you, which matters when you interact with PancakeSwap routers or Venus markets. Wiring web3.js or web3.py to the BNB Smart Chain endpoint takes one line, as shown below. For the full set of language-specific setups, consult the Tools & SDKs documentation.

Web3.js (JavaScript)

const Web3 = require('web3');
const web3 = new Web3('https://bsc.therpc.io/YOUR_API_KEY');
// Add API key to requests
web3.setHeader('Authorization', 'Bearer YOUR_API_KEY');
async function getBalance(address) {
const balance = await web3.eth.getBalance(address);
return web3.utils.fromWei(balance, 'ether');
}

Web3.py (Python)

from web3 import Web3
from web3.middleware import http_retry_request_middleware
w3 = Web3(Web3.HTTPProvider(
'https://bsc.therpc.io/YOUR_API_KEY',
request_kwargs={
'headers': {'Authorization': 'Bearer YOUR_API_KEY'}
}
))
# Add retry middleware
w3.middleware_onion.add(http_retry_request_middleware)

Available Methods

For the complete catalog of supported BNB Smart Chain calls, open the All Methods page. Each entry there carries a plain-language description, the exact request and response shapes, runnable code examples, and the practical use cases it fits. The catalog covers everything from eth_call against a BEP-20 token to the heavier debug_ and trace_ namespaces.

Network Selection

Every chain TheRPC supports has a distinct endpoint keyed by its subdomain, so switching networks is just a matter of swapping the host. For BNB Smart Chain mainnet the URL is https://bsc.therpc.io/YOUR_API_KEY; the same key works against the chainId 97 testnet host when you need a staging target.

Next Steps

  • All Methods — browse the full BNB Smart Chain method reference to see what the gateway exposes.
  • Tools & SDKs — pick a client library for your language and wire it to the bsc endpoint.
  • Authentication — learn how the API key in the URL path secures every request.
  • Rate Limits — understand per-plan quotas before you scale traffic.
  • Basic Operations — work through the everyday reads like balances and block lookups.

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.