Transaction Fee

Transaction Fees

The transaction fee for the current Zeknd virtual machine (ZEVM) is calculated as follows:(Transaction Fee) := (Gas Used) * (Base Fee)

  • The Gas Used is computed by ZEVM based on the gas cost of the opcode and the intrinsic gas cost.

  • Base Fee is the actual gas price used for the transaction. It has the same meaning as the Effective Gas Price.

This calculated transaction fee is subtracted from the sender's or fee payer's account balance, depending on the transaction.

Gas and Base Fee Overview

Gas

Every action that changes the state of the blockchain requires gas. When a node processes a user's transaction, such as sending ZEKND, executing a contract, the user has to pay for the computation and storage usage. The payment amount is decided by the amount of gas required.Gas is a measuring unit representing how much calculation is needed to process the user's transaction.

Dynamic Gas Fee Mechanism

Dynamic gas fee policy provides a stable service to users by preventing network abuse and storage overuse. The gas fee changes according to the network situation. Seven parameters affect the base fee(gas fee):

  1. 1.PREVIOUS_BASE_FEE: Base fee of the previous block

  2. 2.GAS_USED_FOR_THE_PREVIOUS_BLOCK: Gas used to process all transactions of the previous block

  3. 3.GAS_TARGET: The gas amount that determines the increase or decrease of the base fee (30 million at the moment)

  4. 4.MAX_BLOCK_GAS_USED_FOR_BASE_FEE: Implicit block gas limit to enforce the max basefee change rate (60 million at the moment)

  5. 5.BASE_FEE_DELTA_REDUCING_DENOMINATOR: The value to set the maximum base fee change to 5% per block (20 at the moment, can be changed later by governance)

  6. 6.UPPER_BOUND_BASE_FEE: The maximum value for the base fee (750 ston at the moment, can be changed later by governance)

  7. 7.LOWER_BOUND_BASE_FEE: The minimum value for the base fee (25 ston at the moment, can be changed later by governance)

Base Fee

The basic idea of this algorithm is that the base fee would go up if the gas used exceeds the base gas and vice versa. It is closely related to the number of transactions in the network and the gas used in the process. There is an upper and lower limit base fee to prevent the fee from increasing or decreasing indefinitely. There is also a cap for the gas and an adjustment value for the fluctuation to prevent abrupt changes in the base fee. The values can be changed by governance.

Transaction Replacement

Zeknd currently does not provide a way to replace a transaction using the unit price but may support different methods for transaction replacement in the future. Note that in Ethereum, a transaction with a given nonce can be replaced by a new one with a higher gas price.

Last updated