BlockHeader

scalus.cardano.ledger.BlockHeader
case class BlockHeader(headerBody: BlockHeaderBody, bodySignature: ByteString)

Represents a block header in Cardano

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def blockNumber: Long

Get block number

Get block number

Attributes

def prevHash: Option[BlockHash]

Get previous block hash

Get previous block hash

Attributes

def slot: Long

Get slot number

Get slot number

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

lazy val hash: BlockHash

The block hash: blake2b-256 of the header CBOR, as Cardano names a block.

The block hash: blake2b-256 of the header CBOR, as Cardano names a block.

It hashes a re-encoding of the decoded header, since BlockHeader keeps no original bytes (it is not KeepRaw). That gives the hash of the original bytes only when the header was encoded canonically, as the node encodes a Praos header and as this encoder writes it. A header with another encoding of the same values would get a different hash. BlockHashTest checks the hash against two mainnet blocks, spec [TE-11].

Attributes