Network Fee Estimate Calculation
Zero Hash provides an estimated network fee endpoint that can retrieve an approximate fee that a withdrawal would cost based on current blockchain conditions. The estimates are derived in different ways depending on the underlying blockchain.
Fee estimation functionality is available for both the Production (mainnet) and CERT (testnet) environments, however, please note that for some blockchains the test networks can behave differently than the main network with estimated fees and volatility varying between the two, sometimes significantly. One reason for this difference is that test tokens theoretically do not have a real monetary value, so miners and validators on test networks are not always incentivized to perform economically rational behavior, for example seeking the transactions with the highest tips.
UTXO Chains (i.e. Bitcoin, Litecoin, Bitcoin Cash)
Network fee estimates for BTC are sourced from transactions on either the main or testnet mempool, depending on which environment is being used. The network fee estimator will check the transactions with the highest fee-per-byte values that will make up the 1MB block size and then return the average fee-per-byte for this block.
The estimator optimizes for a fee value that will increase the likelihood of being mined in the next one or two blocks. Fees are dependent on a number of factors including transaction inputs/outputs and network demand, so in cases where there are many transactions with high fee-per-byte values it will increase the estimated fee values returned.
Ethereum / ERC20 Tokens
Ethereum underwent a merge to Proof of Stake that standardized the block times to 12 seconds, and previously the London hardfork (EIP-1559) in 2021 that allowed block sizes to vary which has resulted in more predictable fees. However, network fees are still subject to variables such as network demand, computation, and storage required for a given transaction. For example, withdrawals to a smart contract address should result in higher fees than a standard non-smart contract address withdrawal assuming similar network activity.
The network fee estimator determines a value by analyzing a number of recent trailing blocks and applies a percentile to that to optimize between price and inclusion in an upcoming block.
Solana
Solana is a high transaction-per-second chain that has relatively low fees that are generally consistent. The fee estimator calls Solana's RPC endpoint.
Other Supported Assets
Other supported assets not specifically mentioned follow a similar pattern to Ethereum where a number of recent blocks are analyzed with a percentile applied to optimize between price and inclusion in an upcoming block.
Assets without Estimates
There are a small number of supported assets like EGLD that do not yet return a network fee estimate that are being integrated into the endpoint.
Updated 3 months ago