Struct bitcoin::blockdata::block::BlockHeader
[−]
[src]
pub struct BlockHeader { pub version: u32, pub prev_blockhash: Sha256dHash, pub merkle_root: Sha256dHash, pub time: u32, pub bits: u32, pub nonce: u32, }
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 mainer
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
Methods
impl BlockHeader
[src]
fn target(&self) -> Uint256
Computes the target [0, T] that a blockhash must land in to be valid
fn spv_validate(&self, required_target: &Uint256) -> Result<(), Error>
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.
fn work(&self) -> Uint256
Returns the total work of the block
Trait Implementations
impl Debug for BlockHeader
[src]
impl Clone for BlockHeader
[src]
fn clone(&self) -> BlockHeader
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Eq for BlockHeader
[src]
impl PartialEq for BlockHeader
[src]
fn eq(&self, __arg_0: &BlockHeader) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BlockHeader) -> bool
This method tests for !=
.
impl Copy for BlockHeader
[src]
impl BitcoinHash for BlockHeader
[src]
fn bitcoin_hash(&self) -> Sha256dHash
Produces a Sha256dHash which can be used to refer to the object
impl<S: SimpleEncoder> ConsensusEncodable<S> for BlockHeader
[src]
fn consensus_encode(&self, s: &mut S) -> Result<(), S::Error>
Encode an object with a well-defined format
impl<D: SimpleDecoder> ConsensusDecodable<D> for BlockHeader
[src]
fn consensus_decode(d: &mut D) -> Result<BlockHeader, D::Error>
Decode an object with a well-defined format