Logo
New RPC users get 35% off their first monthView the offer
RPC Assistant

BNB Chain Testnet RPC Endpoint: Chain Settings, Faucet, and Debugging

Summary

This page explains how to connect to the BNB Chain Testnet (BSC Testnet) using an RPC endpoint. You'll find the official OnFinality public endpoint, chain settings, faucet instructions, and common debugging tips for building and testing dApps on testnet.

Quick Start: Connect to BNB Chain Testnet

If you're building on BNB Chain (formerly BSC) and need a testnet environment, the BNB Chain Testnet (chain ID 97) is the place to start. This guide gives you the exact RPC endpoint, chain settings, and debugging tips to get your dApp running quickly.

OnFinality public endpoint: https://bnb-testnet.api.onfinality.io/public

This endpoint is free to use for development and light testing. For production workloads or higher rate limits, consider a dedicated node or a managed RPC plan.

Chain Settings at a Glance

Before you connect, make sure your wallet or dApp uses the correct network parameters. Here's a quick reference table:

ParameterValue
Network NameBNB Smart Chain Testnet
Chain ID97
Native CurrencytBNB (BNB Chain Native Token)
SymboltBNB
Decimals18
Block Explorerhttps://testnet.bscscan.com
RPC Endpointhttps://bnb-testnet.api.onfinality.io/public

Adding BNB Testnet to Your Wallet

Most developers add the testnet to MetaMask or another wallet to interact with their dApp. Here's a common configuration snippet you can use:

{
  "chainId": "0x61",
  "chainName": "BNB Smart Chain Testnet",
  "nativeCurrency": {
    "name": "BNB Chain Native Token",
    "symbol": "tBNB",
    "decimals": 18
  },
  "rpcUrls": ["https://bnb-testnet.api.onfinality.io/public"],
  "blockExplorerUrls": ["https://testnet.bscscan.com"]
}

You can add this via MetaMask's "Add Network" flow or programmatically using wallet_addEthereumChain.

Getting Testnet BNB from the Faucet

To pay for gas on the testnet, you need tBNB. The official BNB Chain faucet is the primary source. Visit the BNB Chain faucet and connect your wallet. You'll receive a small amount of tBNB, usually enough for a few transactions. If you need more, you can request again after a cooldown period.

Making Your First JSON-RPC Call

Once you have the endpoint, you can test connectivity with a simple eth_chainId call. Here's a curl example:

curl -X POST https://bnb-testnet.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'

Expected response:

{"jsonrpc":"2.0","id":1,"result":"0x61"}

The 0x61 is the hexadecimal representation of chain ID 97.

Using ethers.js or viem

If you're using a JavaScript library, here's how to connect with ethers.js:

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("https://bnb-testnet.api.onfinality.io/public");

async function getBlockNumber() {
  const blockNumber = await provider.getBlockNumber();
  console.log("Current block:", blockNumber);
}

getBlockNumber();

And with viem:

import { createPublicClient, http } from 'viem';
import { bscTestnet } from 'viem/chains';

const client = createPublicClient({
  chain: bscTestnet,
  transport: http('https://bnb-testnet.api.onfinality.io/public')
});

const blockNumber = await client.getBlockNumber();
console.log("Current block:", blockNumber);

Debugging Common Issues

Even with the right endpoint, you might run into issues. Here's a quick troubleshooting table:

SymptomLikely CauseFix
eth_chainId returns wrong valueWrong network selectedCheck chain ID is 97
Transaction stuck or droppedInsufficient tBNB for gasGet more from the faucet
nonce too low errorTransaction replay or stale nonceReset account activity in wallet
Connection timeoutsPublic endpoint rate limitUse a dedicated node or API key
Contract call revertsContract not deployed on testnetVerify contract address on explorer

Public vs. Dedicated RPC for Testnet

For simple testing, the public endpoint is sufficient. But if you're running automated tests, load testing, or a CI/CD pipeline, you might hit rate limits. In that case, consider a dedicated node or a managed RPC plan that offers higher throughput and more reliability.

OnFinality provides both shared and dedicated infrastructure for BNB Chain Testnet. You can check the network page for details and to get an API key.

Key Takeaways

  • The BNB Chain Testnet RPC endpoint is https://bnb-testnet.api.onfinality.io/public.
  • Chain ID is 97, and the native currency is tBNB.
  • Use the official faucet to get testnet BNB.
  • Test your connection with eth_chainId before building.
  • For production-grade testing, consider a dedicated node or managed RPC service.

Frequently Asked Questions

What is the BNB Chain Testnet RPC URL?

The public RPC URL is https://bnb-testnet.api.onfinality.io/public. You can also get a dedicated endpoint from OnFinality.

How do I get testnet BNB?

Use the official BNB Chain faucet at https://www.bnbchain.org/en/testnet-faucet.

What is the chain ID for BNB Testnet?

The chain ID is 97.

Can I use the same RPC for mainnet?

No, mainnet uses a different endpoint and chain ID (56). See the BNB Chain mainnet page for details.

Is the public endpoint rate-limited?

Public endpoints may have rate limits. For higher limits, consider a dedicated node or RPC pricing.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started