POST
/
afb8312f3710a5bc469f4c87cad3a2e4
curl --request POST \
  --url https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "zks_L1ChainId",
  "params": []
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "chainId": 123
  }
}

zkSync Era API method that returns the chain ID of the underlying Layer 1 (L1) network. This method is essential for developers who must confirm the specific blockchain network their zkSync instance interacts with, ensuring compatibility and correct operation of their applications across different environments.

Get your own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • none

Response

  • result — the chain ID of the underlying L1 network, returned as a hexadecimal string.

You can use the Chainstack EVM Swiss Army Knife to convert values.

Use case

For developers building on zkSync, zks_L1ChainId provides a straightforward way to verify the L1 network their applications are operating on programmatically. This is particularly useful for applications that are deployed across multiple environments to avoid common pitfalls such as contract interaction on an unintended network, which can lead to loss of funds or data integrity issues.

Body

application/json
jsonrpc
string
default:2.0
required
Example:

"2.0"

id
integer
default:1
required
Example:

1

method
string
default:zks_L1ChainId
required
Example:

"zks_L1ChainId"

params
any[]
required

Response

200 - application/json
Successful response
jsonrpc
string
default:2.0
required
Example:

"2.0"

id
integer
default:1
required
result
object
required