ReasonJun

Ethereum : Block Structure 본문

Blockchain/Ethereum

Ethereum : Block Structure

ReasonJun 2024. 1. 16. 18:46
728x90

 

Block represents an Ethereum block.

Note the Block type tries to be 'immutable', and contains certain caches that rely on that. The rules around block immutability are as follows:

We copy all data when the block is constructed. This makes references held inside the block independent of whatever value was passed in.

We copy all header data on access. This is because any change to the header would mess up the cached hash and size values in the block. Calling code is expected to take advantage of this to avoid over-allocating!

When new body data is attached to the block, a shallow copy of the block is returned. This ensures block modifications are race-free.

We do not copy body data on access because it does not affect the caches, and also because it would be too expensive.

 

https://github.com/ethereum/go-ethereum/blob/master/core/types/block.go

 

 

Header

https://github.com/ethereum/go-ethereum/blob/master/core/types/block.go

  1. ParentHash (common.Hash):
    • Represents the hash of the parent block's header. It helps establish the chronological order and linkage of blocks in the blockchain.
  2. UncleHash (common.Hash):
    • Represents the hash of the uncle blocks. Uncle blocks are valid blocks that are not included in the main blockchain but still contribute to the security of the network.
  3. Coinbase (common.Address):
    • Represents the address of the miner who successfully mined this block and is entitled to the block reward.
  4. Root (common.Hash):
    • Represents the root hash of the state trie after all transactions in the block have been executed.
  5. TxHash (common.Hash):
    • Represents the root hash of the Merkle trie containing all transactions in the block.
  6. ReceiptHash (common.Hash):
    • Represents the root hash of the Merkle trie containing all transaction receipts.
  7. Bloom (Bloom):
    • Represents a Bloom filter, a data structure used to efficiently test whether an element is a member of a set. In Ethereum, it's used to filter and quickly query logs.
  8. Difficulty (big.Int):
    • Represents the difficulty of finding a valid hash for the block. It adjusts dynamically to control the rate at which new blocks are added to the blockchain.
  9. Number (big.Int):
    • Represents the block number, indicating the position of the block in the blockchain.
  10. GasLimit (uint64):
    • Represents the maximum amount of gas that can be used in this block.
  11. GasUsed (uint64):
    • Represents the total amount of gas used by all transactions in the block.
  12. Time (uint64):
    • Represents the timestamp indicating when the block was mined.
  13. Extra ([]byte):
    • Represents additional data that miners can include in the block.
  14. MixDigest (common.Hash):
    • Represents the mix hash used in Ethash mining.
  15. Nonce (BlockNonce):
    • Represents a 64-bit hash, used in the mining process to try different combinations to find a valid block hash.
  16. BaseFee (big.Int):
    • Added by Ethereum Improvement Proposal (EIP)-1559, represents the base fee per gas unit.
  17. WithdrawalsHash (common.Hash):
    • Added by EIP-4895, represents the hash of withdrawals from the Ethereum 2.0 beacon chain.
  18. BlobGasUsed (uint64):
    • Added by EIP-4844, represents the gas used by the Ethereum 2.0 blob.
  19. ExcessBlobGas (uint64):
    • Added by EIP-4844, represents the excess gas in Ethereum 2.0 blob.
  20. ParentBeaconRoot (common.Hash):
    • Added by EIP-4788, represents the root of the parent beacon block in Ethereum 2.0.

 

Block Production

1. Mempool Tx choose

2. EVM execution

3. Transaction execution ( Receipt, Log produce)

4. Block Header Generate

5. Find Nonce, MixHash (ethHash)

6. Block Propagation

728x90

'Blockchain > Ethereum' 카테고리의 다른 글

Ethereum : Transaction Receipt  (0) 2024.01.17
Ethereum : Transaction Structure  (0) 2024.01.16
Ethereum : Account structure  (0) 2024.01.05
Ethereum : Patricia Merkle Tries  (0) 2024.01.05
Ethereum : ERC721  (0) 2023.10.22
Comments