Universal multi-chain secure signing SDK for AI agents
Project description
agent-wallet (Python)
Universal multi-chain signing SDK for AI agents — Python implementation.
The Python package is built around two public entry points:
resolve_wallet(...)resolve_wallet_provider(...)
It supports two config-backed wallet types:
local_secureraw_secret
Public API
from agent_wallet import (
ConfigWalletProvider,
EnvWalletProvider,
resolve_wallet,
resolve_wallet_provider,
)
resolve_wallet
from agent_wallet import resolve_wallet
wallet = await resolve_wallet(network="tron:nile")
signature = await wallet.sign_message(b"hello")
resolve_wallet_provider
from agent_wallet import ConfigWalletProvider, resolve_wallet_provider
provider = resolve_wallet_provider(dir="~/.agent-wallet", network="eip155:1")
if isinstance(provider, ConfigWalletProvider):
print(provider.get_active_id())
Provider resolution is config-first:
- If a password is available from
runtime_secrets.jsonorAGENT_WALLET_PASSWORD, resolveConfigWalletProvider - Otherwise, if
wallets_config.jsoncontains wallets, resolveConfigWalletProvider - Otherwise, fall back to
EnvWalletProvider
Config Model
wallets_config.json stores:
active_walletwallets
Top-level wallet types:
local_secure- config stores
secret_ref - secret bytes live in
secret_<wallet-id>.json
- config stores
raw_secret- config stores secret material directly
- raw material may be:
private_keymnemonic
Related files in the wallet directory:
wallets_config.jsonruntime_secrets.jsonsecret_*.jsonmaster.json
Environment Variables
| Variable | Description |
|---|---|
AGENT_WALLET_DIR |
Wallet directory, default ~/.agent-wallet |
AGENT_WALLET_PASSWORD |
Password fallback for local_secure |
AGENT_WALLET_PRIVATE_KEY |
Env fallback private key |
AGENT_WALLET_MNEMONIC |
Env fallback mnemonic |
AGENT_WALLET_MNEMONIC_ACCOUNT_INDEX |
Optional mnemonic account index |
runtime_secrets.json is an optional local fallback for secrets that cannot be passed via env. Today it stores:
{
"password": "..."
}
CLI
Quick start
# Create a secure local wallet
agent-wallet start local_secure -w default -p 'Abc12345!' -g
# Create a raw secret wallet from a private key
agent-wallet start raw_secret -w hot -k 0x...
# Create a raw secret wallet from a mnemonic
agent-wallet start raw_secret -w seed -m "word1 word2 ..." -mi 1
Storage initialization
agent-wallet init -p 'Abc12345!'
Add wallets
agent-wallet add local_secure -w signer2 -g
agent-wallet add local_secure -w signer3 -m "word1 ..." --derive-as eip155
agent-wallet add raw_secret -w hot2 -k 0x...
Active wallet management
agent-wallet list
agent-wallet use my-wallet
agent-wallet inspect my-wallet
agent-wallet remove my-wallet
Signing
agent-wallet sign msg "Hello" --network eip155:1
agent-wallet sign tx '{"to":"0x..."}' --network eip155:1 -w other-wallet
agent-wallet sign typed-data '{"types": {...}}' --network tron:nile
Important CLI flags:
--wallet-id,-w--password,-p--network,-n--generate,-g--private-key,-k--mnemonic,-m--mnemonic-index,-mi--derive-as--save-runtime-secrets
Network Routing
tronortron:<chain>uses the TRON adaptereip155oreip155:<chainId>uses the EVM adapter- TRON mnemonic derivation uses
m/44'/195'/0'/0/{index}
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
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
Security
local_secureuses encrypted local storageraw_secretstores secret material in plaintext config- Password strength is enforced for secure local setup
- Signing is local-only
Development
pip install -e ".[all]"
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.0b2.tar.gz.
File metadata
- Download URL: bankofai_agent_wallet-2.3.0b2.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19d0ffb27b3bb8494a2b5cbcd1659915e8b8588097142c7b310227c699fed2cf
|
|
| MD5 |
2c1cba104b7b7b00a2435244fe245948
|
|
| BLAKE2b-256 |
862fa50426f75ac69bbca6574596ce38d2bcaf451b041739423d022c84c3fc10
|
File details
Details for the file bankofai_agent_wallet-2.3.0b2-py3-none-any.whl.
File metadata
- Download URL: bankofai_agent_wallet-2.3.0b2-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b79535bf5add62942b8e35712ce1e153dc4d2889676a01205cf22bb3d197413
|
|
| MD5 |
2cafb7c69e3bac0a3d947230a03dcc57
|
|
| BLAKE2b-256 |
bd5167472e1a37cd47560cce438f89051c0e750acb0d9f627fec0354f724eabe
|