Block structure

In Starknet, the block is defined as a list of transactions and a block header.

Block header

The following fields define the block header:

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.

The leaf at index \(i\) corresponds to the hash of the \(i'th\) event for event_commitment and \(h(transaction \ hash, signature)\) for invoke transaction_commitment.

For other types of transactions, we use \(h(0,0)\).

Block hash

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

\[\begin{aligned} h(B)=h(&\text{block_number}, \text{ global_state_root}, \text{ sequencer_address}, \text{ block_timestamp}, \\ &\text{transaction_count}, \text{ transaction_commitment}, \text{ event_count},\\ & \text{event_commitment}, 0, 0, \text{ parent_block_hash}) \end{aligned}\]

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.