ethswarm-deployments
Python library for managing Ethswarm smart contract deployment data across all versions and networks.
Overview
This library ingests Swarm smart contract deployment data from the ethersphere/storage-incentives GitHub repository and provides a clean Python interface for accessing deployment information across:
- Multiple contract versions (v0.4.0 through v0.9.4+)
- Multiple networks (mainnet, testnet)
- Both legacy and hardhat-deploy format contracts
Features
- Multi-network support: Query deployments on Gnosis Chain mainnet and Sepolia testnet
- Version tracking: Access any version of deployed contracts
- Backward compatible: Supports both legacy (
staking) and canonical (StakeRegistry) contract names - Persistent caching: Local cache with block timestamp optimization
- Rich metadata: Includes ABIs, bytecode, constructor args, and transaction hashes
Installation
pip install ethswarm-deployments
Quick Start
from ethswarm_deployments import DeploymentManager
# Initialize (uses cached data at ./.ethswarm-deployments/deployments.json)
mgr = DeploymentManager()
# Use a shared cache in your home directory instead of the project directory
mgr = DeploymentManager(location="user") # ~/.cache/ethswarm-deployments
# Build the cache from GitHub on first use if it is missing
# (requires an RPC URL in the environment; see "Regenerating Cache" below)
mgr = DeploymentManager(auto_regenerate=True)
# Get latest deployment on mainnet (default)
deployment = mgr.deployment("StakeRegistry")
print(f"StakeRegistry at {deployment.address}")
# Get specific version on testnet
deployment = mgr.deployment("Redistribution", version="v0.9.2", network="testnet")
# List all versions
versions = mgr.versions()
# Get all deployments of a contract across versions
all_staking = mgr.all_deployments("StakeRegistry")
Cache Location
By default the cache lives in a project-local ./.ethswarm-deployments
directory, so nothing is written to your home directory unless you ask for it.
To use a shared cache in your XDG cache home (~/.cache/ethswarm-deployments,
or $XDG_CACHE_HOME/ethswarm-deployments):
from ethswarm_deployments import DeploymentManager
mgr = DeploymentManager(location="user")
Resolution precedence for the cache directory (first match wins):
- An explicit
cache_dir=path argument. - An explicit
location=argument ("project"or"user"). - The
ETHSWARM_DEPLOYMENTS_CACHEenvironment variable — set it toproject,user, or a directory path. - The default
projectlocation (./.ethswarm-deployments).
Regenerating Cache
If the cache is missing, DeploymentManager() raises CacheNotFoundError by
default. Pass auto_regenerate=True to build it on demand instead (this
requires an RPC URL in the environment and may take a while):
mgr = DeploymentManager(auto_regenerate=True)
The cache can also be regenerated explicitly from GitHub:
from ethswarm_deployments import regenerate_from_github
# Regenerate cache (requires RPC endpoints)
regenerate_from_github(
mainnet_rpc_url="https://rpc.gnosischain.com",
testnet_rpc_url="https://ethereum-sepolia-rpc.publicnode.com"
)
License
MIT
Metadata
Release files for ethswarm-deployments 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 | |
|---|---|---|---|
| ethswarm_deployments-0.3.0.tar.gz | 85.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ethswarm_deployments-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 103.1 kB
Release files / ethswarm_deployments-0.3.0.tar.gz
| Download URL | ethswarm_deployments-0.3.0.tar.gz |
|---|---|
| Size | 85.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0703f8d4741cd5df238fbea5413e8e2d5cb7b4aea6709a57e9587829f8d1462d
|
|
BLAKE2b-256 checksum How to use checksums |
c38306265ee804ff7ecb612e817a73c75d5b7508b2b5b62fdd6894318278fca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / ethswarm_deployments-0.3.0-py3-none-any.whl
| Download URL | ethswarm_deployments-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4100c2e04b529fa7cfc3afcd7b9c9c514b1a54d802ce00006cb7cdd2438b900
|
|
BLAKE2b-256 checksum How to use checksums |
031456fdfbe2bbef41f1b57c9ce28e0a31fa90f4973b628d07599d4d3683f47a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|