[#CBlockHeader]
= CBlockHeader
:mrdocs:

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

== Synopsis

Declared in `&lt;primitives&sol;block&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CBlockHeader;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CBlockHeader/2constructor.adoc[`CBlockHeader`]         [.small]#[constructor]#
| Constructs a null block header&period;
| xref:CBlockHeader/GetBlockTime.adoc[`GetBlockTime`] 
| Returns the block creation time&period;
| xref:CBlockHeader/GetHash.adoc[`GetHash`] 
| Computes the block hash by hashing the serialized header&period;
| xref:CBlockHeader/IsNull.adoc[`IsNull`] 
| Returns true when the header has no proof&hyphen;of&hyphen;work target set&period;
| xref:CBlockHeader/SetNull.adoc[`SetNull`] 
| Resets all header fields to their null state&period;
| xref:CBlockHeader/Time.adoc[`Time`] 
| Returns the block time as a chrono time point&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CBlockHeader/hashMerkleRoot.adoc[`hashMerkleRoot`] 
| Merkle root of the transactions in the block&period;
| xref:CBlockHeader/hashPrevBlock.adoc[`hashPrevBlock`] 
| Hash of the previous block header in the chain&period;
| xref:CBlockHeader/nBits.adoc[`nBits`] 
| Compact representation of the proof&hyphen;of&hyphen;work difficulty target&period;
| xref:CBlockHeader/nNonce.adoc[`nNonce`] 
| Nonce varied during mining to satisfy the proof&hyphen;of&hyphen;work target&period;
| xref:CBlockHeader/nTime.adoc[`nTime`] 
| Block creation time, as a Unix timestamp in seconds&period;
| xref:CBlockHeader/nVersion.adoc[`nVersion`] 
| Block version number, signaling supported consensus rules&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:DecodeHexBlockHeader.adoc[`DecodeHexBlockHeader`]
| Decode a hex&hyphen;encoded serialized block header&period;
| xref:GetBlockProof-03.adoc[`GetBlockProof`]
| Compute how much work a block header corresponds to&period;
| xref:node/UpdateTime.adoc[`node&colon;&colon;UpdateTime`]
| Update a block header&apos;s time field and return the new time&period;
|===

== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:CBlock.adoc[`CBlock`] 
| A full block, extending the header with its transactions and cached check flags&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
