High Performance Blockchain Deserializer
Project description
bitcoin-explorer
bitcoin_explorer
is an efficient library for reading
bitcoin-core binary blockchain file as a database (utilising multi-threading).
This package is ported using pyO3 from rust library bitcoin-explorer
Installation
MacOS, Windows, and Linux wheels are provided.
Use pip install bitcoin-explorer
to install.
Documentation
This library has a Rust version, go to Rust Documentation
For python documentation, go to Documentation.
Compatibility Note
This package deals with the binary file of another software Bitcoin Core
.
It might not be compatible with older Bitcoin Core versions.
Currently, it is compatible with Bitcoin Core version
Bitcoin Core version v0.21.1.0-g194b9b8792d9b0798fdb570b79fa51f1d1f5ebaf Copyright (C) 2009-2020 The Bitcoin Core developers
.
Examples
It contains one class BitcoinDB
.
import bitcoin_explorer as bex
# parse the same path as `--datadir` argument for `bitcoind`.
db = bex.BitcoinDB("~/Bitcoin")
# get the length of the longest chain currently on disk.
db.get_block_count()
# get block of a certain height
db.get_block(1000)
# to retrieve the connected outputs of each inputs as well.
# note that this is inefficient.
# Use `get_block_iter_range(end, connected=True)` for better performance.
db.get_block(1000, connected=True)
# get block hash of a certain height.
db.get_hash_from_height(1000)
# a fast method for getting just the header.
# in memory query, no disk access
db.get_block_header(1000)
# get block of height 1000.
db.get_height_from_hash("some hash")
# get transaction from txid.
# This queries the `levelDB` each time, thus it is relatively slow.
db.get_transaction("some txid")
# get the height of the block which this transaction belongs.
db.get_height_from_txid("some txid")
# get the script type and addresses from a script public key
db.parse_script("some hex script pubic key")
# use iterator
for block in db.get_block_iter_range(start=1000, end=2000):
do_something_with(block)
# use iterator, iterate over heights
for block in db.get_block_iter_array(heights=[1, 3, 5, 7, 9]):
do_something_with(block)
# use iterator, connect outpoints
# This requires 5 GB memory.
for block in db.get_block_iter_range(end=700000, connected=True):
do_something_with(block)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for bitcoin_explorer-1.2.15-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7a66b2d8949cd8ef14db8f0169c4d8c617f4a4fb2f885cb5ffd25f82412f6c8 |
|
MD5 | d7a7d0b1af3487416a8563d2e4125b15 |
|
BLAKE2b-256 | ea993c2e4735242f4c11c24ba15578fa8466c5e233db2a807ce48ef7292f8b2f |
Hashes for bitcoin_explorer-1.2.15-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11a472433140a585fae98990deaff14da177a27ef0b9506d0b51e826d55328a6 |
|
MD5 | 1a600de0f79ff39b362a7f553189aa93 |
|
BLAKE2b-256 | f599af0ac4de7ceef2b6b30e2d4a3b84568a36d3fc596ea97140fdf6999fc437 |
Hashes for bitcoin_explorer-1.2.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd1a2f82f3769ccd05df8337bec58b31652aed40efb4e2d497a48f4abeb521a0 |
|
MD5 | 9934cf9e2af77ef14d2ada28b7b5b090 |
|
BLAKE2b-256 | 5949474085b44f9d05dd0015fc8244a8fb7a45e8d13c5876d56ce74f9f022c38 |
Hashes for bitcoin_explorer-1.2.15-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c6a6190d6980b43f155b9275b9c02ada812a997f424542b25e1c807e26e2a4a |
|
MD5 | a8ae265995cb6dca52e0ab620c99f1da |
|
BLAKE2b-256 | 2ce7868650101ef11dcf8315a0075b19401de9d31b05558f73e4815fdf0d6ee7 |
Hashes for bitcoin_explorer-1.2.15-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17d1eacee8e1cd5806751679eb4934aece0c0982d71ea70b3f5a25efd4540e9e |
|
MD5 | 64bbe4bdd6e2fff08ca68eec9c729694 |
|
BLAKE2b-256 | 7b7c69e948f49402e80ffb85c845317991f427fb980d1848256391e0843f27c1 |
Hashes for bitcoin_explorer-1.2.15-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bae567cdd06149b1075154e9af1175d979dcfe257abd174b81e2a6510129fa8c |
|
MD5 | b04a43737b716405839bd648a295daf3 |
|
BLAKE2b-256 | 51540f2fd9713a46334d9c1952aab79948646e5618dabc0e3df4fa52490e54ec |
Hashes for bitcoin_explorer-1.2.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c113e85de918cde8e36b78d710eaa5e979634d067932465519b5a6d48751e5 |
|
MD5 | 1f1187f0080037d50ea1b869507eba27 |
|
BLAKE2b-256 | 0eb7d416abcc5670f7198337d8d2fd0cbc38e21716254993ab5063483c547e48 |
Hashes for bitcoin_explorer-1.2.15-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddcdab79f9bf0800e23fa21e21907762405ef8faedf5a1efa8da5b4851b290e0 |
|
MD5 | 5a30b0148cd6b0f830c0298ef004f877 |
|
BLAKE2b-256 | 1a995844d4a7915865e46c9193a69f79b1deba0b11756143fec3cbc9e38ba772 |
Hashes for bitcoin_explorer-1.2.15-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 589435a16c7250c8caddf3fb06057f676dd5e52f088160f1bc4dd51436604647 |
|
MD5 | 141d4b86139af9cc7cc38d46048658c8 |
|
BLAKE2b-256 | 52208d509f1c06983cb0126a4a52bc683f3a007b4b647a8349712da8cf2ea9c9 |
Hashes for bitcoin_explorer-1.2.15-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45891df9c4a60867118c13c55a098d01abde5c0fb9e4a3749007f10aa0e97c88 |
|
MD5 | 6296a90366fbbea8eed07244045173fc |
|
BLAKE2b-256 | 6690cdbbff4e5cb8a052c24d0e07c3d86626a7c99c4194b127ef1b2d4b317dfa |
Hashes for bitcoin_explorer-1.2.15-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9fab4531745e5625ca6803c440c4054ef1962f619603d89c5170213d9ecc43 |
|
MD5 | 47b9adba842fad9a34bc909e4c5119de |
|
BLAKE2b-256 | 2d5bc17084f9da7d0a404b362e53e6a32ca92c36eae3fe0ebdb73b7a6315d603 |
Hashes for bitcoin_explorer-1.2.15-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59e9354c6f220416f24b02494ac7a6d11b1b13044c65042c75a66237b48f0ed5 |
|
MD5 | ce00caf573a914452006ec23d2f2f3a5 |
|
BLAKE2b-256 | c455cc0e4f03fd5784c96d4c57bf6524df6ab3b91eb1f5d12f92302c287e85b1 |
Hashes for bitcoin_explorer-1.2.15-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc159d0d404ca15736452786ec4b5e951ab4de4e43e56ddb5e9f6f471a2cd460 |
|
MD5 | bf7433eccfca01a3b4bb0bf07f8f5964 |
|
BLAKE2b-256 | bb78ea5ce117d2f128571b551b52abee212e5cd032c9175792cdc79bfcb052e1 |
Hashes for bitcoin_explorer-1.2.15-cp37-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f7d5250c92e1a47238b6959905e1883faa07beafe2101f2016740cf600c55d7 |
|
MD5 | 50dbd93d8dd72dec7c6121651d38d9f3 |
|
BLAKE2b-256 | 8f6feffe34eca89007f69fe6228472f336b7d048bf1fd967d4a8010879d62f45 |
Hashes for bitcoin_explorer-1.2.15-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7eff65cd34e8ee0ab8b17e12a5ccfb7ad9b15c2b1416fb7f8c70acf7c7ddf0d |
|
MD5 | 19d63d88c73c9b27197d282b0bab65c2 |
|
BLAKE2b-256 | 6404e7e0bb67934d0efe3ffc7f53ceb711c5a7f0a448a38586626643dcc054cd |
Hashes for bitcoin_explorer-1.2.15-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c167302baeaa70240fa20e79a0c97b9e0ca2a1d150bd9347505fad5bdd677b1e |
|
MD5 | 82fb706a5a4f1a876a1a2e0907dec284 |
|
BLAKE2b-256 | 4d63e5ca6fd8431d32bb0587971edd2664232a652b302252309c180ef617f769 |
Hashes for bitcoin_explorer-1.2.15-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba4cdb90c1f569103a9d47efe5b1f4e20b5f05bda2a01ffc258859c37ef56563 |
|
MD5 | a303abd9a52577344d261482fea5f2c0 |
|
BLAKE2b-256 | ad049249e1f6668970234a55d7c287bafaa3f3c83a5560adc09cd49f0a8f2100 |
Hashes for bitcoin_explorer-1.2.15-cp36-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fbb64b11f2ff4de633437d7c4c0ca77bc1a823e43acb7fa0bf4af472e24c307 |
|
MD5 | 614a7bd25f9a73ecb414fe4fd0e7a702 |
|
BLAKE2b-256 | adb0080899764eb8c8de1ac9936fc8d7ecd65c8df402b6c3e92c8fbe430842d1 |
Hashes for bitcoin_explorer-1.2.15-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b428073a8556dd7c4d25e73894c0a4b2166ffd93744482e55cf106ab77bfb353 |
|
MD5 | 1f4071808771a7b621c2965faa02942d |
|
BLAKE2b-256 | 492d6bfc2707485d513e9cdeb34c6ac91a1d417cdaebe66f68d37cd0d1ab6bb7 |
Hashes for bitcoin_explorer-1.2.15-cp36-cp36m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c9afca50932915a519b2d7c52563182ba0ccea48000588a5dd388efe23afef6 |
|
MD5 | dcf945abb5320812f3a439801570eda9 |
|
BLAKE2b-256 | cc4cd9b67516c10ca6eb01d0eb9449f56601f0f0cc53736f270cfa3d8250a9fc |