Universal multi-chain secure signing SDK for AI agents
Project description
agent-wallet (Python)
Universal multi-chain signing SDK for AI agents — Python implementation.
Install
pip install bankofai-agent-wallet
Includes CLI (agent-wallet), EVM and TRON support — no extras needed.
Quick Start
from agent_wallet import resolve_wallet
wallet = await resolve_wallet(network="tron:nile")
signature = await wallet.sign_message(b"hello")
resolve_wallet automatically finds your wallet config in ~/.agent-wallet (or AGENT_WALLET_DIR).
Public API
from agent_wallet import (
resolve_wallet, # → Wallet (one-shot)
resolve_wallet_provider, # → ConfigWalletProvider | EnvWalletProvider
ConfigWalletProvider, # file-backed provider (local_secure / raw_secret)
EnvWalletProvider, # env-var-backed provider (AGENT_WALLET_PRIVATE_KEY)
)
resolve_wallet
Returns a ready-to-sign Wallet for the given network:
wallet = await resolve_wallet(network="eip155:1")
sig = await wallet.sign_transaction({"to": "0x...", "value": 0})
resolve_wallet_provider
Returns either ConfigWalletProvider or EnvWalletProvider based on what's available:
provider = resolve_wallet_provider(network="eip155:1")
# Get the active wallet
wallet = await provider.get_active_wallet()
# Or a specific wallet
wallet = await provider.get_wallet("my_wallet", network="tron:nile")
Provider resolution order
- Password available (from
runtime_secrets.jsonorAGENT_WALLET_PASSWORD) →ConfigWalletProvider wallets_config.jsonexists with wallets →ConfigWalletProvider- Otherwise →
EnvWalletProvider(readsAGENT_WALLET_PRIVATE_KEY/AGENT_WALLET_MNEMONIC)
Wallet Interface
class Wallet(ABC):
async def get_address() -> str
async def sign_raw(raw_tx: bytes) -> str
async def sign_transaction(payload: dict) -> str
async def sign_message(msg: bytes) -> str
class Eip712Capable(ABC):
async def sign_typed_data(data: dict) -> str
Both EVM and TRON network-specific signers implement Wallet + Eip712Capable.
Network Routing
| Network string | Adapter | Mnemonic derivation |
|---|---|---|
eip155 or eip155:<chainId> |
EVM | m/44'/60'/0'/0/{index} |
tron or tron:<chain> |
TRON | m/44'/195'/0'/0/{index} |
Environment Variables
| Variable | Description |
|---|---|
AGENT_WALLET_DIR |
Wallet directory (default ~/.agent-wallet) |
AGENT_WALLET_PASSWORD |
Password for local_secure wallets |
AGENT_WALLET_PRIVATE_KEY |
Env fallback private key (hex) |
AGENT_WALLET_MNEMONIC |
Env fallback mnemonic phrase |
AGENT_WALLET_MNEMONIC_ACCOUNT_INDEX |
Mnemonic account index (default 0) |
Examples
- tron_sign_and_broadcast.py
- bsc_sign_and_broadcast.py
- tron_x402_sign_typed_data.py
- bsc_x402_sign_typed_data.py
- dual_sign_typed_data_from_private_key.py
- switch_active_wallet.py
Development
pip install -e ".[dev]"
pytest
License
MIT — BankOfAI
Project details
Release history Release notifications | RSS feed
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 bankofai_agent_wallet-2.3.1.tar.gz.
File metadata
- Download URL: bankofai_agent_wallet-2.3.1.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c28fc09a6f3985229a19ee34974187ff1ba87ea62956522023cda3443a58dcaa
|
|
| MD5 |
a3b5815e1de9574a7834650681cab810
|
|
| BLAKE2b-256 |
59dc6435b051a6f2aadaa8d38b9f479162c3d8c957cfa27edea4f0b883ba9580
|
File details
Details for the file bankofai_agent_wallet-2.3.1-py3-none-any.whl.
File metadata
- Download URL: bankofai_agent_wallet-2.3.1-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bf88a32a84d56b140b05fc441b7704892fefb29e1e8e7d4a0c68923d33d58a8
|
|
| MD5 |
660f0c03bbb301b1bfad8a6ec1fad856
|
|
| BLAKE2b-256 |
0067c8568d6818c77d8c99769ae687a94086d3e6c2b27a08a7830733d23d4f16
|