Agent keys on Hyperliquid: can trade, cannot withdraw
What the key your wallet approves can do, what it cannot, and how Hyperliquid's two signing schemes work under the hood.

When you trade Hyperliquid in the Leverra terminal, your wallet pops up once to approve a key, and after that orders go through without a wallet prompt each time.
The problem it solves
Every action on Hyperliquid, from placing an order to cancelling one, must be signed. If your main wallet signed every one, you would click "confirm" in a wallet popup for each order, each cancel and each leverage change. That is slow, and a slow cancel in a fast market costs money.
Hyperliquid's answer is the agent wallet, also called an API wallet: a separate key that your main account authorises to sign trading actions on its behalf.
What an agent can do
An approved agent can sign trading actions for your account:
- place and cancel orders,
- modify orders,
- change leverage and margin mode,
- place TP/SL trigger orders.
What it cannot do
An agent cannot withdraw or transfer funds. Withdrawals and transfers are a different kind of action on Hyperliquid, signed by the account owner's own wallet. An agent's signature is not accepted for them.
So the worst case with a leaked agent key is bad trades on your account, not funds leaving it. That is still a real risk, which is why the key should be treated with care and revoked when you no longer use it.
How Leverra creates and stores it
- When you first trade, the terminal generates a fresh private key in your browser.
- It asks your wallet to sign an
approveAgentaction naming that key's address. This is the only wallet prompt. - The key is stored in your browser's local storage, scoped to the network and your account address. It is never sent to a Leverra server.
- From then on, the terminal signs orders with the agent key and sends them straight from your browser to Hyperliquid's API.
Leverra's servers never see your main wallet's key or the agent key, and Leverra cannot place orders for you.
Under the hood: two kinds of signatures
Hyperliquid uses two signing schemes, and the agent flow uses both.
User-signed actions
approveAgent is a user-signed action. Your wallet signs standard EIP-712 typed data:
domain: { name: "HyperliquidSignTransaction", version: "1",
chainId: <your wallet's chain>, verifyingContract: 0x0 }
type: HyperliquidTransaction:ApproveAgent
fields: hyperliquidChain ("Mainnet" | "Testnet"),
agentAddress, agentName, nonceBecause it is plain EIP-712, your wallet shows you readable fields: which address you are approving, on which network. The signatureChainId in the action is your wallet's current chain, so you do not need to switch networks to sign.
L1 actions, signed by the agent
Orders, cancels and leverage updates are L1 actions. They use a scheme the Hyperliquid SDKs call a phantom agent:
- The action is serialised with MessagePack, followed by the nonce and an optional vault address.
- That byte string is hashed with keccak256. The hash becomes a
connectionId. - The agent key signs a tiny EIP-712 message
Agent { source, connectionId }under the domainExchangewith chain id 1337.sourceis"a"for mainnet and"b"for testnet.
The server recomputes the same hash from the action it receives and recovers the signer. If the recovered address is an approved agent of the account, the action goes through.
The detail that breaks most implementations
MessagePack preserves key order. If your code builds an order object with keys in a different order from what Hyperliquid's server serialises, the hash differs, the recovered address is some random account, and the API answers that the user does not exist. An order action must be type, then orders, then grouping; each order inside must follow its own fixed field order too. Leverra builds these objects with explicit helpers instead of spreading arbitrary objects, and checks the signing against Hyperliquid's live API in its test script.
Nonces
Every action carries a nonce, which in practice is the current time in milliseconds. Hyperliquid keeps a set of recent nonces per signer and rejects reused or very old ones, so a captured signed order cannot be replayed later.
Revoking
You can see and remove approved API wallets in Hyperliquid's own interface. Hyperliquid's docs state that approving a new agent under the same name deregisters the old one (and a new unnamed agent replaces an old unnamed one), and clearing your browser storage deletes the key on your side. If you think a device was compromised, revoke the agent from Hyperliquid directly rather than only clearing the browser.
Why this design
The agent model gives you fast, prompt-free trading without handing custody to anyone. Funds stay in your Hyperliquid account. The only party that can withdraw them is your own wallet. That is the trading layer Leverra is live on today: dapp.leverra.app.
Sources
- Hyperliquid docs: Nonces and API wallets
- Hyperliquid docs: Signing
- Hyperliquid docs: Exchange endpoint
- EIP-712: Typed structured data hashing and signing
- MessagePack
- Hyperliquid Python SDK
Research note, for information only. Not financial advice. Leverra is a permissionless on-chain prop firm for perps: capital stays with partner pools, and Leverra never holds it or guarantees payouts.


