1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{BlockHash, Height, Timestamp, Weight};
/// Block information matching mempool.space /api/block/{hash}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct BlockInfo {
/// Block hash
pub id: BlockHash,
/// Block height
pub height: Height,
/// Block version
pub version: u32,
/// Block timestamp (Unix time)
pub timestamp: Timestamp,
/// Compact target (bits)
pub bits: u32,
/// Nonce
pub nonce: u32,
/// Block difficulty
pub difficulty: f64,
/// Merkle root of the transaction tree
pub merkle_root: String,
/// Number of transactions
pub tx_count: u32,
/// Block size in bytes
pub size: u64,
/// Block weight in weight units
pub weight: Weight,
/// Previous block hash
#[serde(rename = "previousblockhash")]
pub previous_block_hash: BlockHash,
/// Median time of the last 11 blocks
#[serde(rename = "mediantime")]
pub median_time: Timestamp,
}