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.4-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2fb1ee27a5fbc757a895bf0331c19d2e3b35bcc09960613d6ab6747d37eea1f |
|
MD5 | 89ef50cbd59b9164af9790124d0252eb |
|
BLAKE2b-256 | 2bca7edc3b8daf96e0a099af45f5b81094dc0c98bef0458c4fdc0d5ed8aadf92 |
Hashes for bitcoin_explorer-1.2.4-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b30fafa234134fea51a9271be37528d9c18821d494b33c53b021da0917dc3abc |
|
MD5 | 20f6b0d89f0094cac5ff43a0164f62b7 |
|
BLAKE2b-256 | f7ffb4a1e7d8e888c286a9ca081a850bfa794823479f20ebc83e842f23359c72 |
Hashes for bitcoin_explorer-1.2.4-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef568ce11f639470db5a3b26fa0fd6336da3bd36bf3ec72b830dbef497b4a8d |
|
MD5 | 0634c956d8be92708d39b80580f78595 |
|
BLAKE2b-256 | ef176ac80f6d9d5e36f261c9d7df8480f91d980bc084000786df034f63929d4e |
Hashes for bitcoin_explorer-1.2.4-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6ecbac16042ebb5c46a889f61c2c5fd569916e7e0b112bf86f1cc16704679ce |
|
MD5 | 34ceb2027db498dfa60487689c9b0b30 |
|
BLAKE2b-256 | 18c824785c19c5a355ad805782a4d32196a23027038e7637b956a8bb53be8035 |
Hashes for bitcoin_explorer-1.2.4-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fe0a35dee4c3f5cfbd72f0b7b35064124dbf4835c437299545b6e0d89735823 |
|
MD5 | a2d89b8c5ab0c6ddbd302ecfb1ff3ec0 |
|
BLAKE2b-256 | 98fa1d3a75225e80d215956870a1627dfc43f92b30844a07b55ab8004e9e1ee7 |
Hashes for bitcoin_explorer-1.2.4-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f324c9ea18d3222c7272837f917ed54fc5355eaefc24ce42fcda0c430c12c5d6 |
|
MD5 | e7e55ed6d0ba86e7bce3da9eed5f88a0 |
|
BLAKE2b-256 | 03ee4fddb61b9001b8bde6984da1a3424cb12d63ba816ffddaa847fadcfca38e |
Hashes for bitcoin_explorer-1.2.4-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54268d938b13a03d0ea0b5075296051ffd1190bc75cf2f8da4f5043a0ba0ad19 |
|
MD5 | 669a7769bd94b73d9cdf4e198d9f2892 |
|
BLAKE2b-256 | 56aa785e771abc664d6730fa4bb25e44b26537d66095c0a1d23c42216071b29a |
Hashes for bitcoin_explorer-1.2.4-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db61694e2da426adcccb1e06afd8110a91aaa9dd26754534a934286c1fd3369b |
|
MD5 | 18cc2b657f23932682ae5c9eeb001bc9 |
|
BLAKE2b-256 | bd58746fc7e4bb03c6295866c224d530307ce1acd34189d356fe222089d8758b |
Hashes for bitcoin_explorer-1.2.4-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96f7973da2c5288e7463882b39f7bb8b1ba56f2b7a17570c604c800b3180e465 |
|
MD5 | f3b213c4aa54b1ba820c715983f2c348 |
|
BLAKE2b-256 | 1e0981244efa020986c5a1d30ba853bc15c321c26b385043b14d43f3d735b3b4 |
Hashes for bitcoin_explorer-1.2.4-cp37-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b885776e4b40037382fafe0ed1359046b0722537b34fcf31714afef59324e545 |
|
MD5 | 47899d51227144cc37c77a293b0d3ea8 |
|
BLAKE2b-256 | 21fa791d406e2f8a5907b9287297bbc9d7eb8b66db1bd5295ccb57673fe6b1f7 |
Hashes for bitcoin_explorer-1.2.4-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 910cd86c0fd4ef432852498c4fe6539ae5b5d70fd4067cc5ca8dc54ed0daeaf4 |
|
MD5 | b101302204e8927d5a016f8e92439b01 |
|
BLAKE2b-256 | 07479744ffaeb74ddfba6a6f6117c5e63bca7f648fff44d77500e7a125ca2942 |
Hashes for bitcoin_explorer-1.2.4-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45f6f8708e5354d50fcf4258986930231a4964e0d2a45764dbff2cd224e33ae7 |
|
MD5 | 5f79f2a54d70307b4360f7fc7d7c60b3 |
|
BLAKE2b-256 | ed2d5c98689c824c4082a722473b21aca8e11a99fc1a23343d8925d49cef1782 |
Hashes for bitcoin_explorer-1.2.4-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 949deb04cf3968be72ec77e14095c29e74d22630d0114ba726f54d419da68174 |
|
MD5 | 23e5ee94597d584c4b52f9872b30649c |
|
BLAKE2b-256 | dd3b4970bdc5b8cc57c3511d0716edb3de1be89019a034f28b6ac4cecf255ce2 |
Hashes for bitcoin_explorer-1.2.4-cp36-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85e13e7565a08a5957fbc07150e48002d2b1cf72a2af8b0aa0715c503386a3df |
|
MD5 | fdf1879a6cbded1955c864d4226eeb93 |
|
BLAKE2b-256 | f3e4dc1853858eaa2ab738e1c3a95c2cc71ee73164cf38c1000354b2581f90be |
Hashes for bitcoin_explorer-1.2.4-cp36-cp36m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0a2ccc5f4c3fa9029921225b55459dc460f69008d0e4a9c77d21eefbb8870b7 |
|
MD5 | 948f8727fd598c9500f31e096ba17878 |
|
BLAKE2b-256 | f57e519b9816d551a5e2ebe6c513cca65c04c2a725a6db7fcc3fa4678851d8ca |
Hashes for bitcoin_explorer-1.2.4-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b29e9bfb927068df9ba6a5c98df7a99539f5af8d8363a2f4b884a2eea249ee8 |
|
MD5 | a53c5559150cde43e2d1e2bb28a41c4a |
|
BLAKE2b-256 | b58338aa0946daa83b0203e4fd0d4bf7820366378c8d4126bdabbb38c642469e |