Block
Block model overview
The Block class is a lightweight container for data blocks in SBS. It holds basic metadata, a list of transactions, and optional fields used by higher layers (e.g., consensus name, extra metadata). The model is intentionally simple and avoids protocol-specific logic.
Key fields
depth(int): Height of the block in the local chain (genesis at 0)id(int): Unique block identifierprevious(int): ID of the parent blocktime_created(float): Creation timetime_added(float): Time the block is appended to the local chainminer(int): ID of the block proposer/creatortransactions(list): Included transactionssize(float): Serialized size used by the network layerconsensus(str|None): Consensus protocol label for provenanceextra_data(dict): Free-form metadata (e.g.,round,configuration_depth)
Constructors and helpers
copy(): Returns a deep copy of the block, includingextra_dataandtime_added.genesis_block(): Creates the genesis block at depth 0 with a random ID and setsextra_data["round"] = -1so nodes starting at round 0 initialise correctly.
String forms
__str__: Human-readable summary with id, depth, proposer, times, size, parent, and consensus name__repr__: Compact representation~block: {id}~
In summary, Block provides a clear, minimal data structure for chain operations and network sizing.