Transaction Fees on Layer4 Network

Fees Fundamental

The fee dynamics on Layer4 Network mirror those observed on Ethereum. However, due to its status as a Layer 2 (L2) blockchain, certain aspects of the fee structure differ from Ethereum's model.

Given that Layer4 Network is continually enhancing its EVM compatibility, adapting to alterations for dApps is straightforward with only minor adjustments. Let's delve into the two primary origins of transaction expenses on Layer4 Network.

  1. L2 Transaction Fee for Layer-2 Execution

  2. L1 Rollup Fee to cover the expenditure associated with broadcasting rollup state roots to L1 (equally distributed among users whose transactions were encompassed within the rollup batch)

The estimateGas API currently only returns L2 gas cost. The L1 gas estimate needs to be calculated separately. We will support fetching the total L1+L2 gas estimate through the estimateGas interface in a future network update.

L2 Transaction Fee for Layer-2 Execution

Similar to Ethereum, transactions within Layer4 Network require payment for the computational and storage resources they consume. Each L2 transaction entails an execution fee determined by the amount of gas used in the transaction, multiplied by the attached gas price.

Here's a straightforward breakdown:

L2 Execution Cost = L2 Gas Price * L2 Gas Used

The specific quantity of L2 gas consumed varies based on the nature of the transaction being sent. With its EVM compatibility, transactions on Layer4 Network generally consume a comparable amount of gas to those on Ethereum. While gas prices exhibit fluctuations due to congestion and timing, you can conveniently monitor the prevailing estimated L2 gas price on the public Layer4 dashboard. Moreover, given that gas fees on Layer4 Network are denominated in $LAYER4 tokens, transactions maintain a considerably lower cost compared to other L2 networks employing $ETH as their gas token.

L1 Rollup Fee

All the state roots generated on L2 as a result of transaction execution are propagated to Ethereum within Layer4 Network. This step holds paramount importance in maintaining the security characteristics of Layer4 Network because it guarantees that the latest block data from the L2 network, crucial for node synchronization, remains consistently accessible on the public L1 Ethereum platform.

Layer4 Network accomplishes this by publishing rollup states and essential transaction data to Ethereum through the packaging of transactions into batches. The cost incurred during this process in terms of $ETH is distributed among users whose transactions are included in the batch. Notably, the cost per user is notably lower compared to executing transactions directly on L1.

The computation of the L1 rollup fee is based on several sub-factors:

  • The prevailing gas price on Ethereum.

  • A fixed overhead that is auto-adjusted and integrated into the gas oracle.

  • The scaling factor, which is presently set at 1.

  • The conversion ratio between $ETH and $LAYER4.

  • The mathematical expression for the L1 rollup fee is:

L1RollupFee = L1GasPrice * Overhead * Ratio

To comprehend the transaction fees incurred by users, the following steps are executed:

  1. Establish a connection to the RPC and employ the EstimateGas method to compute the gas cost on L2 (if using a wallet such as MetaMask, this step occurs automatically). This constitutes the L2 Transaction Fee.

  2. Sign and submit the transaction.

  3. The Layer4 node receives the transaction, assesses the account balance's sufficiency, accounting for both the L2 Transaction Fee and L1 Rollup Fee.

  4. The transaction is successfully executed, documenting your interaction with Layer4 Network.

Last updated