Back to Components

# Wallet Daemon

Encrypted keystore with Argon2id + XChaCha20-Poly1305, REST/JSON-RPC APIs, and receipt verification capabilities

● Live

## Overview

The AITBC Wallet Daemon provides secure wallet management with enterprise-grade encryption and multiple API interfaces for seamless integration.

### Key Features

- Encrypted keystore with Argon2id + XChaCha20-Poly1305
- REST and JSON-RPC APIs
- Receipt verification capabilities
- Hardware wallet support
- Multi-signature wallet support

## Architecture

The wallet daemon is built with security as the primary focus:

#### Encryption

Argon2id key derivation with XChaCha20-Poly1305 AEAD encryption

#### Key Management

Hierarchical deterministic (HD) wallets with BIP44 support

#### API Layer

REST and JSON-RPC APIs for easy integration

#### Security

Sandboxed execution and memory protection

## API Reference

### REST API

    # Create wallet
    POST /api/v1/wallet/create
    {
      "name": "my-wallet",
      "password": "strong-password"
    }

    # Unlock wallet
    POST /api/v1/wallet/unlock
    {
      "name": "my-wallet",
      "password": "strong-password"
    }

    # Get address
    GET /api/v1/wallet/address

    # Send transaction
    POST /api/v1/wallet/send
    {
      "to": "0x...",
      "amount": 1000,
      "fee": 10
    }

### JSON-RPC API

    # Get balance
    curl -X POST http://localhost:8545 \
      -H "Content-Type: application/json" \
      -d '{
        "jsonrpc": "2.0",
        "method": "get_balance",
        "params": [],
        "id": 1
      }'

    # Sign transaction
    curl -X POST http://localhost:8545 \
      -H "Content-Type: application/json" \
      -d '{
        "jsonrpc": "2.0",
        "method": "sign_transaction",
        "params": [tx_data],
        "id": 1
      }'

## Configuration

The wallet daemon can be configured via environment variables or config file:

    # Configuration file: ~/.aitbc/wallet/config.toml

    [wallet]
    keystore_path = "~/.aitbc/wallet/keystore"
    default_network = "mainnet"

    [api]
    rest_host = "127.0.0.1"
    rest_port = 8545
    rpc_host = "127.0.0.1"
    rpc_port = 8546

    [security]
    argon2_time = 3
    argon2_memory = 67108864  # 64MB
    argon2_parallelism = 4

## Security Features

- Memory Encryption: All sensitive data encrypted in memory
- Secure Erasure: Memory zeroized after use
- Access Control: API key authentication
- Audit Logging: All operations logged securely
- Hardware Support: Ledger and Trezor integration

## Integration Examples

### Python Integration

    from aitbc_wallet import WalletClient

    client = WalletClient("http://localhost:8545")

    # Create wallet
    wallet = client.create_wallet("my-wallet", "password")
    print(f"Address: {wallet.address}")

    # Send transaction
    tx = client.send_transaction(
        to="0x123...",
        amount=1000,
        password="${PASSWORD}"
    )
    print(f"Transaction hash: {tx.hash}")

### JavaScript Integration

    const { WalletClient } = require('@aitbc/wallet');

    const client = new WalletClient('http://localhost:8545');

    // Create wallet
    const wallet = await client.createWallet('my-wallet', 'password');
    console.log('Address:', wallet.address);

    // Get balance
    const balance = await client.getBalance();
    console.log('Balance:', balance);