Skip to content

Data Persistence

All TrenchTools data is stored in browser localStorage. Nothing is sent to any server.

Storage Keys

KeyContentsSize Limit
trenchsniper_secure_walletsEncrypted wallet vault (Argon2 + AES-GCM)Unlimited
trench_tx_historyTrade records array500 records
trench_pnl_dataP&L position dataAuto-calculated
trench_bot_configsBot group configurationsUp to 6 configs
trench_settings_v1User settings (RPC, API keys, theme)Small
trench_config_v1Sniper/trading configurationSmall
trench_activity_v1Activity logsVaries
trench_active_walletCurrently selected wallet1 entry
trench_all_walletsWallet list summary (public data only)All wallets

Encrypted Data

The wallet vault (trenchsniper_secure_wallets) contains encrypted private keys:

Password → Argon2 → Derived Key → AES-GCM encrypt(wallet data)
  • The encryption key is derived from the user's vault password using Argon2
  • The wallet data blob is encrypted with AES-GCM via Web Crypto API
  • On unlock, the password decrypts the blob and keypairs are held in memory
  • On lock, in-memory keypairs are cleared and the password reference is nulled

In-Memory Only Data

Some data is intentionally not persisted:

DataWhy Not Persisted
Bot runtime stateBots should not auto-resume on page load
Decrypted keypairsSecurity — only in memory while vault is unlocked
Vault passwordSecurity — held in singleton only while unlocked
Trade loop timerssetTimeout IDs are not serializable
WebSocket connectionsMust be re-established on page load

Backup & Recovery

Exporting Wallets

Use the Export feature in Treasury Manager to download an encrypted backup of your wallet vault. This backup can be imported on another device or browser.

Data Loss Risks

  • Clearing browser data deletes everything including the encrypted vault
  • Incognito/private mode — localStorage is cleared when the window closes
  • Different browsers — each browser has its own separate localStorage
  1. Export wallet backup after creating new wallets
  2. Store the backup file securely (encrypted drive, password manager)
  3. Test restore on a different browser periodically

Released under the MIT License.