pub struct BlockHeader {
    pub version: u32,
    pub prev_blockhash: Sha256dHash,
    pub merkle_root: Sha256dHash,
    pub time: u32,
    pub bits: u32,
    pub nonce: u32,
}
Expand description

A block header, which contains all the block’s information except the actual transactions

Fields

version: u32

The protocol version. Should always be 1.

prev_blockhash: Sha256dHash

Reference to the previous block in the chain

merkle_root: Sha256dHash

The root hash of the merkle tree of transactions in the block

time: u32

The timestamp of the block, as claimed by the miner

bits: u32

The target value below which the blockhash must lie, encoded as a a float (with well-defined rounding, of course)

nonce: u32

The nonce, selected to obtain a low enough blockhash

Implementations

Computes the target [0, T] that a blockhash must land in to be valid

Computes the target value in float format from Uint256 format.

Compute the popular “difficulty” measure for mining

Performs an SPV validation of a block, which confirms that the proof-of-work is correct, but does not verify that the transactions are valid or encoded correctly.

Returns the total work of the block

Trait Implementations

Produces a Sha256dHash which can be used to refer to the object
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Decode an object with a well-defined format
Encode an object with a well-defined format
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more