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

Synopsis

Declared in <primitives/block.h>

class CBlock
    : public CBlockHeader

Base Classes

Name

Description

CBlockHeader

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.

Member Functions

Name

Description

CBlock [constructor]

Constructors

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 the block to its null state, clearing transactions and cached flags.

Time

Returns the block time as a chrono time point.

ToString

Returns a human‐readable description of the block.

Static Member Functions

Name

Ser

Unser

Data Members

Name

Description

fChecked

Cached result of CheckBlock() for this block.

hashMerkleRoot

Merkle root of the transactions in the block.

hashPrevBlock

Hash of the previous block header in the chain.

m_checked_merkle_root

Cached result of the Merkle root check for this block.

m_checked_witness_commitment

Cached result of the witness commitment check for this block.

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.

vtx

Transactions contained in the block, in order.

Non-Member Functions

Name

Description

BlockMerkleRoot

Compute the Merkle root of the transactions in a block. *mutated is set to true if a duplicated subtree was found.

BlockWitnessMerkleRoot

Compute the Merkle root of the witness transactions in a block.

CheckBlock

Context‐independent validity checks.

CheckSignetBlockSolution

Extract signature and check whether a block has a valid solution

DecodeHexBlk

Decode a hex‐encoded serialized block.

DecodeHexBlockHeader

Decode a hex‐encoded serialized block header.

GetBlockProof

Compute how much work a block header corresponds to.

GetWitnessCommitmentIndex

Compute at which vout of the block's coinbase transaction the witness commitment occurs, or ‐1 if not found

IsBlockMutated

Check if a block has been mutated (with respect to its merkle root and witness commitments).

TransactionMerklePath

Compute merkle path to the specified transaction

node::AddMerkleRootAndCoinbase

Insert the coinbase transaction and compute the merkle root of a block.

node::RegenerateCommitments

Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed

node::UpdateTime

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

Created with MrDocs