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_max_height()
# 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.10-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 418c294a5bc18e3c5bd2827adca1ecb8266f6356c74a4d62e0a9276512f3abfd |
|
MD5 | cf74299f141b4a79c5fe3e64f2fade80 |
|
BLAKE2b-256 | ade8b537a7d0c825e02a0ed71747ba0a5b96d3e2534d655f06cb559d9c87ec15 |
Hashes for bitcoin_explorer-1.2.10-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c804c0e93760fc1a3abbc305ad1a7f3596f7ca8d1b51fed7299b7b9bbb0ff9ae |
|
MD5 | 87e658f71c1efdeeda0712bf56c05cf3 |
|
BLAKE2b-256 | 0668e9fa84024c2b4d3b7cefa3b1858f52ac6b6f49776de4bf00711624d5d1a0 |
Hashes for bitcoin_explorer-1.2.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10091ec3e0b88663ea704ead6a0e6a2057016bf99a8da9d97c4df9faca1d6129 |
|
MD5 | 2db25117109de289d313a352784e0fc2 |
|
BLAKE2b-256 | f7c402fd4029d32dd4541f2d63fd88646760e12f1447f6773deac01d30f27939 |
Hashes for bitcoin_explorer-1.2.10-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84c94afd46ca0d4e9113ef1a4b32c2aa2cecb9ca1a6a4c21f0ff076ef545f7fa |
|
MD5 | 54eea09781ef2d5f657e690f774a0d2e |
|
BLAKE2b-256 | cf1373cb45f28c8f744e408f0fdb13e29e72ee2a104c0774a8a1925db642d8c0 |
Hashes for bitcoin_explorer-1.2.10-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d702aac141ec12a07bea9151854c69b1e4159f2637d37a1a4c7c1355522d602 |
|
MD5 | ad9408e6803cbc97e725022596313baf |
|
BLAKE2b-256 | 5d0dbd90b9d80835da0b2e72fa023bdd68e4c02474e04a511875b6825f632825 |
Hashes for bitcoin_explorer-1.2.10-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91d73fd561340120b110ee578f5f43620baed92cc6624055c526f7de2db5d84 |
|
MD5 | 60e10179553e706b45f5d7d1a0743812 |
|
BLAKE2b-256 | bcf06e40a7e51cbc07e5ed2a0d867a4e5679c7c3264f17a82ed0f6cf98ff3ebc |
Hashes for bitcoin_explorer-1.2.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf0f53dfe405cd059a092b44bc1434da088a1ff2402ed55667a67f22fc55ccb4 |
|
MD5 | dd363e79f8b70294126047d76f269186 |
|
BLAKE2b-256 | 9b0207ce53be2f34005428098f7473f4bd409eecf0727ec35fe71d2b2d24a164 |
Hashes for bitcoin_explorer-1.2.10-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64eb529613ba9b926db6812131d127c2a427df0593a9b4bb10b283ac1c5e917e |
|
MD5 | b659d6d729115bf4f7b76a71e6eb1ca0 |
|
BLAKE2b-256 | 3ec28a8dd54e3040ca1302134537ba557ec6847d24d8fbc644494e6da485cf3a |
Hashes for bitcoin_explorer-1.2.10-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 605e4b2a50c0191c7be111c8576b06ffd4e6a717c1d5e54ff6f9784bd5afedc5 |
|
MD5 | 88b629ce729a819fcbbd7432869008dc |
|
BLAKE2b-256 | 484fab6546633e207152c3091eb8bc51222d9231994f6f8d36256051e0484896 |
Hashes for bitcoin_explorer-1.2.10-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbee6bf02368e4a20db5cbd497d22bddd25994c0051d6abbc82570bfe50be8f1 |
|
MD5 | 832f20e4eb9f066b479d548c9c4d9ee4 |
|
BLAKE2b-256 | 91ca9533d4f935792daf4bfd68c061b8978c6dfff3c67cc1eb2d1935cb1fefe3 |
Hashes for bitcoin_explorer-1.2.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e34e0d96e5ea93b769aacb9670dcb7f073e6278547bba8738732e8c84b180a0 |
|
MD5 | 6361cb52de691473c950794e73f6c7dd |
|
BLAKE2b-256 | 474ae0919261126beb51ddf2b6357476450b0e3574de505ba022bda7068be19d |
Hashes for bitcoin_explorer-1.2.10-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67d4d0f4eab78df7c7b73626bd2eddf9a0fdc0fe4e9567f5044feedee60290eb |
|
MD5 | 03b1f7ff3f61e5d2e5fa2ae4595e58dc |
|
BLAKE2b-256 | a0b45f8c35d8486ae239f1f595458fc76ffc167113ef46c68c1b9ca8ab427502 |
Hashes for bitcoin_explorer-1.2.10-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ed944ff843d53c90c13ec926a2945a964376fe265f299e32e5b38577405951a |
|
MD5 | 319afeb97ce3ea83499b421de8ef4f29 |
|
BLAKE2b-256 | c30df3ca3198f51b19675380cac577696bebc0668ccc1f40b741a17161d381bf |
Hashes for bitcoin_explorer-1.2.10-cp37-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d5e250e8e6b41a12c7f86ae9807a5137664362e707bec64e418c628b3c9a93 |
|
MD5 | 8c20244027bd8093ecc1e62fa27a0216 |
|
BLAKE2b-256 | 23014f0ab60dea58c121bc791c535e31d9938944624a046daf3ca67c001dc5aa |
Hashes for bitcoin_explorer-1.2.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5736f000d2142d452b3e28c8ce2c14ac59f54d9653bebd6879f398d5a1f170d |
|
MD5 | 29978fddf8ce9c4897b623c302e7c2c6 |
|
BLAKE2b-256 | 6d660f7e253dc773af040b3845b4b3857d94ee82d25d3f0850ffe3df277983c4 |
Hashes for bitcoin_explorer-1.2.10-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ec62f0e8253060d43f679eab2af2806ab7f11aa48a3e5da351d887e931264c3 |
|
MD5 | 0eba773c75eb66be560db69292c24704 |
|
BLAKE2b-256 | 08003466d20018724f8a574bddef9d69920e050722e3da59aa201a02e3428de3 |
Hashes for bitcoin_explorer-1.2.10-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b263213a523c7d6ba9cc10412ed219052ae9ebd551e19bff65746257e74ce3 |
|
MD5 | 063432312a958f332aaba51259a6ee12 |
|
BLAKE2b-256 | ba534900fe4fce8b864b616251a63364a1a62eb7644cd48225e5cce511818804 |
Hashes for bitcoin_explorer-1.2.10-cp36-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ac4b8a60448fff2e7d31da879eab07733a7112991ff74263514876c1cdda98f |
|
MD5 | 6145d04ddf02a7350a20a8168730831c |
|
BLAKE2b-256 | 96e9adb782e78ad49c1df06c72aba10ace4353428bb1edb03b925077ef3f64e9 |
Hashes for bitcoin_explorer-1.2.10-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 227074f6ff1dd70d26fa35db4a77892e7f006d26235c492ad11907d4dbf6c2c6 |
|
MD5 | 35fdc3997afca4a9112900ce4bb011b1 |
|
BLAKE2b-256 | be2e7bee6f15f51fc9e776c342a157f1877549becb3319763e9f6cb44bce3cee |
Hashes for bitcoin_explorer-1.2.10-cp36-cp36m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6469aa39d5f251f2d41c5b98d878794d205417425c3c61e2394978f015d9307 |
|
MD5 | 999bf19157d925e83c6ee486f65b0f9b |
|
BLAKE2b-256 | e0cb9e3a632802bb7a8fd705ea91e0452a9734ffaa275dbfb8c3e4cedb1e90ea |