Skip to main content
added 14 characters in body
Source Link
deuk
  • 11
  • 3

I am testing Ethereum on a private network. While verifying the transaction fees received by a validator, I noticed a slight discrepancy between the calculated transaction fee and the actual transaction fee.

Here are the values retrieved

From eth.getTransactionReceipt:

{
  blockHash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  blockNumber: 812,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  effectiveGasPrice: 1000000007,
  from: "0x123463a4b065722e99115d6c222f267d9cabb524",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  to: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  transactionHash: "0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694",
  transactionIndex: 0,
  type: "0x2"
}

From eth.getBlock:

{
  baseFeePerGas: 7,
  difficulty: 0,
  extraData: "0xd883010e0c846765746888676f312e32322e32856c696e7578",
  gasLimit: 30000000,
  gasUsed: 21000,
  hash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  mixHash: "0xa44d27625f3f7553202488b20178d8707382c47a602712ecd0099feb79e8d19a",
  nonce: "0x0000000000000000",
  number: 812,
  parentHash: "0x4e86939660aa9db3d2393714ed73caeec15539c8da664685afb042fdada035c4",
  receiptsRoot: "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 696,
  stateRoot: "0x833b1f64f3351d7a7ef5a3432d4c8c37ae8979e0c181d014ca33974fb2655244",
  timestamp: 1732533924,
  totalDifficulty: 1,
  transactions: ["0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694"],
  transactionsRoot: "0xdc94dacc92cfa43ed2834ab65a3aa95f7744c3600502d841002ab5375a86c1c3",
  uncles: [],
  withdrawals: [],
  withdrawalsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

To calculate the transaction fee received by the validator, I used the formula: gasUsed

gasUsed × (effectiveGasPrice − baseFeePerGas) ⇒21000 × (1000000007 − 7) = 21,000000000000

Calculated fee (from the formula): 21,000,000,000,000 wei Actual fee received: 20,999,999,979,520 weiCalculated fee (from the formula): 21,000,000,000,000 wei

Actual fee received: 20,999,999,979,520 wei

What causes the discrepancy between the calculated fee and the actual fee received?

I am testing Ethereum on a private network. While verifying the transaction fees received by a validator, I noticed a slight discrepancy between the calculated transaction fee and the actual transaction fee.

Here are the values retrieved

From eth.getTransactionReceipt:

{
  blockHash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  blockNumber: 812,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  effectiveGasPrice: 1000000007,
  from: "0x123463a4b065722e99115d6c222f267d9cabb524",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  to: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  transactionHash: "0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694",
  transactionIndex: 0,
  type: "0x2"
}

From eth.getBlock:

{
  baseFeePerGas: 7,
  difficulty: 0,
  extraData: "0xd883010e0c846765746888676f312e32322e32856c696e7578",
  gasLimit: 30000000,
  gasUsed: 21000,
  hash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  mixHash: "0xa44d27625f3f7553202488b20178d8707382c47a602712ecd0099feb79e8d19a",
  nonce: "0x0000000000000000",
  number: 812,
  parentHash: "0x4e86939660aa9db3d2393714ed73caeec15539c8da664685afb042fdada035c4",
  receiptsRoot: "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 696,
  stateRoot: "0x833b1f64f3351d7a7ef5a3432d4c8c37ae8979e0c181d014ca33974fb2655244",
  timestamp: 1732533924,
  totalDifficulty: 1,
  transactions: ["0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694"],
  transactionsRoot: "0xdc94dacc92cfa43ed2834ab65a3aa95f7744c3600502d841002ab5375a86c1c3",
  uncles: [],
  withdrawals: [],
  withdrawalsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

To calculate the transaction fee received by the validator, I used the formula: gasUsed × (effectiveGasPrice − baseFeePerGas) ⇒21000 × (1000000007 − 7) = 21,000000000000

Calculated fee (from the formula): 21,000,000,000,000 wei Actual fee received: 20,999,999,979,520 wei

What causes the discrepancy between the calculated fee and the actual fee received?

I am testing Ethereum on a private network. While verifying the transaction fees received by a validator, I noticed a slight discrepancy between the calculated transaction fee and the actual transaction fee.

Here are the values retrieved

From eth.getTransactionReceipt:

{
  blockHash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  blockNumber: 812,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  effectiveGasPrice: 1000000007,
  from: "0x123463a4b065722e99115d6c222f267d9cabb524",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  to: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  transactionHash: "0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694",
  transactionIndex: 0,
  type: "0x2"
}

From eth.getBlock:

{
  baseFeePerGas: 7,
  difficulty: 0,
  extraData: "0xd883010e0c846765746888676f312e32322e32856c696e7578",
  gasLimit: 30000000,
  gasUsed: 21000,
  hash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  mixHash: "0xa44d27625f3f7553202488b20178d8707382c47a602712ecd0099feb79e8d19a",
  nonce: "0x0000000000000000",
  number: 812,
  parentHash: "0x4e86939660aa9db3d2393714ed73caeec15539c8da664685afb042fdada035c4",
  receiptsRoot: "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 696,
  stateRoot: "0x833b1f64f3351d7a7ef5a3432d4c8c37ae8979e0c181d014ca33974fb2655244",
  timestamp: 1732533924,
  totalDifficulty: 1,
  transactions: ["0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694"],
  transactionsRoot: "0xdc94dacc92cfa43ed2834ab65a3aa95f7744c3600502d841002ab5375a86c1c3",
  uncles: [],
  withdrawals: [],
  withdrawalsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

To calculate the transaction fee received by the validator, I used the formula:

gasUsed × (effectiveGasPrice − baseFeePerGas) ⇒21000 × (1000000007 − 7) = 21,000000000000

Calculated fee (from the formula): 21,000,000,000,000 wei

Actual fee received: 20,999,999,979,520 wei

What causes the discrepancy between the calculated fee and the actual fee received?

Source Link
deuk
  • 11
  • 3

Minor discrepancies in Ethereum transaction fees

I am testing Ethereum on a private network. While verifying the transaction fees received by a validator, I noticed a slight discrepancy between the calculated transaction fee and the actual transaction fee.

Here are the values retrieved

From eth.getTransactionReceipt:

{
  blockHash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  blockNumber: 812,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  effectiveGasPrice: 1000000007,
  from: "0x123463a4b065722e99115d6c222f267d9cabb524",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  to: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  transactionHash: "0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694",
  transactionIndex: 0,
  type: "0x2"
}

From eth.getBlock:

{
  baseFeePerGas: 7,
  difficulty: 0,
  extraData: "0xd883010e0c846765746888676f312e32322e32856c696e7578",
  gasLimit: 30000000,
  gasUsed: 21000,
  hash: "0x35291ba92d58e8427e19a5e5c485e5c5f05585bcd0a84084ab5167c3180894b7",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xdbd40e5d7f282700aa28315129b550e4b2bd3449",
  mixHash: "0xa44d27625f3f7553202488b20178d8707382c47a602712ecd0099feb79e8d19a",
  nonce: "0x0000000000000000",
  number: 812,
  parentHash: "0x4e86939660aa9db3d2393714ed73caeec15539c8da664685afb042fdada035c4",
  receiptsRoot: "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 696,
  stateRoot: "0x833b1f64f3351d7a7ef5a3432d4c8c37ae8979e0c181d014ca33974fb2655244",
  timestamp: 1732533924,
  totalDifficulty: 1,
  transactions: ["0xec9b83ff08a6157d88a7205ebd1724abd0c4f0a6472900000eeda82c5b282694"],
  transactionsRoot: "0xdc94dacc92cfa43ed2834ab65a3aa95f7744c3600502d841002ab5375a86c1c3",
  uncles: [],
  withdrawals: [],
  withdrawalsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}

To calculate the transaction fee received by the validator, I used the formula: gasUsed × (effectiveGasPrice − baseFeePerGas) ⇒21000 × (1000000007 − 7) = 21,000000000000

Calculated fee (from the formula): 21,000,000,000,000 wei Actual fee received: 20,999,999,979,520 wei

What causes the discrepancy between the calculated fee and the actual fee received?