TriportRPC

eth_chainId

BNB Smart Chain / https://triport.io/rpc/bsc

Minimum tier: Free

BNB Smart Chain method guide

Last updated:

eth_chainId returns the EVM chain identifier of BNB Smart Chain as a hex quantity.

Use it to verify that a client is connected to the intended chain before signing, displaying, or interpreting chain-specific data. The example result 0x38 is decimal 56, the BNB Smart Chain mainnet chain ID.

This differs from net_version, which returns the network identifier as a decimal string. Applications should generally use eth_chainId for EIP-155 chain selection.

Parameters

This method takes no parameters.

Returns

eth_chainId return value
FieldType
chainIdQuantity

Examples

curl https://triport.io/rpc/bsc \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
const res = await fetch("https://triport.io/rpc/bsc", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_chainId",
  "params": []
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/rpc/bsc",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: BNB Smart Chain.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_chainId do?
Return the chain identifier.
How many credits does eth_chainId cost?
eth_chainId costs 1 credit(s) per call on Triport by default.
Is eth_chainId available over WebSocket?
eth_chainId is an HTTP JSON-RPC method.