Which Gas Number on an Ethereum Receipt Did I Pay For?

 / 
7

An Ethereum receipt can show millions of units of cumulativeGasUsed alongside a much smaller gasUsed. To work out the execution fee for your transaction, multiply gasUsed × effectiveGasPrice. The cumulative field includes the execution gas consumed by earlier transactions in the same block.

Follow two adjacent transactions in block 22,000,000

Open Ethereum mainnet block 22,000,000 and sort its transactions by position. Position zero consumed 11,033,143 gas. Position one consumed 339,311. By the end of position one, the block had consumed 11,372,454 gas in total.

Block positionGas used by this transactionGas used through this position
011,033,14311,033,143
1339,31111,372,454

Look up the second transaction. Its raw receipt gives transactionIndex = 0x1, gasUsed = 0x52d6f and cumulativeGasUsed = 0xad87a6. Convert the last two hexadecimal numbers to decimal to recover 339,311 and 11,372,454. Subtracting the previous cumulative value gives the same answer: 11,372,454 − 11,033,143 = 339,311 gas.

Reproduce the fee in ETH

The second receipt's effective gas price is 2,611,253,386 wei per gas, or 2.611253386 gwei. Multiply 339,311 by 2,611,253,386 to get 886,026,997,657,046 wei. Divide by 1018 to obtain 0.000886026997657046 ETH. Keep the integer wei result until the last step. Rounding to 2.6 gwei first changes the fee you are trying to reconcile.

For a quick numerical check in the gas fee calculator, use its single-price legacy calculation with 339311 gas used, 339311 as the limit for this check, and 2.611253386 gwei. That reproduces the execution-fee arithmetic to the tool's display precision. The historical transaction itself was type 2; this shortcut does not reconstruct its signed gas limit or fee caps.

When subtraction works

Use receipts from the same block hash and consecutive transaction indexes. For index zero, the preceding cumulative value is zero. If index seven is compared with index four, the difference covers indexes five, six and seven together. The account's previous transaction may have occurred in a different block entirely.

This calculation covers Ethereum mainnet execution gas. Blob gas can add a separate fee on blob transactions, and some other networks charge separate data fees. Token transfers and ETH sent as transaction value are separate from execution fees. Ethereum transaction receipt fields.