Skip to main content

High Performance Blockchain Deserializer

Reason this release was yanked:

macos universal py36 bad wheel

Project description

bitcoin-explorer

CI PyPI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

bitcoin_explorer-1.2.6-cp310-none-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

bitcoin_explorer-1.2.6-cp310-none-win32.whl (1.8 MB view hashes)

Uploaded CPython 3.10 Windows x86

bitcoin_explorer-1.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bitcoin_explorer-1.2.6-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.8 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

bitcoin_explorer-1.2.6-cp39-none-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

bitcoin_explorer-1.2.6-cp39-none-win32.whl (1.8 MB view hashes)

Uploaded CPython 3.9 Windows x86

bitcoin_explorer-1.2.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bitcoin_explorer-1.2.6-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.8 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

bitcoin_explorer-1.2.6-cp38-none-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

bitcoin_explorer-1.2.6-cp38-none-win32.whl (1.8 MB view hashes)

Uploaded CPython 3.8 Windows x86

bitcoin_explorer-1.2.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

bitcoin_explorer-1.2.6-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.8 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

bitcoin_explorer-1.2.6-cp37-none-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.7 Windows x86-64

bitcoin_explorer-1.2.6-cp37-none-win32.whl (1.8 MB view hashes)

Uploaded CPython 3.7 Windows x86

bitcoin_explorer-1.2.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

bitcoin_explorer-1.2.6-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.8 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

bitcoin_explorer-1.2.6-cp36-none-win_amd64.whl (2.0 MB view hashes)

Uploaded CPython 3.6 Windows x86-64

bitcoin_explorer-1.2.6-cp36-none-win32.whl (1.8 MB view hashes)

Uploaded CPython 3.6 Windows x86

bitcoin_explorer-1.2.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

bitcoin_explorer-1.2.6-cp36-cp36m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (4.8 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page