Python library for managing Ethswarm smart contract deployment data across all versions and networks
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ethswarm_deployments-0.3.0.tar.gz.
File metadata
- Download URL: ethswarm_deployments-0.3.0.tar.gz
- Upload date:
- Size: 85.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0703f8d4741cd5df238fbea5413e8e2d5cb7b4aea6709a57e9587829f8d1462d
|
|
| MD5 |
e658427fbead7fd6091ca099c5b0e00d
|
|
| BLAKE2b-256 |
c38306265ee804ff7ecb612e817a73c75d5b7508b2b5b62fdd6894318278fca0
|
File details
Details for the file ethswarm_deployments-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ethswarm_deployments-0.3.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4100c2e04b529fa7cfc3afcd7b9c9c514b1a54d802ce00006cb7cdd2438b900
|
|
| MD5 |
5aad572cb76fdabd52a83831ed075908
|
|
| BLAKE2b-256 |
031456fdfbe2bbef41f1b57c9ce28e0a31fa90f4973b628d07599d4d3683f47a
|