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<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
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<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
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<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Decodes an instance of the message from a buffer. Read more
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.source§impl PartialEq for Block
impl PartialEq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations§
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