Block structure

In Starknet, a block is a list of transactions, and a block header that contains 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

Where:

event_commitment

is the root of a 64-bit high binary Merkle Patricia tree. The leaf at index \(i\) corresponds to the hash of the \(i'th\) event.

transaction_commitment

is the root of a 64-bit high binary Merkle Patricia tree. The leaf at index \(i\) corresponds to \({h(transaction \space hash, signature)}\) if the \(i'th\) transaction is an invoke transaction and \(h(0,0)\) otherwise.

Block hash

A block hash is defined as the Pedersen hash of the header’s fields, as follows:

h(𝐵) = h(
    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.