zks_estimateGasL1ToL2 | zkSync Era

The zks_estimateGasL1ToL2 API method estimates the gas required to execute a transaction from Layer 1 (Ethereum) to Layer 2 (zkSync). This estimation is crucial for users and applications that optimize their transactions by accurately forecasting the gas needed for bridging assets or executing operations from L1 to L2 in the zkSync network.


Get you 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.


The transaction request object for which the L1 to L2 gas estimation is made. It encapsulates details about the transaction, including:

  • from — a string representing the Ethereum address from which the transaction is initiated.
  • to — a string indicating the target address on zkSync Layer 2. This could be a wallet address or a smart contract within the zkSync ecosystem.
  • data — (Optional) a string of the hashed method signature and encoded parameters intended for smart contract interactions. This aligns with the Ethereum Contract ABI, facilitating seamless operations across layers.


The response to the zks_estimateGasL1ToL2 request provides the estimated gas requirement for the transaction, enabling precise budgeting for gas expenses:

  • result — the estimated gas required for the transaction, represented as a hex string.

Use case

A practical application of zks_estimateGasL1ToL2 is for a DApp that bridges assets from Ethereum to zkSync, offering users lower transaction costs and faster processing. By estimating the required gas before initiating the bridge, the DApp ensures users have sufficient funds for the transaction, enhancing transparency and efficiency in cross-layer operations.

Try the zks_estimateGasL1ToL2 RPC method yourself

Click Try It! to start a request and see the response here!