pymempool
Python wrapper and terminal dashboard for the mempool.space API.
Installation
PyPI:
pip install pymempool
From source:
git clone https://github.com/holgern/pymempool.git
cd pymempool
python -m pip install -e .
Quick Start
from pymempool import MempoolAPI, RecommendedFees
mp = MempoolAPI()
fees = RecommendedFees(mp.get_recommended_fees_precise())
print(fees.as_dict())
mempool = mp.get_mempool()
print(mempool["count"], mempool["vsize"])
projected_blocks = mp.get_mempool_blocks_fee()
print(projected_blocks[0]["medianFee"])
Best First Commands
pymempool overview
pymempool pressure
pymempool ladder
pymempool watch
CLI Commands
# One-screen mempool dashboard
pymempool overview --precise-fees --blocks 6
# Fee pressure across human-readable bands
pymempool pressure
# Decision-first projected block ladder
pymempool ladder --limit 8
# Legacy ASCII mempool blocks view
pymempool mempool-blocks --limit 4
# Live mempool dashboard
pymempool watch --rbf fullRbf
# Stream raw websocket events
pymempool stream --want stats --want mempool-blocks
For command details:
pymempool --help
pymempool overview --help
API Highlights
from pymempool import MempoolAPI, MempoolWebSocketClient
mp = MempoolAPI()
rounded = mp.get_recommended_fees()
precise = mp.get_recommended_fees_precise()
recent = mp.get_mempool_recent()
audit = mp.get_block_audit_summary("<block_hash>")
client = MempoolWebSocketClient(want_data=["stats", "mempool-blocks"])
print(client.build_subscription_payloads())
Rate Limiting
pymempool now treats HTTP 429 Too Many Requests as back-pressure instead of a
generic fast retry. The client:
- rate-limits itself before sending REST requests with conservative per-host defaults
- honors integer
Retry-Afterheaders when present - applies exponential backoff with jitter when
Retry-Afteris absent - keeps cooldown state per host so failover stays resilient without turning into rate-limit evasion
- reuses short-lived cached snapshots for hot endpoints like fees, mempool summary, and projected blocks
- prefers WebSocket flows for live dashboards so
watchandstreamdo not depend on tight REST polling
You can tune the policy via MempoolAPI(...):
from pymempool import MempoolAPI
mp = MempoolAPI(
rate_limit_per_sec=1.0,
rate_limit_burst=5,
respect_retry_after=True,
enable_response_cache=True,
cache_ttl_seconds=3.0,
)
Development
Install dev and test dependencies:
uv pip install -r requirements.txt -r requirements-test.txt
Common checks:
pytest
pre-commit run --show-diff-on-failure --color=always --all-files
mypy pymempool
python docs/make.py
Documentation
- REST API reference: https://mempool.space/docs/api/rest
- Project docs:
docs/
License
Metadata
Release files for pymempool 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymempool-0.3.0.tar.gz | 57.4 kB | Without provenance | Details for pymempool-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymempool-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pymempool-0.3.0-py3-none-any.whl |
Total release size: 96.8 kB
Release files / pymempool-0.3.0.tar.gz
| Download URL | pymempool-0.3.0.tar.gz |
|---|---|
| Size | 57.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac1b8ae5a0fabee1f0839f5c7e5e5726bde3e2641836d1d0116d482ee33926d0
|
|
BLAKE2b-256 checksum How to use checksums |
1b3c96a63ad37cc277000d8356b5369b7a13fdaf1017063bdf92ae29dae75af9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / pymempool-0.3.0-py3-none-any.whl
| Download URL | pymempool-0.3.0-py3-none-any.whl |
|---|---|
| Size | 39.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6298b90bc28b8b3392c65a322e3e2ac9c3618cb541eb3d3dbd2566caf2c5a8d6
|
|
BLAKE2b-256 checksum How to use checksums |
d7de1411f930db1e6d2429a9c37545aa2afa3dc22c0914209f69f57d9acb3867
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for pymempool 0.3.0
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.