[#CBlock] = CBlock :mrdocs: A full block, extending the header with its transactions and cached check flags. == Synopsis Declared in `<primitives/block.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class CBlock : public xref:CBlockHeader.adoc[CBlockHeader] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:CBlockHeader.adoc[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 [cols="1,4"] |=== | Name| Description | xref:CBlock/2constructor-06.adoc[`CBlock`] [.small]#[constructor]# | Constructors | xref:CBlockHeader/GetBlockTime.adoc[`GetBlockTime`] | Returns the block creation time. | xref:CBlockHeader/GetHash.adoc[`GetHash`] | Computes the block hash by hashing the serialized header. | xref:CBlockHeader/IsNull.adoc[`IsNull`] | Returns true when the header has no proof‐of‐work target set. | xref:CBlock/SetNull.adoc[`SetNull`] | Resets the block to its null state, clearing transactions and cached flags. | xref:CBlockHeader/Time.adoc[`Time`] | Returns the block time as a chrono time point. | xref:CBlock/ToString.adoc[`ToString`] | Returns a human‐readable description of the block. |=== == Static Member Functions [cols="1"] |=== | Name | xref:CBlock/Ser-06.adoc[`Ser`] | xref:CBlock/Unser-0e3.adoc[`Unser`] |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:CBlock/fChecked.adoc[`fChecked`] | Cached result of CheckBlock() for this block. | xref:CBlockHeader/hashMerkleRoot.adoc[`hashMerkleRoot`] | Merkle root of the transactions in the block. | xref:CBlockHeader/hashPrevBlock.adoc[`hashPrevBlock`] | Hash of the previous block header in the chain. | xref:CBlock/m_checked_merkle_root.adoc[`m_checked_merkle_root`] | Cached result of the Merkle root check for this block. | xref:CBlock/m_checked_witness_commitment.adoc[`m_checked_witness_commitment`] | Cached result of the witness commitment check for this block. | xref:CBlockHeader/nBits.adoc[`nBits`] | Compact representation of the proof‐of‐work difficulty target. | xref:CBlockHeader/nNonce.adoc[`nNonce`] | Nonce varied during mining to satisfy the proof‐of‐work target. | xref:CBlockHeader/nTime.adoc[`nTime`] | Block creation time, as a Unix timestamp in seconds. | xref:CBlockHeader/nVersion.adoc[`nVersion`] | Block version number, signaling supported consensus rules. | xref:CBlock/vtx.adoc[`vtx`] | Transactions contained in the block, in order. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BlockMerkleRoot.adoc[`BlockMerkleRoot`] | Compute the Merkle root of the transactions in a block. *mutated is set to true if a duplicated subtree was found. | xref:BlockWitnessMerkleRoot.adoc[`BlockWitnessMerkleRoot`] | Compute the Merkle root of the witness transactions in a block. | xref:CheckBlock.adoc[`CheckBlock`] | Context‐independent validity checks. | xref:CheckSignetBlockSolution.adoc[`CheckSignetBlockSolution`] | Extract signature and check whether a block has a valid solution | xref:DecodeHexBlk.adoc[`DecodeHexBlk`] | Decode a hex‐encoded serialized block. | xref:DecodeHexBlockHeader.adoc[`DecodeHexBlockHeader`] | Decode a hex‐encoded serialized block header. | xref:GetBlockProof-03.adoc[`GetBlockProof`] | Compute how much work a block header corresponds to. | xref:GetWitnessCommitmentIndex.adoc[`GetWitnessCommitmentIndex`] | Compute at which vout of the block's coinbase transaction the witness commitment occurs, or ‐1 if not found | xref:IsBlockMutated.adoc[`IsBlockMutated`] | Check if a block has been mutated (with respect to its merkle root and witness commitments). | xref:TransactionMerklePath.adoc[`TransactionMerklePath`] | Compute merkle path to the specified transaction | xref:node/AddMerkleRootAndCoinbase.adoc[`node::AddMerkleRootAndCoinbase`] | Insert the coinbase transaction and compute the merkle root of a block. | xref:node/RegenerateCommitments.adoc[`node::RegenerateCommitments`] | Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed | xref:node/UpdateTime.adoc[`node::UpdateTime`] | Update a block header's time field and return the new time. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#