BlockHeader class

BlockHeader defines information about a block and is used in the bitcoin block (MsgBlock) and headers (MsgHeaders) messages.

Constructors

BlockHeader({required int version, required Hash prevBlock, required Hash merkleRoot, required DateTime timestamp, required int bits, required int nonce})
Creates a new BlockHeader with the specified fields.
const
BlockHeader.deserialize(Uint8List data)
Deserializes a block header from bytes using Bitcoin protocol encoding.
factory
BlockHeader.genesis({int version = 1, Hash? prevBlock, Hash? merkleRoot, DateTime? timestamp, int bits = 0x1d00ffff, int nonce = 0})
Creates a BlockHeader from a genesis block configuration.
factory

Properties

bits int
Difficulty target for the block.
final
hashCode int
Hash code implementation.
no setteroverride
merkleRoot Hash
Merkle tree reference to hash of all transactions for the block.
final
nonce int
Nonce used to generate the block.
final
prevBlock Hash
Hash of the previous block header in the block chain.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp DateTime
Time the block was created. This is encoded as a uint32 on the wire and therefore is limited to 2106.
final
version int
Version of the block. This is not the same as the protocol version.
final

Methods

blockHash() Hash
Computes the block identifier hash for this block header.
copyWith({int? version, Hash? prevBlock, Hash? merkleRoot, DateTime? timestamp, int? bits, int? nonce}) BlockHeader
Creates a copy of this block header with optional field overrides.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize() Uint8List
Serializes the block header to bytes using Bitcoin protocol encoding.
toString() String
Returns a string representation of the block header.
override

Operators

operator ==(Object other) bool
Equality operator.
override