BNB Smart Chain
BNB Smart Chain
BNB Smart Chain
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_chainId returns the EIP-155 identifier of whatever network an endpoint serves. BNB Smart Chain runs PoSA consensus and settles fees in BNB, and it answers this call with "0x38", decimal 56, for mainnet. The Chapel testnet replies "0x61" (decimal 97). Query https://bsc.therpc.io/YOUR_API_KEY to read it. That same number is folded into every signed BSC transaction, binding it to one network so it cannot be replayed across chains.
0x38 so a BSC transaction is not accidentally built for another EVM network.eth_blockNumber for a combined "alive and serving chain 56" health probe.此方法不需要任何参数,传入空数组 [] 即可。
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded chain ID integer (e.g. "0x1" for Ethereum mainnet). |
Try it live in the BNB Smart Chain playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32603 | Internal error | Node failed to retrieve chain configuration. |
net_version; on BSC the network ID happens to match, but the two RPCs are conceptually distinct and can diverge on other networks."0x38"), so compare via BigInt(result) === 56n rather than string equality to dodge leading-zero and case mismatches.