2

After the merge, the block hash computation has a different formula. Before that, the following data were used to compute the hash via feeding the list of hex values to an RLP encoder and hashing the encoding with Keccak.

What new headers are added to this formula?

Are the nonce and difficulty removed since they have no relevance?

block_header = [
    parent_hash, # parentHash
    uncles_hash,  # ommersHash
    coinbase_lower, #beneficiary
    state_root, # stateRoot
    transactions_root, # transactionsRoot
    receipts_root, # receiptsRoot
    bloom, #logsBloom
    difficulty_hex, # difficulty
    number_hex, # number
    gas_limit_hex, # gasLimit
    gas_used_hex, # gasUsed
    timestamp_hex, # timestamp
    extra_data, # extraData
    mix_hash, # mixHash
    nonce, # nonce
    base_fee_per_gas,
]

rlp_encoded = rlp.encode(block_header)

block_hash = web3.keccak(rlp_encoded).hex()
1
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Ethereum Meta, or in Ethereum Chat. Comments continuing discussion may be removed.
    – eth
    Nov 7, 2023 at 8:11

1 Answer 1

3

According to EIP-3675, with the transition to Proof of Stake:

Each block field listed in the table below MUST be replaced with the corresponding constant value

Field Constant value Comment
ommersHash 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 = Keccak256(RLP([]))
difficulty 0
mixHash 0x0000000000000000000000000000000000000000000000000000000000000000
nonce 0x0000000000000000

difficulty should be represented as 0x when fed into the RLP encoder.

The EIP does not specify any new block (header) fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.