Block structure

In Starknet, the block is defined as a list of transactions and a block header containing the following fields:

Name Type Description Implemented

parent_block_hash

FieldElement

The hash of this block’s parent

block_number

Integer

The number (height) of this block

global_state_root

FieldElement

The state commitment after this block

sequencer_address

FieldElement

The Starknet address of the sequencer who created this block

block_timestamp

Timestamp

The time the sequencer created this block before executing transactions

transaction_count

Integer

The number of transactions in a block

transaction_commitment

FieldElement

A commitment to the transactions included in the block

event_count

Integer

The number of events

event_commitment

FieldElement

A commitment to the events produced in this block

protocol_version

Integer

The version of the Starknet protocol used when creating this block

extra data

FieldElement

Extraneous data that might be useful for running transactions

The commitment fields event_commitment and transaction_commitment are the roots of a height 64 binary Merkle Patricia tree.

For event_commitment, the leaf at index \(i\) corresponds to the hash of the \(i'th\) event.

For transaction_commitment, the leaf at index \(i\) corresponds to \(h(transaction \ hash, signature)\) if the \(i'th\) transaction is an invoke transaction and \(h(0,0)\) otherwise.

Block hash

The block hash is defined as the Pedersen hash over the header’s elements.

ℎ(𝐵) = ℎ(
    block_number,
    global_state_root,
    sequencer_address,
    block_timestamp,
    transaction_count,
    transaction_commitment,
    event_count,
    event_commitment,
    0,
    0,
    parent_block_hash
)

Where \(h\) is the Pedersen hash.

Zeros inside the hash computation of an object are used as placeholders, to be replaced in the future by meaningful fields.