Block structure

A Starknet block is a list of transactions and a block header that contains the following fields:

Name Type Description

parent_block_hash

FieldElement

The hash of the block’s parent.

block_number

Integer

The number, that is, the height, of this block.

global_state_root

FieldElement

The state commitment after the block.

sequencer_address

ContractAddress

The Starknet address of the sequencer that created the block.

block_timestamp

Timestamp

The time at which the sequencer began building the block, in seconds since the Unix epoch.

transaction_count

Integer

The number of transactions in the block.

transaction_commitment

FieldElement

A commitment to the transactions included in the block.

The root of a height-64 binary Merkle Patricia trie. The leaf at index \(i\) corresponds to \({h(\text{transaction_hash}, \text{signature})}\).

event_count

Integer

The number of events in the block.

event_commitment

FieldElement

A commitment to the events produced in the block.

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

l1_gas_price

(Integer, Integer)

The price of L1 gas that was used while constructing the block. L1 gas prices apply to storage updates and L1→L2 messages. As of March 2023, computation is also priced in terms of L1 gas, but this will change in the future.

The first Integer value is the price in wei. The second is the price in fri.

l1_data_gas_price

(Integer, Integer)

The price of L1 blob gas that was used while constructing the block. If the l1_DA_MODE of the block is set to BLOB, L1 blob gas prices determines the storage update cost.

The first Integer value is the price in wei. The second is the price in fri.

l1_da_mode

String

CALLDATA or BLOB, depending on how Starknet state diffs are sent to L1.

protocol_version

String

The version of the Starknet protocol used when creating the block.

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.

Several properties of the block header, such as l1_gas_price and l1_da_mode, are not yet included in the block hash. This will change in a future Starknet version.