Iwa
Iwa (岩), meaning "rock" in Japanese, symbolizes the unshakeable stability and immutable foundation required for secure financial infrastructure.
Iwa is a Python framework designed for managing crypto wallets and interacting with smart contracts and crypto protocols in a secure, modular, and extensible way. It's ideal for building autonomous agents and applications that require blockchain interactions.
Features
-
Secure Key Storage: Private keys are encrypted with AES-256-GCM and stored safely. They are never exposed to the application layer; signing happens internally via the
KeyStorageclass. -
Modularity (Plugins): Protocols and features are implemented as plugins, loaded dynamically. Currently supports Gnosis (Safe, CowSwap) and Olas (Registry, Services, Staking).
-
Multi-Chain Support: Native support for Gnosis Chain, Ethereum, and Base, with easy extensibility for others.
-
Robust Transaction Management:
- RPC Rotation: Automatically switches RPC providers if one fails or is rate-limited.
- Rate Limiting: Token bucket algorithm with automatic backoff.
- Retry Logic: Automatic retries with exponential backoff for transient failures.
-
MCP Server: Expose all wallet and Olas operations as Model Context Protocol tools, enabling AI agents (Claude, Cursor, etc.) to interact with the blockchain directly.
-
CLI & TUI Integration: Interact with your wallet via a unified CLI or a beautiful Terminal User Interface built with Textual.
-
Web API: RESTful API built with FastAPI for web-based integrations.
-
Modern Tooling: Managed with
uv,Justfilefor automation, and ready for Docker deployment.
Architecture
iwa/
├── core/ # Core wallet functionality
│ ├── keys.py # KeyStorage - Encrypted key management
│ ├── wallet.py # Wallet - High-level interface
│ ├── chain/ # Blockchain interface with rate limiting
│ ├── services/ # Service layer (accounts, balances, transactions)
│ └── contracts/ # Contract abstractions (ERC20, Safe)
├── mcp/ # MCP server (Model Context Protocol)
│ └── tools.py # 23 core wallet tools
├── plugins/ # Protocol integrations
│ ├── gnosis/ # Safe multisig and CowSwap DEX
│ └── olas/ # Olas Registry, Services, Staking + 17 MCP tools
├── tui/ # Terminal User Interface (Textual)
└── web/ # Web API (FastAPI)
Key Components
| Component | Description |
|---|---|
KeyStorage |
Encrypts/decrypts private keys, provides internal signing |
Wallet |
Main high-level interface for user interactions |
ChainInterface |
Manages Web3 connections with rate limiting and RPC rotation |
TransactionService |
Handles transaction signing and sending with retry logic |
PluginService |
Dynamically loads and manages protocol plugins |
Setup & Usage
Prerequisites
- Python 3.12+
- uv package manager
Installation
# Install from PyPI
pip install iwa
# Or using uv (recommended for tools)
uv tool install iwa
# Or from source
git clone https://github.com/dvilelaf/iwa.git
cd iwa
just install
Configuration
Create a secrets.env file with your configuration:
WALLET_PASSWORD=your_secure_password
GNOSIS_RPC=https://rpc.gnosis.io,https://gnosis.drpc.org
ETHEREUM_RPC=https://mainnet.infura.io/v3/YOUR_KEY
BASE_RPC=https://mainnet.base.org
# Testing mode (default: true uses Tenderly test RPCs)
TESTING=false
# Optional
COINGECKO_API_KEY=your_api_key
Running
# Launch TUI
just tui
# Launch Web UI
just web
# Use CLI
iwa wallet list --chain gnosis
# Start MCP server (for AI agent integration)
iwa mcp --transport sse --port 18080
MCP Agent Integration
The MCP server exposes 40 tools covering wallet operations, Olas service management, and staking. Example agent scripts for Claude, OpenAI GPT, and Gemini are in scripts/mcp/:
# Start the MCP server
iwa mcp --transport sse --port 18080
# Claude (pip install anthropic)
export ANTHROPIC_API_KEY=sk-ant-...
python scripts/mcp/claude_agent.py
# OpenAI GPT (pip install openai)
export OPENAI_API_KEY=sk-...
python scripts/mcp/openai_agent.py
# Gemini (pip install google-generativeai)
export GOOGLE_API_KEY=AIza...
python scripts/mcp/gemini_agent.py
See MCP documentation for the full tool reference and Claude Desktop configuration.
Running Tests
just test
Security Checks
just security # Runs gitleaks, bandit, and pip-audit
just wallet-check # Verifies password, keys, and mnemonic integrity
Docker
# Pull from Docker Hub
docker pull dvilelaf/iwa:latest
# Build locally
just docker-build
just docker-run
Plugins
Plugins are located in src/iwa/plugins. Currently supported:
Gnosis Plugin
- Safe: Create and manage Safe multisig wallets
- CowSwap: Token swaps via CoW Protocol with MEV protection, Max balance support, and auto-refreshing UI
Olas Plugin
- Registry: Interact with Olas service registry
- Services: Create, deploy, and manage Olas services
- Staking: Stake/unstake services and claim rewards
Transaction Flow
- Preparation: A high-level method prepares a raw transaction dictionary
- Delegation: The transaction is passed to
TransactionService - Signing:
KeyStoragedecrypts the key in memory, signs, and wipes the key - Sending: The signed transaction is sent via
ChainInterface - Recovery: Automatic RPC rotation and gas bumping on failures
- Receipt: Transaction receipt is returned upon success
Documentation
Full documentation is available in the docs/ directory:
# Serve docs locally
just docs-serve
# Build static docs
just docs-build
Development
# Format code
just format
# Lint code
just check
# Type check
just types
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for iwa 0.8.9
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 |
|---|---|---|---|---|
| iwa-0.8.9.tar.gz | 656.6 kB | Without provenance | Details for iwa-0.8.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iwa-0.8.9-py3-none-any.whl | Python 3 | none | any | Details for iwa-0.8.9-py3-none-any.whl |
Total release size: 1.4 MB
Release files / iwa-0.8.9.tar.gz
| Download URL | iwa-0.8.9.tar.gz |
|---|---|
| Size | 656.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd6f1a0c647849b287daa287e5d8a4e01a6741b58ee804ec06d393b5734775f9
|
|
BLAKE2b-256 checksum How to use checksums |
2f33c88999d71d2dbce82bbcd470bdb156ca782a675b0d28ee2c41043a6c983a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / iwa-0.8.9-py3-none-any.whl
| Download URL | iwa-0.8.9-py3-none-any.whl |
|---|---|
| Size | 787.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93f52e3ffbd7bd1f03c91148c9543942356eddee08d3e8c0102aed0c94c518de
|
|
BLAKE2b-256 checksum How to use checksums |
2767a8823b447b6f2339b7415c992dcfc4e40dd98025311ea258e6441c234235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for iwa 0.8.9
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.