Skip to main content

fastweb3

High-performance Web3 client.

NOTE: This library is still in early alpha development. Prior to a v1.0.0 (which may never come), expect breaking changes and no backward compatibility between versions.

Installation

You can install the latest release via pip:

pip install fastweb3

Or clone the repository for the most up-to-date version:

git clone https://github.com/iamdefinitelyahuman/fastweb3.git
cd fastweb3
pip install -e .

Features

Automatic public RPC discovery and pooling

fastweb3 queries a list of public RPC endpoints, maintains a pool of useable nodes, distributes requests between them, and reroutes failed requests. Users can rely on public infrastructure without thinking about timeouts, rate limiting, nodes falling out of sync, etc.

>>> from fw3 import Web3

# only a chainId is needed to connect
>>> w3 = Web3(1)

# the object immediately begins querying endpoints to check availability and latency
# the best nodes are selected to be used in an "active pool"
>>> w3.active_pool_size()
6

# we continue to monitor all known good endpoints, in case we have issues with any
# member of the active pool
>>> w3.pool_capacity()
11

Users with their own RPC can target it as their primary endpoint. This endpoint is then favored for write methods, but read methods continue to be distributed amongst the node pool.

>>> w3 = Web3(1, primary_endpoint=["my.local.node"])

Deferred Execution

RPC calls return Proxy objects immediately, while network I/O happens in the background.

>>> amount = w3.eth.get_balance('0xd8da6bf26964af9d7eed9e03e53415d37aa96045')
>>> amount
<Proxy at 0x7b9ac0764a40 of object ... >
>>> print(amount)
32131215082101779377

Simple Batching Semantics

Batching uses natural syntax. With a context manager open, each requests is queued in the same batch until one of the Proxy objects is read, at which point the entire request is processed. This also guarantees queried values are all read from the same block.

>>> with w3.batch_requests():
...     a = w3.eth.get_balance("0xd8da6bf26964af9d7eed9e03e53415d37aa96045")
...     b = w3.eth.get_balance("0x1db3439a222c519ab44bb1144fc28167b4fa6ee6")
...     # both eth_getBalance queries are sent in the same batched request
...     print(a + b)
...
32840401623804415458

Tests

First, install the dev dependencies:

pip install -e ".[dev]"

To run the test suite:

pytest

License

This project is licensed under the MIT license.

Metadata

Release files for fastweb3 0.1.6

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

Source distribution (sdist)

Source distribution for fastweb3 0.1.6
File Size Uploaded Provenance
fastweb3-0.1.6.tar.gz 50.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fastweb3 0.1.6
File Interpreter ABI Platform
fastweb3-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 111.7 kB

Release files / fastweb3-0.1.6.tar.gz

Download URL fastweb3-0.1.6.tar.gz
Size 50.4 kB
Tags Source
SHA-256 checksum
How to use checksums
286e285c00dd02e52c427db7fa1cbc1d6b9917c5dc9475d10cec1a8ece7d6223
BLAKE2b-256 checksum
How to use checksums
3925ca7335b1d47cc24ad8881e4e112a947e1fb3870000ce98e15c635157e336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / fastweb3-0.1.6-py3-none-any.whl

Download URL fastweb3-0.1.6-py3-none-any.whl
Size 61.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc651238507a2735291b0a46d5ea34032158388c3cb0d2e05dcb6754b680e957
BLAKE2b-256 checksum
How to use checksums
626932d2a2f680c3066b295b914085392656a2052025036a8af7c3271a068bdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for fastweb3 0.1.6

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