zks_estimateFee | zkSync Era

zkSync Era API method that returns an estimate of the transaction fee for a given transaction in the zkSync network.

This method estimates the fee required to process a transaction on the zkSync network. It considers the current network load and the transaction's complexity. Developers can use this estimate to inform users of the expected cost to ensure transactions are processed efficiently on 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.

Parameters

The transaction request object for which the fee is estimated. It includes several fields similar to Ethereum transactions but tailored for zkSync's L2 operations:

  • from — the string of the address initiating the transaction.
  • to — the string of the address to which the transaction is directed. Can be a wallet address or a smart contract on zkSync.
  • data — (optional) additional data sent with the transaction, typically used for smart contract interactions. It's a string of the hash of the method signature and encoded parameters, aligning with the Ethereum Contract ABI.

Response

The response includes detailed fee information, breaking down the costs associated with executing the transaction on zkSync and any associated costs on the L1 network:

  • gasLimit — the maximum gas limit that can be used for the transaction's execution.
  • gasPerPubdataLimit — the gas cost per byte of public data in the transaction, a unique aspect of zkSync's scaling solution.
  • maxFeePerGas — the maximum fee (in Wei) the sender will pay for each gas unit.
  • maxPriorityFeePerGas — the maximum priority fee per gas.

Use Case

Using zks_estimateFee applications can provide accurate fee estimates for various operations, ensuring users are fully informed of upfront costs. This facilitates a more efficient allocation of resources and enhances user trust through transparency.

Try the zks_estimateFee RPC method yourself

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