# pi-agent-id Wallet Extension

A comprehensive Ethereum wallet management tool for the pi agent system.

## Overview

pi-agent-id provides full wallet creation, management, and transaction capabilities as a single binary. It supports HD wallets (BIP39/BIP44), secure key storage, and Ethereum transaction signing.

## Installation

```bash
# Build from source
cd ~/.pi/agent/skills/pi-agent-id
go build -o bin/pi-agent-id cmd/main.go

# Or install via pi
pi skill install pi-agent-id
```

## Usage

### Create a New Wallet

```bash
# Create simple wallet
/pi-agent-id create --name mywallet

# Create HD wallet with mnemonic
/pi-agent-id create --name myhdwallet --hd --password "secure-pass"

# Output shows address and mnemonic (if HD)
```

### Import Existing Wallet

```bash
# Import from private key
/pi-agent-id import --key 0xabc123... --name imported

# Import from mnemonic
/pi-agent-id import --mnemonic "word1 word2 ... word12" --name recovered

# Import from keystore file
/pi-agent-id import --keystore /path/to/keystore --password "pass" --name keystore
```

### List Wallets

```bash
/pi-agent-id list
# Shows all wallets with addresses and names
```

### Sign Messages

```bash
/pi-agent-id sign --address 0x123... --message "Hello World"
# Returns signature
```

### Check Balance

```bash
/pi-agent-id balance --address 0x123... --rpc https://mainnet.infura.io/v3/YOUR_KEY
# Shows ETH balance
```

### Send Transactions

```bash
/pi-agent-id send --from 0x123... --to 0x456... --amount 1.5 \
  --rpc https://mainnet.infura.io/v3/YOUR_KEY \
  --password "wallet-password"
# Signs and broadcasts transaction
```

### Export Wallet

```bash
# Export private key
/pi-agent-id export --address 0x123... --password "pass" --private-key

# Export mnemonic (HD wallets only)
/pi-agent-id export --address 0x123... --password "pass" --mnemonic
```

## Security

- All private keys are encrypted at rest using AES-256-GCM
- Password required for all sensitive operations
- Mnemonics are never stored in plain text
- Keystore files follow Ethereum standard (UTC--*)

## Storage Location

Wallets are stored in:
- **Linux/macOS**: `~/.config/pi-agent-id/wallets/`
- **Windows**: `%USERPROFILE%\.config\pi-agent-id\wallets\`

## Commands Reference

| Command | Description |
|---------|-------------|
| `create` | Generate new wallet |
| `import` | Import from key/mnemonic/keystore |
| `list` | Show all wallets |
| `sign` | Sign a message |
| `send` | Send ETH transaction |
| `balance` | Check ETH balance |
| `export` | Export private key or mnemonic |
| `delete` | Remove a wallet |
| `recover` | Recover from mnemonic |

## Requirements

- Go 1.21+ (for building)
- No runtime dependencies for binary

## License

MIT
