
How to Calculate Fees on Bitcoin and EVM
Fees are the invisible tax on every on-chain action. Get them wrong and your transaction either stalls for hours or costs far more than it should. Understanding how each network prices transactions — and how to fetch live rates — puts you in full control.
Bitcoin Fees: Pay for Space, Not Computation
Bitcoin fees are priced by transaction size in virtual bytes (vBytes). The fee rate — expressed in satoshis per vByte (sat/vByte) — is driven entirely by mempool demand. A typical single-input, single-output Taproot transaction is ~111 vBytes; a Legacy equivalent can exceed 190 vBytes for the same transfer, costing significantly more at the same fee rate.
Tx Size
(vBytes)
Inputs + Outputs + overhead
→
Fee Rate
(sat/vByte)
set by mempool demand
→
×
→
Total Fee
(satoshis)
paid to miner
Fee = Tx Size (vBytes) x Fee Rate (sat/vByte)
Diagram: Bitcoin Fee Calculation
| Address Type | Typical Input Size | Relative Cost |
|---|---|---|
| Legacy (P2PKH) | ~148 vBytes | Highest |
| SegWit-wrapped (P2SH) | ~91 vBytes | Medium |
| Native SegWit (bech32) | ~68 vBytes | Low |
| Taproot (bech32m) | ~57.5 vBytes | Lowest |
Live Fee Rate Tiers (Bitcoin)
Fee rates fluctuate constantly with mempool congestion. Wallets and apps should always fetch live rates from mempool.space and offer three priority tiers to the user:
| Priority | Fee Rate | Confirmation Time |
|---|---|---|
| Low Priority | 1-5 sat/vByte | Hours to days |
| Medium Priority | 6-20 sat/vByte | Next 1-3 blocks |
| High Priority | 21+ sat/vByte | Next block |
Typical fee rate ranges — always fetch live data from mempool.space
Diagram: Bitcoin Fee Priority Tiers
Fetching Live Bitcoin Fee Rates
Use the mempool.space public API — no API key required:
GET https://mempool.space/api/v1/fees/recommendedResponse:
{ "fastestFee": 24, "halfHourFee": 14, "hourFee": 8, "economyFee": 3, "minimumFee": 1 }| Priority | API Field | Use Case |
|---|---|---|
| High Priority | fastestFee | Urgent sends, time-sensitive payments |
| Medium Priority | halfHourFee | Standard sends — best cost/speed tradeoff |
| Low Priority | economyFee | Non-urgent; acceptable to wait hours |
Key takeaway: Multiply the chosen fee rate by estimated vBytes to show the user an exact fee before they sign. Cache the response for no more than 30 seconds — mempool rates shift quickly during congestion.
EVM Fees: Pay for Computation, Not Size
On Ethereum and all EVM-compatible chains, fees are priced by gas — a unit of computational effort. Since EIP-1559, Gas Price is split into a Base Fee (burned by the network) and a Priority Fee tip paid to the validator. Wallets expose a Max Fee cap; any surplus is refunded. A plain ETH transfer always costs exactly 21,000 gas.
| Gas Used (units) | Gas Price (Gwei) | ETH Fee (paid) |
| Base Fee (burned) | Priority Fee (to validator) |
Fee = Gas Used x (Base Fee + Priority Fee)
Diagram: EVM Fee Calculation (EIP-1559)
| Operation | Gas Used (approx.) |
|---|---|
| ETH transfer | 21,000 |
| ERC-20 transfer | ~65,000 |
| Uniswap swap | ~150,000 |
| NFT mint | ~100,000 – 300,000 |
| Complex DeFi operation | 500,000+ |
Live Fee Rate Tiers (EVM)
You only control the Priority Fee (tip) — the Base Fee is set automatically by the network each block. Fetch live values via the Ethereum JSON-RPC or a provider like Etherscan:
| Priority | Priority Fee | Confirmation Time |
|---|---|---|
| Low Priority | 1-2 Gwei tip | Minutes to hours |
| Medium Priority | 2-5 Gwei tip | Next few blocks |
| High Priority | 10+ Gwei tip | Next block |
Priority Fee (tip) only — Base Fee is set by the network automatically
Diagram: EVM Fee Priority Tiers
Fetching Live EVM Fee Data
Fetch current Base Fee directly from the node:
eth_gasPrice // legacy — returns current gas price in Wei
eth_feeHistory(4, "latest", [25,50,75]) // EIP-1559 — returns base fee + priority percentilesOr use the Etherscan Gas Oracle API:
GET https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=YourKey| Priority | Priority Fee (tip) | Expected Confirmation |
|---|---|---|
| High Priority | 10+ Gwei | Next block (~12 sec) |
| Medium Priority | 2–5 Gwei | Next few blocks |
| Low Priority | 1–2 Gwei | Minutes to hours |
Key takeaway: Always call eth_estimateGas before sending — never hardcode gas limits except for plain ETH transfers. Add a 20% buffer to the estimate to protect against mid-execution state changes.
Fee estimation is not a detail — it's a core part of every transaction. Underpay on Bitcoin and your transaction sits unconfirmed for hours. Underpay on EVM and it reverts, costing gas with nothing to show for it. Fetch live rates, respect the priority tiers, and your transactions land cleanly every time.
Which chain's fee model do you find more intuitive — Bitcoin's size-based approach or EVM's gas model? Let us know below.
