Skip to main content

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 MetaMask Developer dashboard.

Request

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

{
"jsonrpc": "2.0",
"result": "0x534e5f4d41494e",
"id": 0
}