# Wallets and keys in AIPAY

AIPAY is a **non-custodial** wallet. "Non-custodial" means AIPAY never holds your funds and never holds your keys. Everything below happens inside your browser.

## The two things you must never lose

### 1. The recovery phrase (12 words)

When AIPAY creates a wallet it generates a standard **BIP-39** recovery phrase of **12 words** and shows it once.

- It is the master secret behind **every** address AIPAY shows you, on every chain.
- It is the only way to rebuild the wallet from scratch.
- Anyone who reads these 12 words owns the funds. There is no password on the phrase itself.
- Write it on paper, offline, and store it somewhere safe. Do not photograph it, do not paste it into chat apps, cloud notes or password managers you do not control.

If the phrase is lost, funds are lost. AIPAY has no server, no account, and no recovery process. Neither AIPAY nor anyone else can restore it.

### 2. The local wallet password (PIN)

This is the password you type to **unlock the wallet on this device** and to **sign transactions**.

- Minimum length: **10 characters**.
- It is **never stored anywhere** — not on a server, not in a backup file.
- Technically it wraps the stored recovery phrase: the phrase is encrypted with a key derived from your password (PBKDF2-SHA256, 310,000 iterations, then AES-256-GCM) and only decrypted in memory while the wallet is unlocked.
- If you forget it, you cannot unlock the wallet **even though the files are still on your device**. The only way back is to re-import your recovery phrase (or restore a backup and then still supply the original password — see [backup.md](backup.md)).

The wallet password is **not** the same as the backup password. See [backup.md](backup.md).

## Address derivation

AIPAY derives addresses from the single recovery phrase, using standard BIP-32/BIP-44 paths:

| Chain family | Derivation path | Address type | Notes |
|---|---|---|---|
| EVM (Ethereum, BNB Chain, Polygon, Arbitrum, Optimism, Avalanche, Base) | `m/44'/60'/0'/0/0` | `0x...` | **The same address on all EVM chains.** |
| Solana | `m/44'/501'/0'/0'` | base58, ed25519 | A **different** address from your EVM one. |
| MSG (MSGChain) | from the same phrase (Dilithium-5) | MSG address | Implemented, but **not enabled today**. |

Two consequences that matter:

1. **One EVM address, many networks.** Your `0x...` address on Ethereum is identical on Base, Polygon, Arbitrum and so on. That does not mean the funds are shared: each network holds a separate balance. Sending USDC on Base to your address does **not** put USDC on Ethereum.
2. **Solana is a separate address.** Never send funds to your Solana address on an EVM chain, or vice versa.

## Where keys live

- The **encrypted** recovery phrase (and, for EVM, the derived private key) is stored in your browser's local database — IndexedDB — on this device only.
- Signing happens locally in the browser. AIPAY broadcasts the signed transaction directly to a public RPC endpoint, or the chain's RPC, without a middleman.
- AIPAY can show your **raw private key** from **Settings → Export Private Key** if you need to move to another wallet. Treat that value exactly like the recovery phrase: whoever has it owns the funds.
- Because everything is local, the wallet does **not** sync across devices by itself. To use the same wallet on a phone and a laptop you must import the recovery phrase (or restore a backup) on each device.

## Unlocking conveniences and their limits

- **Biometric unlock** (fingerprint / face) can replace typing the password on a specific device. It is a convenience wrapper around the same local key material and is **not** part of a backup — a restored device must re-enable it.
- **Auto-lock / in-memory only**: secrets are decrypted into memory while the wallet is unlocked. Closing the app or reloading clears them; you unlock again.
- **The install/“banner dismissed” state, theme, and biometric settings are per device** and are deliberately excluded from backups.

## Multiple wallets

AIPAY can hold more than one wallet (for example a personal one and a business one) and lets you switch between them. Each wallet has its own recovery phrase and its own local password, and only the **active** wallet is unlocked at a time. Backups include all stored wallets.

## Safety checklist

- [ ] Recovery phrase written on paper, stored offline, and readable.
- [ ] Local wallet password is at least 10 characters and not reused from another service.
- [ ] An [encrypted backup](backup.md) exists on a second device or a drive you control.
- [ ] I know the difference between my EVM address and my Solana address.
- [ ] I have tested a small receive and a small send before using large amounts.

## What is not available

MSG/MSGChain addresses and keys are derived from the same recovery phrase but are hidden while MSG is disabled. Do not expect a working MSG address in the UI today. See [chains.md](chains.md) and the authoritative status list in [../llms.txt](../llms.txt).
