pub struct Block {Show 17 fields
pub hash: String,
pub size: i32,
pub stripped_size: i32,
pub weight: i32,
pub height: i64,
pub version: i32,
pub version_hex: String,
pub merkle_root: String,
pub tx: Vec<Transaction>,
pub time: i64,
pub mediantime: i64,
pub nonce: u32,
pub bits: String,
pub difficulty: f64,
pub chainwork: String,
pub n_tx: u32,
pub previous_hash: String,
}Fields§
§hash: Stringthe block hash Bitcoin core reverses the byte order of the hash when printing it out has Hex, to prevent the end user from making a mistake we store it as a string directly
size: i32The block size
stripped_size: i32The block size excluding witness data
weight: i32The block weight as defined in BIP 141
height: i64The block height or index
version: i32The block version
version_hex: StringThe block version formatted in hexadecimal
merkle_root: StringThe merkle root
tx: Vec<Transaction>Transaction array
time: i64The block time expressed in UNIX epoch time
mediantime: i64The median block time expressed in UNIX epoch time
nonce: u32The nonce
bits: StringThe bits
difficulty: f64The difficulty
chainwork: StringExpected number of hashes required to produce the chain up to this block (in hex)
n_tx: u32The number of transactions in the block
previous_hash: StringThe hash of the previous block
Implementations§
Source§impl Block
impl Block
pub fn transactions(&self) -> impl Iterator<Item = &Transaction>
Trait Implementations§
Source§impl Message for Block
impl Message for Block
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
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