Crate bitcoin_explorer[−][src]
Expand description
Introduction
This library is designed for efficient and massive deserialization of the binary Bitcoin Core block files.
It decodes all transactions, addresses, script types, connects outpoints of inputs to outputs, to figure out input addresses.
This library allows efficient and versatile reading of all bitcoin transaction records. This is good for analysis and research on bitcoin trading behaviour.
Features
db.iter_connected_block()
uses in-memory UTXO cache by default,
which requires 32GB or more memory, but is very fast.
It can be configured to use on-disk UTXO cache for tracking
unspent transactions during iterations,
which usually requires less than 1GB memory.
By default, UTXO is stored on RAM, which requires 32GM memory
(it needs this much memory only for db.iter_connected_block()
)
[dependencies.bitcoin-explorer]
version = "1.2"
Enable on-disk UTXO cache if your memory is limited:
[dependencies.bitcoin-explorer]
version = "1.2"
features = ["on-disk-utxo"]
Guide to Feature
When you have a large memory (>= 32 GB), do not use on-disk-utxo
.
In-memory UTXO cache provides blazing fast speed (for iter_connected_block()
).
Use on-disk-utxo
only when your disk is limited.
Example
use bitcoin_explorer::BitcoinDB;
use std::path::Path;
let path = Path::new("/Users/me/bitcoin");
// launch without reading txindex
let db = BitcoinDB::new(path, false).unwrap();
// launch attempting to read txindex
let db = BitcoinDB::new(path, true).unwrap();
Re-exports
pub use crate::parser::block_index::BlockIndex;
pub use crate::parser::block_index::BlockIndexRecord;
pub use crate::parser::proto::connected_proto::BlockConnectable;
pub use crate::parser::proto::connected_proto::FConnectedBlock;
pub use crate::parser::proto::connected_proto::FConnectedTransaction;
pub use crate::parser::proto::connected_proto::SConnectedBlock;
pub use crate::parser::proto::connected_proto::SConnectedTransaction;
pub use crate::parser::proto::connected_proto::TxConnectable;
pub use crate::parser::proto::full_proto::FBlock;
pub use crate::parser::proto::full_proto::FBlockHeader;
pub use crate::parser::proto::full_proto::FTransaction;
pub use crate::parser::proto::full_proto::FTxOut;
pub use crate::parser::proto::simple_proto::SBlock;
pub use crate::parser::proto::simple_proto::SBlockHeader;
pub use crate::parser::proto::simple_proto::STransaction;
pub use crate::parser::proto::simple_proto::STxOut;
Modules
Structs
A Bitcoin address
This is the main struct of this crate!! Click and read the doc.
A Bitcoin block, which is a collection of transactions with an attached proof of work.
A bitcoin block hash.
A block header, which contains all the block’s information except the actual transactions
iterate through blocks according to array index.
iterate through blocks, and connecting outpoints.
A Bitcoin script
A Bitcoin transaction, which describes an authenticated movement of coins.
A bitcoin transaction hash/transaction ID.
Enums
The cryptocurrency to act on
Traits
Trait for objects that can be deserialized from hex strings
Trait for objects that can be serialized as hex strings
Functions
Extract addresses from a script public key.