BNB Smart Chain

BNB Smart Chain

Basic Operations

This page collects the BNB Smart Chain calls developers reach for on day one: the latest block height, a BNB or BEP-20 balance, a transaction and its receipt, full blocks, a contract view function, and the gas price and nonce you need before sending. Each one is shown as a ready-to-run JSON-RPC payload you can POST to https://bsc.therpc.io/YOUR_API_KEY.

Retrieving Basic Information

Two reads anchor almost every BNB Smart Chain integration. eth_blockNumber returns the latest block height, a quick way to confirm the node is synced and live. eth_getBalance returns an account's holdings, but the value comes back in wei as a hex string; divide it by 10^18 to express it as BNB before showing it to a user.

Get Latest Block Number

{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}

Check Account Balance

{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"latest"
],
"id": 1
}

Transaction Operations

Two calls cover transaction lookups on BNB Smart Chain. eth_getTransactionByHash fetches a transaction by its hash and tells you whether it is still pending or already mined. eth_getTransactionReceipt returns the full receipt once it has been included. The receipt carries the block it landed in, the gas used, the success status, and any emitted logs such as BEP-20 Transfer events.

Get Transaction Status

{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": [
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
],
"id": 1
}

Check Transaction Receipt

{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
],
"id": 1
}

Block Information

You can fetch a BNB Smart Chain block two ways. eth_getBlockByNumber takes a hex height (or a tag like latest), while eth_getBlockByHash takes the block's hash. Both accept a boolean second argument. Pass true to receive every transaction as a full object, or false to get back only the transaction hashes and keep the response light.

Get Block by Number

{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"0xE81224",
false
],
"id": 1
}

Get Block by Hash

{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
false
],
"id": 1
}

Smart Contract Interactions

Two methods read contracts without spending gas. eth_call executes a view function locally against the current state (for example calling balanceOf on a BEP-20 token or quoting a price from a PancakeSwap pair) and returns the ABI-encoded result. eth_getCode returns the deployed bytecode at an address, which lets you confirm a contract exists there rather than a plain wallet.

Call Contract Method

{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"data": "0x70a08231000000000000000000000000742d35Cc6634C0532925a3b844Bc454e4438f44e"
},
"latest"
],
"id": 1
}

Get Contract Code

{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"latest"
],
"id": 1
}

Network Status

Two calls report on the network itself. net_version returns the chain ID as a string, 56 for BNB Smart Chain mainnet, which is handy for asserting your client is pointed at the right network. eth_syncing reports whether the backing node is still catching up, returning false when it is fully synced or a progress object while it is not.

Get Network Version

{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}

Check Node Sync Status

{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}

Gas and Nonce

Before broadcasting a BNB Smart Chain transaction you need two values. eth_gasPrice returns the current price in wei, which on BNB Smart Chain stays low thanks to the chain's economics. eth_getTransactionCount returns an address's nonce, the count of transactions it has already sent. That nonce is what orders outgoing transactions, so each new send must use the next value to avoid being rejected or stuck.

Get Gas Price

{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}

Get Transaction Count (Nonce)

{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"latest"
],
"id": 1
}

Implementation Examples

  • JavaScript / TypeScript: run these operations with web3.js or ethers.js.
  • Python: call the same BNB Smart Chain methods through web3.py.
  • Java / Kotlin: use web3j for JVM-based integrations.
  • All SDKs: find every supported client in the Tools & SDKs reference.

Ready to call this in production?

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