Skip to main content

Universal multi-chain secure signing SDK for AI agents

Project description

agent-wallet (Python)

License 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_secure
  • raw_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:

  1. If a password is available from runtime_secrets.json or AGENT_WALLET_PASSWORD, resolve ConfigWalletProvider
  2. Otherwise, if wallets_config.json contains wallets, resolve ConfigWalletProvider
  3. Otherwise, fall back to EnvWalletProvider

Config Model

wallets_config.json stores:

  • active_wallet
  • wallets

Top-level wallet types:

  • local_secure
    • config stores secret_ref
    • secret bytes live in secret_<wallet-id>.json
  • raw_secret
    • config stores secret material directly
    • raw material may be:
      • private_key
      • mnemonic

Related files in the wallet directory:

  • wallets_config.json
  • runtime_secrets.json
  • secret_*.json
  • master.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

  • tron or tron:<chain> uses the TRON adapter
  • eip155 or eip155:<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

Security

  • local_secure uses encrypted local storage
  • raw_secret stores 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bankofai_agent_wallet-2.3.0b1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bankofai_agent_wallet-2.3.0b1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file bankofai_agent_wallet-2.3.0b1.tar.gz.

File metadata

  • Download URL: bankofai_agent_wallet-2.3.0b1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for bankofai_agent_wallet-2.3.0b1.tar.gz
Algorithm Hash digest
SHA256 33700d59125187000c582488775b834355bb66d54d8628993e8209f3f13ce635
MD5 9c3d29f4cd65a52ccd626b2a1e46fa90
BLAKE2b-256 8aed11e4f64bbca8a1282cc4acc5e8c55fc6c0666933ed2629348f17ad67f738

See more details on using hashes here.

File details

Details for the file bankofai_agent_wallet-2.3.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for bankofai_agent_wallet-2.3.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 a57ae16e2f62b9c5ffa3e9cee9ccbfc728185b0eaf51591eb1f72db626194057
MD5 bea76fbcc9a25ce598bfa758dca06d98
BLAKE2b-256 682655cc691b8c1c39f1c8994db9f4fc40f29b91833da47a8353d43c87dcd2d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page