Logo
RPC Assistant

BNB Testnet Endpoint: Chain Settings, Faucet, and Debugging

摘要

BNB Testnet is a test environment for BNB Smart Chain (BSC) that mirrors mainnet features. This article covers chain settings, how to get tBNB tokens from the faucet, common debugging steps, and how to connect via an RPC endpoint. Whether you're deploying a smart contract or integrating a dApp, this guide helps you get started with BNB Testnet.

BNB Testnet Decision Checklist

Before diving in, evaluate whether BNB Testnet fits your project stage:

CriterionWhat to checkWhy it matters
Test environment parityDoes BNB Testnet mirror mainnet behavior?BNB Testnet uses the same consensus (PoSA) and gas mechanics as mainnet, making it ideal for realistic testing.
Faucet availabilityCan you get tBNB tokens easily?The official BNB Chain faucet and third-party faucets provide daily tokens for contract deployment and transactions.
RPC reliabilityIs the public RPC endpoint stable for your load?Public endpoints have rate limits; for sustained testing, consider a dedicated RPC provider like OnFinality.
Wallet compatibilityDoes your wallet support Chain ID 97?MetaMask and most EVM wallets require manual network addition using the correct chain settings.
Block explorer supportCan you verify transactions and contracts?BscScan testnet provides full explorer functionality for debugging.

What Is BNB Testnet?

BNB Testnet is the official test environment for BNB Smart Chain (BSC), an EVM-compatible blockchain known for high throughput and low fees. It uses a Proof of Staked Authority (PoSA) consensus, just like mainnet. The native currency is tBNB (test BNB), which has no real-world value. Developers use BNB Testnet to deploy smart contracts, test dApps, and validate infrastructure before going live on mainnet.

BNB Testnet Chain Settings

To connect to BNB Testnet, you need the following parameters:

  • Network Name: BNB Chain Testnet (or BSC Testnet)
  • Chain ID: 97
  • RPC URL: https://data-seed-prebsc-1-s1.bnbchain.org:8545 (public) or use a provider endpoint
  • WebSocket URL: wss://data-seed-prebsc-1-s1.bnbchain.org:8546 (public)
  • Currency Symbol: tBNB
  • Block Explorer: https://testnet.bscscan.com

Adding BNB Testnet to MetaMask

If you use MetaMask, add the network manually:

  1. Open MetaMask > Settings > Networks > Add Network.
  2. Fill in the fields using the values above.
  3. Click Save. You should see tBNB balance after funding.

Getting tBNB from the Faucet

To test transactions, you need tBNB. The primary faucet is the official BNB Chain Testnet Faucet:

  • URL: https://www.bnbchain.org/en/testnet-faucet
  • Amount: 0.3 tBNB per request (daily limit)
  • Requirement: You must hold at least 0.002 BNB on BSC mainnet to use this faucet. Alternatively, use third-party faucets or contact the BNB Chain team for larger amounts.

Note: If you need more tokens for large-scale testing, consider applying for a faucet grant or using a dedicated testnet node provider.

Using BNB Testnet RPC Endpoints

An RPC endpoint is how your application communicates with the blockchain. You can use the public endpoint for light testing, but for reliability and higher rate limits, use a managed service like OnFinality.

Example: Check Latest Block Number

curl -H 'content-type:application/json' -d '{"id": 1, "jsonrpc": "2.0", "method": "eth_blockNumber"}' 'https://data-seed-prebsc-1-s1.bnbchain.org:8545'

Expected response:

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

Switching to a Managed Provider

Public endpoints can throttle requests. For development and CI/CD, obtain a free API key from OnFinality and use:

curl -H 'content-type:application/json' -H 'x-api-key: YOUR_API_KEY' -d '{"id": 1, "jsonrpc": "2.0", "method": "eth_blockNumber"}' 'https://bnb-testnet.api.onfinality.io/public'

OnFinality supports archive data and WebSocket connections, which are essential for debugging historical states or listening to events.

Common Debugging Tips

  • Insufficient Balance: Ensure your wallet has tBNB. Check balance via eth_getBalance.
  • Contract Deployment Fails: Verify your contract compiles correctly and you have enough gas. Use the faucet again if needed.
  • Rate Limited: If you see 429 Too Many Requests, switch to a provider with higher limits or implement exponential backoff.
  • Transaction Not Found: Use BscScan testnet to search by transaction hash. If pending, try increasing gas price.
  • WebSocket Disconnections: For WebSocket usage, consider a dedicated connection via a managed provider.

Debugging with Trace Calls

If you need to debug failed transactions, use debug_traceTransaction (if supported by your provider). OnFinality provides trace support for BNB Testnet:

curl -H 'content-type:application/json' -H 'x-api-key: YOUR_API_KEY' -d '{"id": 1, "jsonrpc": "2.0", "method": "debug_traceTransaction", "params": ["0xTX_HASH", {}]}' 'https://bnb-testnet.api.onfinality.io/public'

BNB Testnet vs. Mainnet: Key Differences

  • tBNB has no value: Do not treat testnet tokens as real assets.
  • Fewer validators: Testnet may have less decentralization, but consensus rules are identical.
  • Faster blocks?: Block times are similar (~3 seconds), but testnet network load varies.
  • Chain ID: 97 (testnet) vs. 56 (mainnet). Ensure your app handles chain switching correctly.

Next Steps: Moving to Mainnet

After testing on BNB Testnet, you'll need to switch to mainnet. Update your RPC endpoint to a production-grade provider. Review your contract's security and gas optimizations. Use BscScan to verify contracts. For a smooth migration, consider using a dedicated BNB Smart Chain node from OnFinality to maintain consistent performance.

For a complete list of supported networks and endpoints, see our supported networks page.

Key Takeaways

  • BNB Testnet mirrors mainnet and is essential for pre-release testing.
  • Use Chain ID 97 and get tBNB from the official faucet.
  • Public RPC endpoints are fine for small tests; for production-like loads, use a managed provider.
  • Debug failing transactions with block explorers and trace APIs.
  • Plan your migration to mainnet with a reliable RPC provider.

Frequently Asked Questions

  1. How do I get more tBNB if the faucet runs out? Try third-party faucets or request through BNB Chain's developer programs.
  2. Can I use BNB Testnet for production? No, testnets are for testing only; use mainnet (Chain ID 56) for live apps.
  3. What if my transaction is stuck? Use a higher gas price or resubmit with a new nonce.
  4. Does BNB Testnet support all EVM features? Most features are supported, but some precompiles may differ. Check the official docs.
  5. How do I connect to BNB Testnet via WebSocket? Use the WebSocket URL with a compatible library like ethers.js.

Note: For precise pricing and rate limits, refer to the RPC pricing page and supported networks page. Performance claims should be independently verified.

RPC 知识库

相关 RPC 内容

Testnet Rpc

Polygon Amoy 测试网:RPC 端点、水龙头和部署的完整开发者指南

# Polygon Amoy 测试网:RPC 端点、水龙头和部署的完整开发者指南 Polygon Amoy 是 Polygon PoS 的官方测试网,于 2024 年 1 月作为 Mumbai 的继任者启动。Amoy 锚定到 Ethereum Sepolia,为开发者提供了一个可持续、面向未来的环境...

Rpc Provider Selection

在选择专用Avalanche节点时应该注意什么?

专用Avalanche节点为您提供私有RPC端点,具有明确的速率限制,并让您完全控制Avalanche基础设施。本指南涵盖了选择专用节点提供商时需要评估的要素,包括性能、可靠性以及对C链、X链和P链的支持。...

Network Rpc

Kaia RPC:端点、提供商和最佳实践

本指南涵盖您需要了解的关于Kaia RPC端点的所有内容——从公共JSON-RPC URL到为生产环境选择可靠的提供商。了解如何连接到Kaia主网和Kairos测试网,评估RPC服务,并避免常见陷阱。...

Network Rpc

在选择 Avalanche RPC 提供商时,我应该关注什么?

# 在选择 Avalanche RPC 提供商时,我应该关注什么? Avalanche RPC 提供商之所以重要,是因为 Web3 应用程序依赖稳定的端点访问来进行读取、交易、仪表盘和后端工作流。正确的设置应匹配你的工作负载,支持你所需的网络和测试网,使限制可见,并在共享 RPC 不再足够时为你提供...

Network Rpc

关于 Polygon RPC 端点,我需要了解什么?

# 关于 Polygon RPC 端点,我需要了解什么? Polygon RPC 端点之所以重要,是因为 Polygon 应用程序依赖稳定的端点访问来进行读取、交易、仪表盘和后端工作流。合适的提供商应匹配您的工作负载,支持您所需的网络和测试网,使限制可见,并在共享 RPC 不再足够时为您提供扩展路径...

Network Rpc

什么是 HydraDX,如何通过 RPC 连接到它?

# 什么是 HydraDX,如何通过 RPC 连接到它? HydraDX(现已更名为 Hydration)是一个构建在 Polkadot 上的下一代 DeFi 协议,作为平行链运行。其旗舰产品是 Omnipool,一种创新的自动做市商(AMM),将所有资产整合到一个单一交易池中,从而实现资本高效的兑...

永远不用担心基础设施

OnFinality 消除了 DevOps 的繁重工作,让您能够更聪明、更快地构建。

开始