Skip to main content

A secure, modular, and plugin-based framework for crypto agents and ops

Project description

Iwa

PyPI version Docker Pulls Python 3.12+ Tests Coverage License: MIT

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 KeyStorage class.

  • 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.
  • 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, Justfile for 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.py        # ChainInterface - Blockchain interaction with rate limiting
│   ├── services/       # Service layer (accounts, balances, transactions)
│   └── contracts/      # Contract abstractions (ERC20, Safe)
├── plugins/            # Protocol integrations
│   ├── gnosis/         # Safe multisig and CowSwap DEX
│   └── olas/           # Olas Registry, Services, Staking
├── 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

# Optional
GNOSISSCAN_API_KEY=your_api_key
COINGECKO_API_KEY=your_api_key

Running

# Launch TUI
just tui

# Launch Web UI
just web

# Use CLI
iwa wallet list --chain gnosis
iwa wallet balance <address> --chain gnosis

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

  1. Preparation: A high-level method prepares a raw transaction dictionary
  2. Delegation: The transaction is passed to TransactionService
  3. Signing: KeyStorage decrypts the key in memory, signs, and wipes the key
  4. Sending: The signed transaction is sent via ChainInterface
  5. Recovery: Automatic RPC rotation and gas bumping on failures
  6. 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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

iwa-0.0.14.tar.gz (338.5 kB view details)

Uploaded Source

Built Distribution

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

iwa-0.0.14-py3-none-any.whl (421.8 kB view details)

Uploaded Python 3

File details

Details for the file iwa-0.0.14.tar.gz.

File metadata

  • Download URL: iwa-0.0.14.tar.gz
  • Upload date:
  • Size: 338.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for iwa-0.0.14.tar.gz
Algorithm Hash digest
SHA256 0d7ceb671ffca8fc2d6ffbbe709dd2c0e25dda06c7c03c700d23f9168bd973de
MD5 9af6d7f73e24fcedbc70622c68bae68c
BLAKE2b-256 8d7f64be3f7f27ba5bab42614b6e68803a1f12193357cd1198373307bc7f75a4

See more details on using hashes here.

File details

Details for the file iwa-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: iwa-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 421.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for iwa-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 7985128cae0667cf5aa3d026d9096905f82a6e71235bf2344d25a37176b4009e
MD5 c49ccb2af05d9c2b6241870f6717ac48
BLAKE2b-256 99dc81c39a70661fa46445ef601f3969cb3fecf3ac7ddf6106ccefa5d267282a

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