Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce values to make the block's hash satisfy proof‐of‐work requirements. When they solve the proof‐of‐work, they broadcast the block to everyone and the block is added to the block chain. The first transaction in the block is a special one that creates a new coin owned by the creator of the block.

Synopsis

Declared in <primitives/block.h>

class CBlockHeader;

Member Functions

Name

Description

CBlockHeader [constructor]

Constructs a null block header.

GetBlockTime

Returns the block creation time.

GetHash

Computes the block hash by hashing the serialized header.

IsNull

Returns true when the header has no proof‐of‐work target set.

SetNull

Resets all header fields to their null state.

Time

Returns the block time as a chrono time point.

Data Members

Name

Description

hashMerkleRoot

Merkle root of the transactions in the block.

hashPrevBlock

Hash of the previous block header in the chain.

nBits

Compact representation of the proof‐of‐work difficulty target.

nNonce

Nonce varied during mining to satisfy the proof‐of‐work target.

nTime

Block creation time, as a Unix timestamp in seconds.

nVersion

Block version number, signaling supported consensus rules.

Non-Member Functions

Name

Description

DecodeHexBlockHeader

Decode a hex‐encoded serialized block header.

GetBlockProof

Compute how much work a block header corresponds to.

node::UpdateTime

Update a block header's time field and return the new time.

Derived Classes

Name

Description

CBlock

A full block, extending the header with its transactions and cached check flags.

Created with MrDocs