pub struct Header {
pub version: Version,
pub prev_blockhash: BlockHash,
pub merkle_root: TxMerkleNode,
pub time: u32,
pub bits: CompactTarget,
pub nonce: u32,
}Expand description
Bitcoin block header.
Contains all the block’s information except the actual transactions, but including a root of a merkle tree commiting to all transactions in the block.
§Bitcoin Core References
Fields§
§version: VersionBlock version, now repurposed for soft fork signalling.
prev_blockhash: BlockHashReference to the previous block in the chain.
merkle_root: TxMerkleNodeThe root hash of the merkle tree of transactions in the block.
time: u32The timestamp of the block, as claimed by the miner.
bits: CompactTargetThe target value below which the blockhash must lie.
nonce: u32The nonce, selected to obtain a low enough blockhash.
Implementations§
Source§impl Header
impl Header
Sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Returns the block hash.
Sourcepub fn target(&self) -> Target
pub fn target(&self) -> Target
Computes the target (range [0, T] inclusive) that a blockhash must land in to be valid.
Sourcepub fn difficulty(&self) -> u128
pub fn difficulty(&self) -> u128
Computes the popular “difficulty” measure for mining.
Sourcepub fn difficulty_float(&self) -> f64
pub fn difficulty_float(&self) -> f64
Computes the popular “difficulty” measure for mining and returns a float value of f64.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Header
impl Ord for Header
Source§impl PartialOrd for Header
impl PartialOrd for Header
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more