Skip to content

Block

The block is the fundamental object on the blockchain. Every 2s or so, a new block is created that may contain account transactions, update transactions or account creations.

Blocks are stored in the collection blocks in the db and has the following class:

Information about a block.

GRPC documentation: concordium.v2.BlockInfo

Attributes:

Name Type Description
arrive_time Optional[CCD_TimeStamp]

Time the block was verified.

validator Optional[int]

ID of the validator of this block.

hash CCD_BlockHash

Hash of the block.

height int

Absolute height of the block.

last_finalized_block CCD_BlockHash

The last finalized block when this block was baked.

parent_block CCD_BlockHash

The parent block hash.

receive_time Optional[CCD_TimeStamp]

Time the block was received.

slot_number Optional[int]

The slot number in which the block was baked.

slot_time CCD_TimeStamp

Time of the slot in which the block was baked.

era_block_height int

The height relative to genesis.

finalized bool

Whether the block is finalized.

genesis_index int

The genesis index for this block.

transaction_count int

The number of transactions in the block.

transactions_energy_cost int

The total energy cost of the transactions in the block.

transactions_size int

The total size of the transactions in the block.

transaction_hashes Optional[list[CCD_TransactionHash]]

The hashes of the transactions in the block.

state_hash Optional[CCD_StateHash]

The state hash of the block.

protocol_version Optional[str]

The protocol version of the block.

round Optional[CCD_Round]

The round in which the block was created.

epoch Optional[CCD_Epoch]

The epoch in which the block was created.

Source code in .venv/lib/python3.13/site-packages/ccdexplorer/grpc_client/CCD_Types/__init__.py
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
class CCD_BlockInfo(BaseModel):
    """Information about a block.

    GRPC documentation: [concordium.v2.BlockInfo](https://docs.concordium.com/concordium-grpc-api/#concordium.v2.BlockInfo)

    Attributes:
        arrive_time (Optional[CCD_TimeStamp]): Time the block was verified.
        validator (Optional[int]): ID of the validator of this block.
        hash (CCD_BlockHash): Hash of the block.
        height (int): Absolute height of the block.
        last_finalized_block (CCD_BlockHash): The last finalized block when this block was baked.
        parent_block (CCD_BlockHash): The parent block hash.
        receive_time (Optional[CCD_TimeStamp]): Time the block was received.
        slot_number (Optional[int]): The slot number in which the block was baked.
        slot_time (CCD_TimeStamp): Time of the slot in which the block was baked.
        era_block_height (int): The height relative to genesis.
        finalized (bool): Whether the block is finalized.
        genesis_index (int): The genesis index for this block.
        transaction_count (int): The number of transactions in the block.
        transactions_energy_cost (int): The total energy cost of the transactions in the block.
        transactions_size (int): The total size of the transactions in the block.
        transaction_hashes (Optional[list[CCD_TransactionHash]]): The hashes of the transactions in the block.
        state_hash (Optional[CCD_StateHash]): The state hash of the block.
        protocol_version (Optional[str]): The protocol version of the block.
        round (Optional[CCD_Round]): The round in which the block was created.
        epoch (Optional[CCD_Epoch]): The epoch in which the block was created.
    """

    arrive_time: Optional[CCD_TimeStamp] = None
    baker: Optional[int] = None
    hash: CCD_BlockHash
    height: int
    last_finalized_block: CCD_BlockHash
    parent_block: CCD_BlockHash
    receive_time: Optional[CCD_TimeStamp] = None
    slot_number: Optional[int] = None
    slot_time: CCD_TimeStamp
    era_block_height: int
    finalized: bool
    genesis_index: int
    transaction_count: int
    transactions_energy_cost: int
    transactions_size: int
    transaction_hashes: Optional[list[CCD_TransactionHash]] = None
    state_hash: Optional[CCD_StateHash] = None
    protocol_version: Optional[str] = None  # note this is not optional from the specification,
    # but this type is also used in retrieving blockInfo from MongoDB, where protocol_version
    # isn't stored for all blocks (currently).
    round: Optional[CCD_Round] = None
    epoch: Optional[CCD_Epoch] = None

Note that we have added the property transaction_hashes to the block class, to enable indexing transactions and blocks together. Finally, when a finalized block arrives, we store the block, the transactions and the special events.

How is a block stored in the system?

In the heartbeat service, all new finalized blocks are parsed and stored in the db.