Skip to main content

reth-db-py

Python package allowing you to interact with the Reth DB via Python. Written with Rust and Pyo3.

This python wrapper can access node data 15x-30x faster than local RPC calls. Using this package, the most recent block hash can be retrieved in ~100μs on a local reth DB.

Test Suite Py Versions Test OS

Installation

This package has been published to PyPi and can be installed using pip:

pip install reth-db-py

Assets

This package only has a single python class made available: PyDatabaseHandler.

PyDatabaseHandler is a class used to interact with the Reth DB. It's a wrapper around the Rust DatabaseHandler struct. It has a few methods which all return json strings:

  • get_header_by_block_number: get a single header by block number
  • get_headers_by_block_number_range: get multiple headers by block number range
  • get_transaction_by_id: get a single transaction by transaction id
  • get_transactions_by_id_range: get multiple transactions by transaction id range
  • get_transactions_by_block_number_range: get multiple transactions by block number range
  • get_block_by_number: get a single block by block number
  • get_uncles_by_block_number: get uncles by block number
  • get_receipts_by_transaction_id: get receipts by transaction id
  • get_receipts_by_block_number: get receipts by block number
impl PyDatabaseHandler {
    pub fn get_header_by_block_number(&self, number: u64) -> PyResult<String>
    pub fn get_headers_by_block_number_range(&self, start: u64, end: u64) -> PyResult<String>
    pub fn get_transaction_by_id(&self, id: u64) -> PyResult<String>
    pub fn get_transactions_by_id_range(&self, start: u64, end: u64) -> PyResult<String>
    pub fn get_transactions_by_block_number_range(&self, start: u64, end: u64) -> PyResult<String>
    pub fn get_block_by_number(&self, number: u64) -> PyResult<String>
    pub fn get_uncles_by_block_number(&self, number: u64) -> PyResult<String>
    pub fn get_receipts_by_transaction_id(&self, id: u64) -> PyResult<String>
    pub fn get_receipts_by_block_number(&self, number: u64) -> PyResult<String>
}
class PyDatabaseHandler:
    def get_header_by_block_number(self, number: int) -> str
    def get_headers_by_block_number_range(self, start: int, end: int) -> str
    def get_transaction_by_id(self, id: int) -> str
    def get_transactions_by_id_range(self, start: int, end: int) -> str
    def get_transactions_by_block_number_range(self, start: int, end: int) -> str
    def get_block_by_number(self, number: int) -> str
    def get_uncles_by_block_number(self, number: int) -> str
    def get_receipts_by_transaction_id(self, id: int) -> str
    def get_receipts_by_block_number(self, number: int) -> str

Usage

Import reth-db-py assets:

from reth_db_py import PyDatabaseHandler

Create a PyDatabaseHandler instance:

handler = PyDatabaseHandler("/path/to/db/mdbx.dat")

Get the header by block number

header = handler.get_header_by_block_number(17_000_000)

Get the headers by block number range

headers = handler.get_headers_by_block_number_range(17_000_000, 17_000_005)

Get transaction by id

transaction = handler.get_transaction_by_id(1000)

Get transactions by id range

transactions = handler.get_transactions_by_id_range(1000, 1005)

Get transactions by block number range

transactions = handler.get_transactions_by_block_number_range(17_000_000, 17_000_005)

Get block by number

block = handler.get_block_by_number(17_000_000)

Get uncles by block number

uncles = handler.get_uncles_by_block_number(17_000_000)

Get receipts by transaction id

receipts = handler.get_receipts_by_transaction_id(1000)

Get receipts by block number

receipts = handler.get_receipts_by_block_number(17_000_000)

Tests

Coming soon.

Benchmarks

Speed tests between RPC calls vs. reth-db-py calls (direct db interaction) coming soon.

Metadata

Release files for reth-db-py 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reth-db-py 0.1.4
File Size Uploaded Provenance Actions
reth_db_py-0.1.4.tar.gz 28.3 kB Without provenance Details for reth_db_py-0.1.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for reth-db-py 0.1.4
File Actions
reth_db_py-0.1.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for reth_db_py-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
reth_db_py-0.1.4-cp311-cp311-macosx_10_7_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.7+ x86-64 Details for reth_db_py-0.1.4-cp311-cp311-macosx_10_7_x86_64.whl
reth_db_py-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details for reth_db_py-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
reth_db_py-0.1.4-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for reth_db_py-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
reth_db_py-0.1.4-cp310-cp310-macosx_10_7_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.7+ x86-64 Details for reth_db_py-0.1.4-cp310-cp310-macosx_10_7_x86_64.whl
reth_db_py-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.34+ x86-64 Details for reth_db_py-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl
reth_db_py-0.1.4-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for reth_db_py-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
reth_db_py-0.1.4-cp39-cp39-macosx_10_7_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.7+ x86-64 Details for reth_db_py-0.1.4-cp39-cp39-macosx_10_7_x86_64.whl
reth_db_py-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.34+ x86-64 Details for reth_db_py-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl
reth_db_py-0.1.4-cp38-cp38-macosx_11_0_arm64.whl CPython 3.8 CPython 3.8 macOS 11.0+ ARM64 Details for reth_db_py-0.1.4-cp38-cp38-macosx_11_0_arm64.whl
reth_db_py-0.1.4-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details for reth_db_py-0.1.4-cp38-cp38-macosx_10_7_x86_64.whl
reth_db_py-0.1.4-cp37-cp37m-manylinux_2_34_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.34+ x86-64 Details for reth_db_py-0.1.4-cp37-cp37m-manylinux_2_34_x86_64.whl
reth_db_py-0.1.4-cp37-cp37m-macosx_11_0_arm64.whl CPython 3.7 CPython 3.7 pymalloc macOS 11.0+ ARM64 Details for reth_db_py-0.1.4-cp37-cp37m-macosx_11_0_arm64.whl
reth_db_py-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details for reth_db_py-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl

Total release size: 20.2 MB

Release files / reth_db_py-0.1.4.tar.gz

Download URL reth_db_py-0.1.4.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e4a70a5b62009e355045db76b150a7ae359b90d91fd2601a46c445d66c845c0c
BLAKE2b-256 checksum
How to use checksums
a7a3a71a56215e75d5bce1337e15eee7762edc07377c4725666e63232724bc9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL reth_db_py-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
30255760cb3fbfe2b5905f63fc5719f178205962d29fb756c5faa6a1f4f667b0
BLAKE2b-256 checksum
How to use checksums
e85d26dff4e8a53dcb1a82ccc4ab041a29c8f37e779e644996f10b987fbda8f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp311-cp311-macosx_10_7_x86_64.whl

Download URL reth_db_py-0.1.4-cp311-cp311-macosx_10_7_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
f2d93f25c4ffa0266f74b66b8587b7a3541ceb02ffa85d885b57e5e4ff4e44a3
BLAKE2b-256 checksum
How to use checksums
0dd585ebd55028833ea15c16d69504973bd48b4c723803d07ad035bfd9b232cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL reth_db_py-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
a275607b6a0d226edf919f9c557cea8fc886e9e61bafa36bf9a6547507cb5ad5
BLAKE2b-256 checksum
How to use checksums
53357b5537ed720243162fa2d6169357a927aecb2faf3dd0eae2f14ae000936d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp310-cp310-macosx_11_0_arm64.whl

Download URL reth_db_py-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4f97d42f948b3f2fb545f0616f0d193305a32b7e0e7eacea31d1c270238efc21
BLAKE2b-256 checksum
How to use checksums
7eda8699430bcb101ed3ba81a8efd02d1d21ea5218c4c83708da134ab8fb8500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp310-cp310-macosx_10_7_x86_64.whl

Download URL reth_db_py-0.1.4-cp310-cp310-macosx_10_7_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
1924b15bdf39248622301fd4e2b7dff10b0ce7c04380ba7e2e065901ab59234d
BLAKE2b-256 checksum
How to use checksums
f53a865acc1c24d43f5fcacf18237e389db955705eb93b5e093045c3c7cadb37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl

Download URL reth_db_py-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.9 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
b50b6577b161b843a8f779c67498b1706bb6f7b727d0712a72fdb28d5d381961
BLAKE2b-256 checksum
How to use checksums
c24a1d98f3863dc2fbc8e6a88b76005cea6f7791ef75c1d02044b23045b08fb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp39-cp39-macosx_11_0_arm64.whl

Download URL reth_db_py-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
023a559be76eb6c1f460649fc9b605802df9fabe94e7207e05566c789c059dd1
BLAKE2b-256 checksum
How to use checksums
f7dda45afce3d10c4ea02d5f54cd0e2f1c6412ce9dbb79b681ca1f6115067b81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp39-cp39-macosx_10_7_x86_64.whl

Download URL reth_db_py-0.1.4-cp39-cp39-macosx_10_7_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
44df501bc6a897258120503cb044420c37db4d472dfa3598e77ce668d65bb6dc
BLAKE2b-256 checksum
How to use checksums
a33333fa8362adf0d142a16640eb0dbd9ea349576376bf94f8ecc97d597ab010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl

Download URL reth_db_py-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.8 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
f83c8c738144d6702fefebcd1d767c1a6956197242937f1aaa6bea3e1ef949f4
BLAKE2b-256 checksum
How to use checksums
fdb0f87d2a563bf18a2d3deb64c7801448b26323fc1102015c698599bd29211f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp38-cp38-macosx_11_0_arm64.whl

Download URL reth_db_py-0.1.4-cp38-cp38-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.8 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11c498a17173db721327999792c453fb17b0581b823d5116b34a697bb951a344
BLAKE2b-256 checksum
How to use checksums
c006af7e2810f340678b624809c5536e6a126e150b5e7d74ab27468020d333c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp38-cp38-macosx_10_7_x86_64.whl

Download URL reth_db_py-0.1.4-cp38-cp38-macosx_10_7_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
0dbd98a25b05c8b2ac3918573e8a74eff925454ed90fa1df4328c788c0bd0547
BLAKE2b-256 checksum
How to use checksums
7f693bb1f5f9bbbd908e26201a4161f1537a5270389e18aeb81245af141445cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp37-cp37m-manylinux_2_34_x86_64.whl

Download URL reth_db_py-0.1.4-cp37-cp37m-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
d4c42d069495d99feb7a3588bfe71d0f26713aabd9fa9d82a4c23b6f9ea9cf0f
BLAKE2b-256 checksum
How to use checksums
8fd093502dbd001986bd45abd7ab6d4c9cbabad2a4bbd612f5243103d0be953a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp37-cp37m-macosx_11_0_arm64.whl

Download URL reth_db_py-0.1.4-cp37-cp37m-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
79c723a5660674919789ac10ddb4c32f1775b9dec54db75807a736fd0e89698f
BLAKE2b-256 checksum
How to use checksums
1d51e6dc22fbf29dde79fd7799f86c2b2d32afdf75ac05fae2b11d7d90e12781
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / reth_db_py-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL reth_db_py-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
78774323755be1c121ee62ae069c48e75b1121abae2f3f990b6d68ebfa5ecdef
BLAKE2b-256 checksum
How to use checksums
376b04d73ebacdf7c23b9e2b01ce92da0b4f82c385c06c6d57face2ca71244ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for reth-db-py 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page