Registry / security / safe-eth-py

safe-eth-py

JSON →
library7.21.0pypypi✓ verified 89d ago

Python library from the Safe Ecosystem Foundation for Ethereum projects. Provides utilities for transaction building, Gnosis Safe multisig interaction, EIP-712 signatures, and Ethereum client communication. Current version 7.21.0, requires Python >=3.10. Active development with frequent releases.

pip install safe-eth-py
INSTALL
IMPORT
SIG · SAFE-ETH-PY
S
safe-eth-py
securitypythonv7.21.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Safe
✓ from safe_eth.eth import EthereumClient, EthereumNetwork from safe_eth.safe import Safe
✗ from gnosis.safe import Safe
Old gnosis package path replaced by safe_eth in v4+
EthereumClient
✓ from safe_eth.eth import EthereumClient
✗ from safe_eth import EthereumClient
EthereumClient is in safe_eth.eth submodule
SafeTx
✓ from safe_eth.safe import SafeTx
EthereumNetwork
✓ from safe_eth.eth import EthereumNetwork
ProxyFactory
✓ from safe_eth.safe import ProxyFactory
✗ from safe_eth.eth import ProxyFactory
Part of safe subpackage, not eth

Connect to an Ethereum node, load a Gnosis Safe, and retrieve its current owners, threshold, and nonce.

import os from safe_eth.eth import EthereumClient, EthereumNetwork from safe_eth.safe import Safe # Connect to Ethereum client (replace YOUR_NODE_URL) ethereum_client = EthereumClient(os.environ.get('ETHEREUM_NODE_URL', 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID')) # Load a Safe (replace with a real address) safe_address = '0x1230B3d59858296A31053C1b8562Ecf89A2f888b' safe = Safe(safe_address, ethereum_client) # Retrieve Safe info info = safe.retrieve_all_info() print(f'Safe owners: {info.owners}') print(f'Safe threshold: {info.threshold}') print(f'Safe nonce: {info.nonce}')
Debug
Known issues
breakingsafe-eth-py v6.0.0 removed the 'gnosis' top-level package. All imports must use 'safe_eth' prefix.
fix
Replace 'from gnosis...' with 'from safe_eth...'
affects: >=6.0.0
breakingsafe-eth-py v7.0.0 upgraded web3 dependency to v7, which introduced breaking changes in transaction signing and encoding.
fix
Update code to use web3 v7 API (e.g., Account.sign_transaction instead of Account.signTransaction).
affects: >=7.0.0
gotchaEthereumClient requires a valid Ethereum node URL. Using a free Infura endpoint may hit rate limits quickly.
fix
Use a dedicated node or consider retry logic with multiple providers.
affects: all
deprecatedSafe.retrieve_all_info() is deprecated; use Safe.retrieve_all_info() (still works but may be removed). Prefer individual methods like .retrieve_owners(), .retrieve_threshold(), .retrieve_nonce().
fix
Use Safe.retrieve_owners(), Safe.retrieve_threshold(), etc.
affects: >=7.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'gnosis'
safe-eth-py v6+ renamed the top-level package from 'gnosis' to 'safe_eth'.
fix
Replace all 'from gnosis...' imports with 'from safe_eth...'
ImportError: cannot import name 'EthereumClient' from 'safe_eth'
EthereumClient is not exported from the root safe_eth package; it's in the safe_eth.eth submodule.
fix
Use 'from safe_eth.eth import EthereumClient'
ValueError: The network ID 1 is not supported
EthereumNetwork enum may not include all chain IDs; client may not recognize the network.
fix
Use EthereumNetwork.from_chain_id(chain_id) or manually set network.
Upgrade
Version history
7.21.0latest on PyPI · released Apr 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
24
Resources
safe-eth-py — pip install safe-eth-py · libregistry