Transaction Fees on DogeOS
Overview
DogeOS fees are notably lower than on its supporting layer. For users and developers, transaction fees on DogeOS appear to work similarly to those on Ethereum mainnet, and existing tools, wallets, and code will likely work as if they were. However, the transaction fee shown in the wallet isn’t the whole picture unless the software is specifically aware of DogeOS’s fee calculations.
Due to the design of L2s and application layers, transaction costs depend on the L1’s costs. As a protocol, DogeOS must account for the cost of the transaction data posted to Celestia and the cost of generating proofs and keeping the Dogecoin bridge up-to-date.
DogeOS introduces some new dimensions to transaction fee calculation to do this as compared to Ethereum mainnet. The final cost of a transaction is constructed from several parts:
- DogeOS Execution fee
- Calculated in the same manner as on Ethereum, equaling
gas_price * gas_used
- Calculated in the same manner as on Ethereum, equaling
- Data and Finality fee
- This additional fee covers sending data to Celestia for data availability.
- It is calculated based on the size of the transaction’s calldata, along with the current Celestia and Dogecoin fee rates.
- DOGE is automatically deducted from the user’s balance on DogeOS for the fee
At a high level, the DogeOS execution fee is the cost of executing your transaction on the L2 sequencer, and the Data and Finality fee is the cost of securing your transaction through Dogecoin and Celestia.
In short, totalTxFee = executionFee + dataAndFinalityFee, all denominated in DOGE, the native gas token for the DogeOS network.
DogeOS Execution Fee
Transactions on DogeOS, like on Ethereum, must pay the cost of executing their computations and storing the data they produce.
Calculating the Execution Fee
The DogeOS execution fee is straightforward:
executionFee = dogeosGasUsed * effectiveGasPriceThe total fee depends on what the transaction does (dogeosGasUsed) as well as the current market conditions (effectiveGasPrice). “Gas used” is assessed by calling the estimateGas endpoint on a DogeOS node.
In other words, the execution fee is calculated precisely like Ethereum.
Data and Finality Fee
Every transaction’s calldata must be committed to Celestia and cover a portion or protocol fees to finalize on Dogecoin. This incurs an additional transaction fee, referred to as the “Data and Finality Fee”. Without doing this, DogeOS couldn’t be reconstructed from only Dogecoin and Celestia data.
Transactions aren’t committed 1-by-1 — they are collected in batches of blocks (and blocks of transactions). The cost of an individual transaction is computed based on the zeros and non-zero bytes in its payload, along with the current Celestia and Dogecoin fee rates.
Estimating the Data and Finality Fee
DogeOS has a pre-deployed L1GasPriceOracle at 0x5300000000000000000000000000000000000002, accessible on DogeOS Chikyū Testnet. It provides a getL1Fee method to estimate the L1 data fee for a given transaction’s raw data.
function getL1Fee(bytes memory _data) external view override returns (uint256);L1GasPriceOracle API
overhead
function overhead() external view returns (uint256);Returns the current L1 fee overhead
scalar
function scalar() external view returns (uint256);Returns the current l1 fee scalar
l1BaseFee
function l1BaseFee() external view returns (uint256);Returns the latest known l1 base fee
getL1Fee
function getL1Fee(bytes memory data) external view returns (uint256);Computes the L1 portion of the fee based on the size of the RLP encoded input transaction, the current L1 base fee, and the various dynamic parameters.
Returns: L1 fee that should be paid for the transaction
| Parameter | Description |
|---|---|
| data | Signed fully RLP-encoded transaction to get the L1 fee for. |
getL1GasUsed
function getL1GasUsed(bytes memory data) external view returns (uint256);Computes the amount of L1 gas used for a transaction. Adds the overhead which represents the per-transaction gas overhead of posting the transaction and state roots to L1. Adds 74 bytes of padding to account for the fact that the input does not have a signature.
Returns: Amount of L1 gas used to publish the transaction.
| Parameter | Description |
|---|---|
| data | Signed fully RLP-encoded transaction to get the L1 fee for. |