eth-hub - Ethereum Key Management Toolkit
A secure abstraction layer for managing Ethereum keys across different storage backends.
Key Features
🔐 Secure Key Management
- Unified interface for multiple key storage providers
- Never exposes private keys outside secure environments
- Will support both software and hardware security modules
📜 Complete Signing Capabilities
- Transaction signing
- Message signing (EIP-191 compatible)
- Hash signing
- Consistent signature output format
Core Architecture
from eth_hub import (
BaseKeyStore, # Abstract base class
AwsKeyStore, # AWS KMS implementation
LocalKeyStore # In-memory implementation
)
BaseKeyStore (ABC)
The abstract base class defining all key operations:
class BaseKeyStore(ABC):
@abstractmethod
def import_key(self, private_key: bytes) -> BaseKey: ...
@abstractmethod
def create_key(self) -> BaseKey: ...
@abstractmethod
def get_key(self, key_id: UUID) -> BaseKey: ...
@abstractmethod
def list_keys(self) -> Sequence[BaseKey]: ...
@abstractmethod
def remove_key(self, key_id: UUID) -> None: ...
@abstractmethod
def sign_hash(self, key_id: UUID, hash_: bytes) -> SignatureInfo: ...
@abstractmethod
def sign_message(self, key_id: UUID, message: SignableMessage) -> SignatureInfo: ...
@abstractmethod
def sign_transaction(self, key_id: UUID, transaction_data: dict[str, Any]) -> SignatureInfo: ...
Current Implementations
1. AWS KMS KeyStore
- Keys never leave AWS KMS
- All signing operations performed within KMS
- Supports both imported and KMS-generated keys
2. LocalKeyStore (Memory)
- In-memory key storage for development/testing
- Simulates same interface as other stores
- Useful for CI/CD pipelines and local testing
3. HashiCorp Vaul - WiP
Installation
pip install eth-hub
Aws usage case
If you want to use your own key material, you can import it into AWS KMS. Otherwise, create a new KMS key for Ethereum signing.
web3_rpc = "..."
web3 = Web3(Web3.HTTPProvider(web3_rpc))
key_storage = AwsKeyStore(boto3.client("kms"))
# import your private key to KMS
key = key_storage.import_key(private_key="...")
# or create new one by KMS:
key = key_storage.create_key()
Sign and send transaction:
web3_rpc = "..."
web3 = Web3(Web3.HTTPProvider(web3_rpc))
key_id = "..."
key_storage = AwsKeyStore(boto3.client("kms"))
key = key_storage.get_key(key_id)
user_address = Web3.to_checksum_address(key.address.hex())
abi = [...]
contract_address = Web3.to_checksum_address(contract_address)
contract = web3.eth.contract(address=contract_address, abi=abi)
nonce = web3.eth.get_transaction_count(user_address)
transaction_dict = contract.functions.foo.build_transaction({"nonce": nonce})
unsigned_transaction = TypedTransaction.from_dict(transaction_dict)
signature = key_storage.sign_hash(key_id, unsigned_transaction.hash())
signed_transaction = TypedTransaction.from_dict(
{**transaction_dict, "v": signature.v, "r": signature.r, "s": signature.s}
)
tx_hash = web3.eth.send_raw_transaction(encoded_tx.encode())
The private key never leaves AWS KMS. Signing is performed inside KMS, and only the signature is returned to your application.
Planned Features:
- Integration with HashiCorp Vault's
Metadata
Release files for eth-hub 1.1.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 |
|---|---|---|---|---|
| eth_hub-1.1.0.tar.gz | 8.7 kB | Without provenance | Details for eth_hub-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eth_hub-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for eth_hub-1.1.0-py3-none-any.whl |
Total release size: 22.2 kB
Release files / eth_hub-1.1.0.tar.gz
| Download URL | eth_hub-1.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab15e8f78352b288c0705046ab77b7d63f739200b31116be32ba3e3f76e0da9b
|
|
BLAKE2b-256 checksum How to use checksums |
3024772e7947abc3798d725cd65ac60deb3e17c3972c68509547bfea8dca3cb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / eth_hub-1.1.0-py3-none-any.whl
| Download URL | eth_hub-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b73350ac56442c98c6b9213b87651bab1d555f11b046c2d5d3967b8835ac6e29
|
|
BLAKE2b-256 checksum How to use checksums |
2338f5b37779a4e247d19cea577cfe0d8b0c1ea9f8458ec8bacc72c53cef13a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for eth-hub 1.1.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.