How to Retrieve the Balance of a BEP-20 Token on the Binance Smart Chain BSC Network?

If you’re building anything on BSC — a wallet, a dApp, or a portfolio tracker — you’ll need to know how to check token balances. This guide shows you two practical approaches: using Web3.js and raw JSON-RPC calls.

What is BEP-20, and why does it matter?

BEP-20 is BSC’s equivalent of Ethereum’s ERC-20 standard. It defines the rules every token on BSC must follow — things like how balances are tracked, how transfers work, and how approvals are handled. 

Because BSC is EVM-compatible, the two standards are nearly identical under the hood, which means most Ethereum tooling — Web3.js, Ethers.js, JSON-RPC methods — works on BSC with minimal changes.

So if you already know the Ethereum ecosystem, you won’t have to learn everything from scratch to work with BSC tokens.

Step 1: Find the token’s contract address

Every BEP-20 token lives at a specific contract address on the BSC network. This address is what you’ll use to identify the token in all your calls.

The easiest place to look it up is BSCScan. It’s a search for the token by name and the contract address will be right there on the token’s page. The project’s official documentation usually lists it too.

Step 2: Connect to a BSC RPC node

To read anything from the blockchain, you need an entry point — an RPC node. Think of it as the gateway between your code and the BSC network. 

You can run your own node, but for most projects it’s much easier to use a provider like NOWNodes.

Here’s how to get set up with NOWNodes:

  • Sign up at nownodes.io.
  • Pick your plan — you can begin with our START plan that gives access to shared crypto nodes with 100,000 requests for one month.
  • Generate an API key from your account dashboard. Treat this like a password — never put it in client-side code or commit it to a public repo.
  • Your BSC RPC endpoint will be: https://bsc.nownodes.io/your_api_key. You can also pass the key in the request header if you prefer to keep the URL clean.

You can test the connection quickly by opening Postman and sending a GET request to your endpoint. If it responds, you’re good to go.

Method 1: Using Web3.js in Node.js

This is the go-to setup for most backend work. Web3.js takes care of the tedious stuff — encoding, decoding, talking to contracts — so you’re not buried in low-level details before you even get to the actual problem you’re trying to solve.

Prerequisites

  • Node.js and npm installed
  • Web3.js installed: npm i [email protected]
  • The ABI for the BEP-20 token. You can grab this from BSCScan — search your token, go to the Contract tab, and click the ABI button to copy it.

The script

Here’s a minimal Node.js script that connects to BSC and retrieves a balance:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('https://bsc.nownodes.io/"API-KEY"));
const tokenContractAddress = 'TOKEN_CONTRACT_ADDRESS';
const ownerAddress = 'YOUR_OWNER_ADDRESS';
const tokenABI = ['YOUR_TOKEN_ABI'];
const tokenContract = new web3.eth.Contract(tokenABI, tokenContractAddress);
tokenContract.methods.balanceOf(ownerAddress).call((err, balance) => { if (err) { console.error('Error:', err); return; } 
const readableBalance = web3.utils.fromWei(balance, 'ether'); console.log(`Balance of address ${ownerAddress}:`, readableBalance); });

Replace TOKEN_CONTRACT_ADDRESS with the token’s contract address, and WALLET_ADDRESS_TO_CHECK with the address you want to look up.

Run the script:

node script_name.js

Method 2: Direct JSON-RPC calls

Because BSC is EVM-compatible, you can use the same eth_call method you’d use on Ethereum. This is useful when you want to avoid pulling in a library dependency, or when you’re working in an environment where Web3.js isn’t practical.

The key thing to understand is how to encode your request. The data field in the call needs to start with the 4-byte function selector for balanceOf, which is 0x70a08231, followed by the wallet address padded out to 32 bytes.

So if your wallet address is 0x123…abc, the full data parameter looks like this:

0x70a08231000000000000000000000000123...abc

Put it all together in a curl request:

curl --request POST \
  --url https://bsc.nownodes.io/<your api-key>\
  --header 'Content-Type: application/json' \
  --header 'api-key: <your api-key>' \
  --data '{
	"jsonrpc": "2.0",
	"method": "eth_call",
	"params": [
		{
			"to": <TOKEN_CONTRACT_ADDRESS>,
			"data": <balaceOf function’s + address’ hash>
		},
		"latest"
	],
	"id": 1
}'

The response comes back with the balance in hex. You’ll need to convert it to decimal, then factor in the token’s decimals (usually 18) to get a human-readable number.

A note on security

Reading a balance is a read-only operation — you don’t need your private key for it. That said, while working with blockchain tools it’s important to follow security best practices: never hardcode your private key, use environment variables or a secrets manager instead, and never expose your API keys on the client side.

If you’re working with real funds, a hardware wallet is worth the investment. For development and testing, always use testnet addresses.

Verifying your results

After fetching the balance programmatically, it’s always smart to double-check it on BSCScan. Simply search for the wallet address, locate the token, and compare the values. Any mismatch is almost always caused by decimal conversion — remember to divide by 10^18 (or the token’s actual decimals).

Wrapping up

To check a token balance, find the contract address, connect to an RPC node, and call the balanceOf function — either using Web3.js or a raw JSON-RPC call. Both approaches work well; the right choice depends on your project setup.

If you hit any issues while working with the BSC RPC node, the NOWNodes team is active on Telegram and Discord and can help you out. There’s a lot more you can do once you have a reliable node connection — transaction history, event logs, contract state — but balance retrieval is a solid place to start.

Contact our team and we’ll help you get started, configure your endpoint, and offer ongoing support.

Submit a request through email. Our team will get back to you promptly. You can test our shared nodes NOW: just sign in and get your API Key!