Block Model
An introduction and overview of the VeChainThor blockchain block model.
VeChainThor defines a block in Golang as:
// block.go
type Block struct {
header *Header
txs tx.Transactions
}
type Header struct {
body headerBody
}
type headerBody struct {
ParentID thor.Bytes32
Timestamp uint64
GasLimit uint64
Beneficiary thor.Address
GasUsed uint64
BaseFee *big.Int
TotalScore uint64
TxsRoot thor.Bytes32
StateRoot thor.Bytes32
ReceiptsRoot thor.Bytes32
Signature []byte
Alpha []byte
COM bool
}
type Transactions []*Transaction
Fields within the headerBody
, , are defined as:
ParentID
- the ID of the parent blockTimestamp
- the block timeGasLimit
- the maximum amount of gas that all transactions inside the block are allowed to consumeBeneficiary
- the address assigned by the block generator to receive reward (in VTHO)GasUsed
- the actual amount of gas used within the blockBaseFee
- the mandatory minimum fee required for including a transaction within the blockTotalScore
- the accumulated witness number of the chain branch headed by the block. See Trunk for more detail.TxsRoot
- root hash of the transaction in the payloadStateRoot
- root hash for the global state after applying changes in this blockReceiptsRoot
- hash of the transaction receipts trieSignature
- signature of block builderAlpha
- an input into the Verifiable Random Function (VRF)COM
- a boolean indicating whether the packer votes commit
The block ID (thor.Bytes32
) can be computed as:
where is the block number stored as a uint32
and the operation that discards the first four bytes.
Last updated
Was this helpful?