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.
Try the zks_L1ChainId
RPC method yourself
zks_L1ChainId
RPC method yourself