Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsStarknetJSON-RPC API

starknet_chainId - Get Starknet Chain ID

Returns the currently configured Starknet chain ID as a felt252 hex value. Used for network identification, transaction signing, and multi-chain routing.

Starknet RPC endpoint: endpoint URLs, plans and pricing.

Returns the currently configured Starknet chain ID as a hex-encoded felt252 value. This method is used to verify which Starknet network a node is connected to before signing transactions or deploying contracts.

Overview

Starknet chain IDs are encoded as felt252 values representing short ASCII strings. Unlike EVM chains that use numeric IDs, Starknet encodes human-readable network names into their felt representation. This is consistent with Starknet's use of felt252 as the fundamental data type in the Cairo language and the StarkNet OS.

Known Starknet Chain IDs

NetworkChain ID (ASCII)Chain ID (Hex felt252)
MainnetSN_MAIN0x534e5f4d41494e
Sepolia TestnetSN_SEPOLIA0x534e5f5345504f4c4941

The hex values are the ASCII byte representations of the network name strings.

JSON-RPC request
{
  "jsonrpc": "2.0",
  "method": "starknet_chainId",
  "params": [],
  "id": 1
}

Examples

Use Cases

  • Network Verification - Confirm you are connected to mainnet or testnet before signing transactions with an Account contract
  • Multi-Network Applications - Route requests to the correct network handler based on chain ID
  • Transaction Signing - Include the correct chain ID in transaction signatures to prevent cross-network replays
  • Wallet Integrations - Display the connected Starknet network in wallet UIs
  • Deployment Pipelines - Gate contract deployments on the correct target network

Related Methods

  • starknet_specVersion - Get the supported Starknet JSON-RPC spec version
  • starknet_syncing - Check node synchronization status
  • starknet_blockNumber - Get the latest block number
  • starknet_blockHashAndNumber - Get latest block hash and number

starknet_call - Execute Cairo Contract Calls

Execute Cairo smart contract functions without creating a transaction on Starknet.

starknet_estimateFee - Estimate Transaction...

Estimate fees for Starknet transactions before execution.

On this page

OverviewKnown Starknet Chain IDsExamplesUse CasesRelated Methods