Developers
EVM Development
Calculating Transaction Fees

Understanding Transaction Fees on Tangle Network

Tangle Network is a substrate-based blockchain that uses the Frontier pallet to provide Ethereum Virtual Machine (EVM) support. This allows Tangle to process transactions originating from both the Substrate and Ethereum ecosystems.

Since Tangle Network incorporates transaction models from two different blockchain architectures, it's important for developers to understand the fee calculation mechanisms for each transaction type.

Substrate vs Ethereum Fees

Substrate-based blockchains like Tangle Network use the concept of "weight" to calculate transaction fees. The heavier the computation and storage requirements of a transaction, the higher the fee.

Transactions originating from the Ethereum side consume "gas units" instead. Gas represents the computational effort required to execute a transaction. Each operation has a fixed gas cost based on its complexity. The total fee is calculated by multiplying gas used by the gas price.

Ethereum Transactions on Tangle

While adopting Ethereum's gas model, transaction fees on Tangle work a bit differently than on Ethereum itself:

  • Tangle implements a fee mechanism resembling EIP-1559 but with some modifications
  • Gas used is derived from the Substrate extrinsic weight via a fixed factor
  • There is a block limit for storage proofs which can cause "out of gas" errors even if gas remains
  • Storage growth on chain state is accounted for with a new mechanism that increases gas costs for state-expanding transactions

Calculating Ethereum Transaction Fees

The formula to calculate Ethereum transaction fees on Tangle is:

GasPrice = min(BaseFee + MaxPriorityFeePerGas, MaxFeePerGas)
Tx Fee = (GasPrice * Weight) / 25000

Where:

  • BaseFee is a network-set minimum fee, adjusted based on congestion
  • MaxPriorityFeePerGas and MaxFeePerGas are optionally set by the sender
  • Division by 25000 converts weight to gas units

The relevant parameters can be queried from Tangle Network's RPC endpoints for a given transaction.

Substrate Transaction Fees

Substrate transaction fees on Tangle are more straightforward. The total fee paid is directly reported in the TransactionFeePaid event emitted by the transactionPayment pallet for each extrinsic.

This event contains:

  1. The paying account
  2. The total fee
  3. The tip (an additional fee to incentivize inclusion)

In Summary

Substrate transactions on Tangle use a weight-based fee model while Ethereum transactions consume gas, but with Tangle-specific adjustments to the gas price calculation and limits.

By understanding these fee mechanisms, developers can estimate costs and optimize their Tangle Network transactions originating from both the Substrate and Ethereum sides.