pub struct Block {
    pub header: BlockHeader,
    pub txdata: Vec<Transaction>,
}
Expand description

Bitcoin block.

A collection of transactions with an attached proof of work.

See Bitcoin Wiki: Block for more information.

Bitcoin Core References

Fields

header: BlockHeader

The block header

txdata: Vec<Transaction>

List of transactions contained in the block

Implementations

Returns the block hash.

check if merkle root of header matches merkle root of the transaction list

Checks if witness commitment in coinbase matches the transaction list.

Computes the transaction merkle root.

👎 Deprecated since 0.28.0:

Please use block::compute_merkle_root instead.

Calculate the transaction merkle root.

Computes the witness commitment for the block’s transaction list.

Computes the merkle root of transactions hashed for witness.

👎 Deprecated since 0.28.0:

Please use block::size instead.

Returns the size of the block.

Returns the size of the block.

size == size of header + size of encoded transaction count + total size of transactions.

👎 Deprecated since 0.28.0:

Please use transaction::strippedsize instead.

Returns the strippedsize of the block.

Returns the strippedsize of the block.

👎 Deprecated since 0.28.0:

Please use transaction::weight instead.

Returns the weight of the block.

Returns the weight of the block.

Returns the coinbase transaction, if one is present.

Returns the block height, as encoded in the coinbase transaction according to BIP34.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Decode Self from a size-limited reader. Read more

Decode an object with a well-defined format. Read more

Deserialize this value from the given Serde deserializer. Read more

Encode an object with a well-defined format. Returns the number of bytes written on success. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. 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.

Calls U::from(self).

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

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.