Struct floresta_cli::rpc_types::GetBlockRes
source · pub struct GetBlockRes {Show 19 fields
pub hash: String,
pub confirmations: u32,
pub strippedsize: usize,
pub size: usize,
pub weight: usize,
pub height: u32,
pub version: i32,
pub version_hex: String,
pub merkleroot: String,
pub tx: Vec<String>,
pub time: u32,
pub mediantime: u32,
pub nonce: u32,
pub bits: String,
pub difficulty: u128,
pub chainwork: String,
pub n_tx: usize,
pub previousblockhash: String,
pub nextblockhash: Option<String>,
}
Expand description
A full bitcoin block, returned by get_block
Fields§
§hash: String
This block’s hash.
confirmations: u32
How many blocks have been added to the chain, after this one have been found. This is inclusive, so it starts with one when this block is the latest. If another one is found, then it increments to 2 and so on…
strippedsize: usize
The size of this block, without the witness
size: usize
This block’s size, with the witness
weight: usize
This block’s weight.
Data inside a segwit block is counted differently, ‘base data’ has a weight of 4, while witness only counts 1. This is (3 * base_size) + size
height: u32
How many blocks there are before this block
version: i32
This block’s version field
Currently, blocks have version 2 (see BIP34), but it may also flip some of the LSB for
either consensus reason (see BIPs 8 and 9) or for version rolling mining, usually bits
after the 24th are not touched. Therefore, the actual version is likelly the result of
version & ~(1 << 24).
This is encoded as a number, see version_hex
for a hex-encoded version
version_hex: String
Same as version
by hex-encoded
merkleroot: String
This block’s merkle root
A Merkle Tree is a binary tree where every leaf is some data, and the branches are pairwise hashes util reaching the root. This allows for compact proof of inclusion in the original set. This merkle tree commits to the txid of all transactions in a block, and is used by some light clients to determine whether a transaction is in a given block
tx: Vec<String>
A list of hex-encoded transaction id for the tx’s in this block
time: u32
The timestamp commited to in this block’s header
Since there’s no central clock that can tell time precisely in Bitcoin, this value is
reported by miners and only constrained by a couple of consensus rules. More sensibly, it
is not garanteed to be monotonical. So a block n might have a lower timestamp than
block n - 1
.
If you need it to be monotonical, see mediantime
insted
mediantime: u32
The meadian of the last 11 blocktimes.
This is a monotonically increasing number that bounds how old a block can be. Blocks may
not have a timestamp less than the current mediantime
. This is also used in relative
timelocks.
nonce: u32
The nonce used to mine this block.
Blocks are mined by increasing this value until you find a hash that is less than a network defined target. This number has no meaning in itself and is just a random u32.
bits: String
Bits is a compact representation for the target.
This is a exponential format (with well-define rouding) used by openssl that Satoshi decided to make consensus critical :/
difficulty: u128
The difficulty is derived from the current target and is defined as how many hashes, on average, one has to make before finding a valid block
This is computed as 1 / (target / 2 ^ 256). In most softwares (this one inclued) the difficulty is a multiple of the smallest possible difficulty. So to find the actual difficulty you have to multiply this by the min_diff. For mainnet, mindiff is 2 ^ 32
chainwork: String
Commullative work in this network
This is a estimate of how many hashes the network has ever made to produce this chain
n_tx: usize
How many transactions in this block
previousblockhash: String
The hash of the block comming before this one
nextblockhash: Option<String>
The hash of the block comming after this one, if any