> For the complete documentation index, see [llms.txt](https://docs.viperexecution.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.viperexecution.com/under-the-hood/security.md).

# Security Model

**Viper can trade for you. It cannot touch your funds.**

At no point does Viper hold, control, or have the ability to withdraw your capital. Your funds stay on Hyperliquid under your own wallet. There is no deposit step, no locked capital, and no counterparty risk from the execution layer.

This isn't a policy — it's enforced at the protocol level.

***

## How It Works

Viper operates through Hyperliquid's **agent wallet architecture**. The agent key used for execution can place and cancel orders only — it cannot withdraw funds, transfer assets, or modify account settings. This restriction is enforced by Hyperliquid's protocol, not by Viper.

Trading authority is granted through an **on-chain builder approval** that you sign during wallet connection. The approval is visible on-chain, scoped to trading actions only, and revocable at any time. If you revoke it, Viper can no longer execute trades on your behalf — immediately, no questions asked.

Your session is authenticated via **Sign In With Ethereum (EIP-4361)** — a standardised challenge-response protocol that proves wallet ownership. Wallets like MetaMask and Rabby display a structured, recognised prompt during sign-in. Trading credentials are stored with server-side encryption and resolved on the backend via authenticated session lookup. The frontend never handles private key material after initial connection.

***

## What Viper Can and Cannot Do

| Action                             | Permitted?                 |
| ---------------------------------- | -------------------------- |
| Place orders                       | ✅ With your approval       |
| Cancel orders                      | ✅ With your approval       |
| Read positions and balances        | ✅ Public chain data        |
| Withdraw funds                     | ❌ Not possible             |
| Transfer assets                    | ❌ Not possible             |
| Change account settings            | ❌ Not possible             |
| Access funds if Viper goes offline | ✅ Funds remain on exchange |

***

## Signing Flow

Connecting to Viper involves three browser-side signatures. At no point does your main wallet's private key leave your browser or reach Viper's servers.

**Sign In (SIWE)** — Your wallet signs a challenge message containing a unique nonce, timestamp, and domain. The server verifies the signature to prove you own the wallet. This is a read-only proof of identity — it grants no permissions.

**Approve Builder Fee** — A Hyperliquid-specific EIP-712 signature authorising the builder fee on your trades. This is recorded on-chain by Hyperliquid and revocable at any time through the exchange interface.

**Approve Agent Wallet** — A Hyperliquid-specific EIP-712 signature authorising a generated agent wallet to trade on your behalf. The agent wallet is scoped to trading actions at the protocol level — it cannot withdraw, transfer, or modify account settings. You can revoke this approval on Hyperliquid at any time.

After these three signatures, the agent key is transmitted once over HTTPS to the backend and encrypted. Your main wallet's private key is never sent, stored, or accessible to Viper.

<details>

<summary>What each signature grants</summary>

| Signature      | Type                  | What it grants                             | What it cannot do                             | Revocable?                    |
| -------------- | --------------------- | ------------------------------------------ | --------------------------------------------- | ----------------------------- |
| Sign In (SIWE) | EIP-191 personal sign | Proves wallet ownership for session        | Cannot trade, withdraw, or approve anything   | Session expires automatically |
| Builder Fee    | EIP-712 (Hyperliquid) | Authorises a fee on your trades            | Cannot access funds or place orders           | Yes — via Hyperliquid         |
| Agent Wallet   | EIP-712 (Hyperliquid) | Authorises an agent to place/cancel orders | Cannot withdraw, transfer, or change settings | Yes — via Hyperliquid         |

All three are standard signing operations — the same kind of signature you perform when connecting to any dApp. No transaction is submitted. No funds are moved. No token approval is granted.

</details>

***

## Credential Security

The agent key is the only secret Viper stores. It follows a strict lifecycle from generation through expiry, with multiple layers of protection.

**No keys in the browser.** The agent key exists in browser memory only during the initial approval flow. It is never written to localStorage, sessionStorage, or any persistent client-side store. After the one-time transfer to the backend, no private key material exists in the frontend.

**Encrypted at rest.** Agent keys are encrypted using AES-256-GCM (Galois/Counter Mode) — an industry-standard authenticated encryption scheme that provides both confidentiality and tamper detection. Each credential is encrypted with a unique nonce. The encryption key is unique to each client deployment — a compromise of one environment cannot decrypt credentials on any other. Encryption keys are rotated as part of routine operations, without service interruption.

**Decrypted only when needed.** The agent key is decrypted in backend memory only for the duration of an algorithm execution. It is not cached, not written to disk, and discarded after use. Every decryption event is rate-limited per wallet and logged to an immutable audit trail.

**Automatic expiry.** Agent wallets on Hyperliquid have an on-chain expiry (typically \~90 days). Viper syncs this expiry and enforces it independently. Even in a worst-case data compromise, the agent keys become unusable after expiry on both Viper and Hyperliquid simultaneously. Proactive expiry warnings are sent well before the deadline, giving you time to rotate credentials without interruption.

**Continuous on-chain validation.** A background watchdog process continuously validates stored agent credentials against Hyperliquid's on-chain registry. If an agent is revoked or expired on-chain, Viper automatically pauses all running algorithms and trade monitors, sends notifications via Telegram and email, and logs the event. This happens within seconds of detection — you don't need to be watching.

**Revocation is instant.** You can revoke your agent wallet on Hyperliquid at any time. The moment the on-chain registry reflects the revocation, Viper detects it and halts all execution. No manual steps required. Viper does not auto-resume after revocation — you assess conditions and explicitly restart when ready.

<details>

<summary>Credential lifecycle</summary>

| Stage      | Location                   | Protection                                                          |
| ---------- | -------------------------- | ------------------------------------------------------------------- |
| Generation | Browser memory (ephemeral) | Never written to any persistent store                               |
| Transit    | HTTPS to backend           | HTTPS (TLS 1.3)                                                     |
| Storage    | Encrypted database column  | AES-256-GCM with unique-per-deployment encryption key               |
| Usage      | Backend process memory     | Decrypted per-execution, held for algo duration only                |
| Expiry     | Synced from Hyperliquid    | On-chain validity enforced, proactive warnings sent                 |
| Revocation | Database soft delete       | Credential marked revoked, audit event logged, all execution paused |

</details>

***

## Infrastructure Isolation

Each client runs on a fully isolated environment. There is no shared state, no shared database, and no shared encryption key between clients.

Every deployment includes an isolated execution environment, a private database, and an encryption key unique to that environment. A compromise of one client's environment yields zero access to any other client's credentials, data, or execution state.

***

## Network Protection

All traffic between your browser and Viper is encrypted in transit (TLS 1.3). The origin infrastructure is not directly reachable from the public internet — application traffic passes through a protective edge layer providing DDoS mitigation, web application firewalling, and rate limiting. Administrative access to the infrastructure is tightly restricted. Detailed network architecture documentation is available to clients on request.

***

## Audit Trail

An immutable audit log captures every credential operation with full attribution — wallet address, event type, client IP, success or failure status, and timestamp. The log covers credential storage, decryption, revocation, expiry, and access attempts on revoked or expired credentials. Retention is 365 days.

Security-relevant events generate real-time alerts to the platform operator. These include anomalous access patterns, credential revocations, and infrastructure health events.

***

## What Happens If Viper Goes Down

All funds remain accessible on Hyperliquid through the exchange's own interface. Open positions can be managed directly on the exchange. Resting orders placed by Viper remain active until filled or cancelled. Running algorithms stop, but no capital is locked, delayed, or inaccessible.

You are never dependent on Viper's availability to access or manage your capital.

***

## Builder Fee

Viper uses Hyperliquid's builder fee mechanism for revenue — a small fee applied to trades executed through the platform. The approval is signed once during wallet connection, the fee rate is visible before signing, and the approval is revocable at any time through Hyperliquid's interface. Fees are settled on-chain, not held by Viper.

<details>

<summary>Trust boundaries</summary>

**You → Viper:** Trust is scoped to order execution only. Revocable, verifiable on-chain. No fund access.

**Viper → Exchange:** Hyperliquid is treated as ground truth for all position, order, and balance data.

**Frontend → Backend:** Credentials never leave the backend. The frontend operates via authenticated API calls. No private key material exists in the browser after initial connection.

**Viper → Funds:** No trust required. Viper has no withdrawal capability by design.

</details>
