TriportRPC

eth_chainId

POSThttps://triport.io/rpc/bsc

Return the chain identifier.

BNB Smart Chainbsc:rpcbsc_read_rpc - 15 / 20 / 100 / 250 RPS (free / basic / pro / business) (default, unmeasured); enterprise unlimited

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

JSON-RPC params must be an empty array: [].

Response

The response below is the checked fixture for this method; it is reproduced without changing its fields or values.

resultstring (hex quantity)
Chain ID as a hex quantity.

Errors

Errors use the standard JSON-RPC error envelope. See BSC errors for network-specific classification and the linked shared reference.

CodeMeaningWhen it happens
-32602Invalid paramsA required positional parameter is missing or a value does not match the OpenRPC schema.
401UnauthorizedThe x-token API key is missing or invalid.
429Rate limitedThe request exceeds the configured category RPS for the caller's tier.

Examples

JavaScript (fetch)

const response = await fetch("https://triport.io/rpc/bsc", {
  method: "POST",
  headers: {
    "x-token": process.env.TRIPORT_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_chainId",
    "params": []
  }),
});


const payload = await response.json();
console.log(payload.result);

Notes

  • The BSC categories use configured defaults of 15 / 20 / 100 / 250 RPS; they are marked unmeasured in the tier matrix.
  • Related methods: net_version, web3_clientVersion.