starknet_chainId
Returns the currently connected StarkNet chain ID.
Parameters
None.
Returns
The current chain ID in hexadecimal format.
Example
Replace YOUR-API-KEY
with an API key from your Infura dashboard.
Request
- cURL
curl https://starknet-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"starknet_chainId", "params":[], "id":0}'
Response
- JSON
{
"jsonrpc": "2.0",
"result": "0x534e5f4d41494e",
"id": 0
}