Crates.io | utxo_detective_block_header |
lib.rs | utxo_detective_block_header |
version | 0.1.0 |
source | src |
created_at | 2024-12-04 04:29:20.92853 |
updated_at | 2024-12-04 04:29:20.92853 |
description | Bitcoin block header parsing, validation, and utilities for blockchain analysis |
homepage | |
repository | |
max_upload_size | |
id | 1471041 |
size | 10,801 |
A Rust library for working with Bitcoin block headers.
This package provides functionality for working with Bitcoin block headers, following the standard Bitcoin protocol specification.
A Bitcoin block header consists of 80 bytes containing:
Add this to your Cargo.toml
:
[dependencies]
block_header = { version = "0.1.0", path = "utxo_detective_block_header" }
use block_header::BlockHeader;
// Create a block header from raw bytes
let header_bytes: [u8; 80] = [/* ... */];
let header = BlockHeader::new(&header_bytes)?;
// Access header data
let version = header.version();
let prev_block = header.prev_blockhash();
let prev_block_hex = header.prev_blockhash_hex();
let merkle_root = header.merkle_root();
let merkle_root_hex = header.merkle_root_hex();
let timestamp = header.time();
let bits = header.bits();
let bits_hex = header.bits_hex();
let nonce = header.nonce();
// Calculate and access the block hash
let blockhash = header.blockhash();
let blockhash_hex = header.blockhash_hex();
This project is licensed under the MIT License.