Logo
RPC Assistant

How do I configure and use the BNB Chain testnet endpoint for development?

Summary

The BNB Chain testnet (chain ID 97) is an EVM-compatible environment for testing dApps and smart contracts before mainnet deployment. This guide covers chain settings, RPC endpoints, faucet usage, and common debugging tips to help you get started quickly with reliable testnet infrastructure.

BNB Chain Testnet Endpoint Decision Checklist

Before you start sending transactions on BNB Chain testnet, verify these key items:

CriterionWhat to checkWhy it matters
Chain IDMust be 97 (0x61)A mismatch causes transaction rejection or mainnet accidentally used
RPC endpointLow-latency, high-availability providerDropped requests waste time and break CI/CD pipelines
Faucet availabilitytBNB received within minutesWithout test tokens you cannot deploy or transact
WebSocket supportwss:// endpoint for event subscriptionsReal-time logs and transaction monitoring require WS
Rate limitsCheck provider limits for your workloadTight limits can stall automated testing
Archive dataNeeded if you query historical statesCritical for dApps that analyze past events or balances

Chain Settings and Configuration

BNB Smart Chain Testnet (also called BSC Testnet or BNB Chain Testnet) is an EVM-compatible test environment that mirrors the mainnet using the same consensus mechanism—Proof of Staked Authority (PoSA). The native token is tBNB, which has no real monetary value.

Network Parameters

RPC Endpoints

You have multiple options for connecting to the testnet. Public endpoints are available but often rate-limited. For consistent performance, consider a dedicated node or a reliable RPC provider like OnFinality.

Public RPC URLs (use with caution):

  • https://data-seed-prebsc-1-s1.bnbchain.org:8545
  • https://data-seed-prebsc-2-s1.bnbchain.org:8545

WebSocket:

  • wss://bsc-testnet-rpc.publicnode.com

For production-grade testing, use an RPC provider with guaranteed throughput. OnFinality offers dedicated endpoints with configurable rate limits and WebSocket support.

Adding to MetaMask

Many developers use MetaMask for quick interactions. Fill in the following fields:

  • Network Name: BNB Smart Chain Testnet
  • New RPC URL: Choose your preferred endpoint (e.g., from OnFinality)
  • Chain ID: 97
  • Currency Symbol: tBNB
  • Block Explorer URL: https://testnet.bscscan.com

Getting Testnet BNB (tBNB) via Faucet

You need tBNB to pay gas fees on the testnet. The official BNb Chain Faucet at https://www.bnbchain.org/en/testnet-faucet distributes 0.3 tBNB per request (with a cooldown).

Alternative Faucets

Note: Faucet availability and amounts can change. Always check the official sources first. If you need larger amounts for heavy testing, some providers offer paid top-ups.

Using RPC with Your Development Environment

Hardhat Configuration

// hardhat.config.js
module.exports = {
  networks: {
    bscTestnet: {
      url: "https://bnb-testnet.api.onfinality.io/public", // or your private endpoint
      chainId: 97,
      accounts: ["0xYOUR_PRIVATE_KEY"]
    }
  }
};

curl Request

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

Web3.js Example

const Web3 = require('web3');
const web3 = new Web3('https://bnb-testnet.api.onfinality.io/public');

web3.eth.getBlockNumber().then(console.log);

Common Pitfalls and Debugging

1. Transaction Stuck or Slow

  • Cause: Low gas price or nonce mismatch.
  • Fix: Use eth_getTransactionReceipt to check status. If pending, cancel and resend with higher gas. Use a reliable RPC endpoint that returns accurate gas estimates.

2. "Insufficient Funds"

  • Cause: Wallet ran out of tBNB.
  • Fix: Request more from a faucet. Ensure you are using the correct address.

3. Chain ID Error

  • Cause: Configuration uses mainnet chain ID (56) instead of testnet (97).
  • Fix: Double-check your network config in wallet or dApp.

4. RPC Timeout or 429 Too Many Requests

  • Cause: Public endpoint rate limits.
  • Fix: Switch to a provider with higher limits or a dedicated node. OnFinality's RPC service offers flexible plans.

5. WebSocket Disconnects

  • Cause: Unstable connection or provider limits.
  • Fix: Use a reliable WebSocket endpoint and implement reconnection logic in your dApp.

When to Use a Dedicated Testnet RPC

Public endpoints work for small-scale testing but often hit limits under load. Consider a private RPC endpoint if:

  • You run automated CI/CD tests that send many requests.
  • You need consistent low latency for latency-sensitive dApps.
  • Your testing involves frequent archive calls (e.g., querying historical balances).
  • You require WebSocket subscriptions without the risk of disconnection.

OnFinality provides dedicated testnet nodes with configurable throughput, archive data, and WebSocket support. Check our networks page to see available options.

Key Takeaways

  1. Always double-check the chain ID (97) before deploying or sending transactions to avoid mainnet mistakes.
  2. Use a reliable RPC provider to avoid rate limiting and downtime during critical testing phases.
  3. Test with multiple faucets in case one is temporarily out of tBNB.
  4. Archive and WebSocket support are essential for many dApps—ensure your provider offers them.
  5. Start with a free tier, but plan for a dedicated endpoint if your testing scales.

Frequently Asked Questions

Q: What is the BNB Chain testnet chain ID? A: 97 (0x61 in hex).

Q: How do I get free tBNB? A: Use the official BNB Chain Faucet at https://www.bnbchain.org/en/testnet-faucet or alternative faucets listed above.

Q: Can I use the same RPC endpoint for mainnet and testnet? A: No. Testnet and mainnet have different chain IDs and network parameters. Using a testnet endpoint for mainnet will not work.

Q: Is BNB Chain testnet EVM-compatible? A: Yes. It supports Ethereum-style smart contracts and tools like MetaMask, Hardhat, and Web3.js.

Q: Why is my transaction stuck? A: It may be due to nonce issues, low gas price, or network congestion. Use a reliable RPC provider and check transaction status with eth_getTransactionReceipt.

For a full list of supported testnets and dedicated endpoint options, visit our supported networks page.

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