The security boundaries of API wallets continue to erode, making native access controls a critical weakness.

By DevenMat, Co-founder of Valantis Labs

Compiled by AididiaoJP, Foresight News

Note: The assumptions about Hyperliquid’s state model in this article are based primarily on testnet trading. HyperCore’s state machine is currently a black box: nodes run signed binaries, and the code is not public. The actual cost of introducing permission policies for API wallets can only be estimated through testnet trading and Hyperliquid’s public architectural decisions. Until the node source code is made public, the community’s ability to propose well-informed improvements remains limited.

With Hyperliquid as a liquidity backend, personal agents can build complete financial experiences for users on a unified foundation. Its deep liquidity, composability, programmability, and neutrality make it indispensable financial infrastructure for the agent era.

But HyperCore currently lacks a core security capability that agents depend on: scoped permissions. Permission policies are scoped permissions in practice—for example, allowing trades only in specified markets, requiring approval before opening a position, or prohibiting transfers to unknown addresses. These are the kinds of limited permissions that enable today's non-financial personal agents to safely handle data such as email, calendars, and contacts. Yet over the past year, Hyperliquid has removed support for this kind of scoped API access.

The security boundaries of API wallets (formerly called agent wallets) have steadily eroded to the point where it is no longer appropriate to give agents access to user account permissions. To be clear, AI agents need to use API wallets to operate accounts on Hyperliquid, but current API wallets have excessive permissions and lack restrictions, making it highly risky to hand them directly to AI agents.

This article seeks a way to make Hyperliquid a reliable financial backend for personal agents once again.

AI Agents in Your Wallet

AI agents are a key distribution channel for realizing Hyperliquid's vision of “AWS for liquidity,” and can make Hyperliquid the foundation of everyday financial life for billions of people.

The future of personal finance will involve agents connecting directly to your portfolio and acting on your behalf with explicit authorization, using your funds, credentials, and data. If Hyperliquid is to become the financial layer for these agents, it must provide account-level permission controls: agents should be able to access specific parts of an account, not everything.

Currently, the only viable approach is through CoreWriter, but latency issues make this solution incomplete; another layer of control must be added natively in HyperCore. API wallets themselves must also maintain a minimum security boundary to support the experience agents require.

Handing API wallets directly to AI agents is now highly risky, and the risk continues to grow.

AI Agent Support Has Been Broken

The security boundaries originally designed for API wallets have eroded significantly.

Today, if a user account holds more than approximately $40 million in assets, an attacker who maliciously uses an API wallet can use the account's funds to buy 500,000 HYPE and stake it, then use those staked assets to launch a HIP-3 market under their control. The user's assets involved would then be locked for 183 days and exposed to slashing risk. This series of actions is irreversible—even if the user revokes the API wallet afterward, the damage cannot be undone.

It wasn't always this way. Let's look back at how the boundaries have changed.

In the original design, API wallets could not withdraw or transfer funds from an account.

But the system never limited the amount of margin API wallets could use. If compromised, an attacker could siphon funds by placing malicious orders in illiquid markets, with themselves as the counterparty. In 2022, API keys leaked from the trading bot service 3Commas were used to place orders in users' Binance accounts, targeting the least liquid and most easily manipulated periods.

Beyond these attacks, a series of subsequent upgrades introduced new risk exposures that the original security architecture had never accounted for.

These unrelated upgrades accumulated over time, ultimately rendering API wallet security boundaries largely ineffective.

Risks

API wallets have become the default way for users to trade on Hyperliquid through interfaces. Many wallets now also list custodial API wallets directly in applications built by multiple builders.

For ordinary trading applications, this risk may be acceptable—they only control a portion of their user base, after all. But introducing AI agents dramatically amplifies the risk.

An AI agent doesn't need to steal your API wallet's private key to drain your account. It only needs to be tricked into reading a piece of malicious text. Giving an agent an API wallet exposes all the attack paths described above to anyone who can put a sentence in front of it.

Why Have API Wallet Permissions Kept Expanding?

Smart contracts on HyperEVM interact with HyperCore through CoreWriter, the foundational framework for programmable applications on Hyperliquid. Smart contracts can change HyperCore state in two ways: by calling a CoreWriter action or by using an API wallet.

The simplest way to give smart contracts the same capabilities as regular accounts is to keep adding permissions to API wallets. The better approach would be to add a separate CoreWriter action whenever a new account operation arises that is not latency-sensitive but is security-sensitive. But maintaining CoreWriter costs more—each new action requires its own action ID, node-side support, and a distinct transaction type on HyperCore. By contrast, adding permissions directly to API wallets costs very little and covers both smart contracts and regular accounts.

Meanwhile, nearly all trading infrastructure on HyperCore follows a similar architecture: low-latency API wallet hot keys are deployed close to the network, while cold wallets are kept offline and isolated. Therefore, API wallets must be able to perform all latency-sensitive operations to meet the needs of high-value accounts. This also explains why priority fees are paid from API wallets, and why staking deposits used to replenish priority fee balances were initially added to API wallet permissions—likely at the request of priority fee users.

API wallet permissions keep expanding because different builders rely on them for different needs. The problem is that every upgrade indiscriminately expands external applications' control over user accounts, with no way for users to opt out.

Permission Policies on Hyperliquid

The best way to implement action-level permission controls on Hyperliquid today is to use a smart contract account on HyperEVM to control the corresponding HyperCore address. Every HyperCore action goes through custom Solidity checks before being passed to CoreWriter. We developed Valantis Prime for this purpose: it uses Obsidian's CoreWriterLib and a custom Guardian to make HyperCore trading permissioned and programmable. Its capabilities include:

  • Set signers and thresholds for different actions in HyperCore multisig;

  • Set whitelists and amount limits for HyperCore transfers.

But this design completely fails in trading scenarios.

Trades must be submitted through HyperEVM, pass Solidity checks, and then wait for the next HyperCore block to process the CoreWriter action before they can actually execute. This approach works for operations that are not latency-sensitive, such as staking, transfers, and lending, but cannot meet the low-latency requirements of trading.

For low latency, API wallets must interact directly with HyperCore, but API wallets currently have no constraints or control layer.

Privy provides custodial services that can enforce policies before signing. We believe that without native primitives to restrict account signing permissions, custodial trusted signing middleware will become a critical dependency for many Hyperliquid users. We believe this is neither ideal nor necessary.

Relying on trusted middleware to provide the security primitives agents need on Hyperliquid undermines the very reason agents should thrive here: direct access to trusted, neutral liquidity infrastructure. Once AI agent applications must custody private keys on servers, their potential is greatly diminished. For Hyperliquid's next decade, implementing a policy layer natively in HyperCore is essential.

Proposal: Add Permission Fields for API Wallets

Building a full permission policy layer for API wallets—including margin limits and market selection—would likely violate HyperCore's design principle of minimizing state. We therefore propose minimal, action-level binary permissions.

The implementation should remain flexible and lightweight—a bitmap could record whether each action type is permitted for an API wallet, or an equivalent minimal structure could be used.

Hyperliquid has adopted a similar mechanism for HIP-3 deployers. Using setSubDeployers, deployers can grant or revoke other addresses' permission at any time to call specific perpDeploy variants on their dex—each action is authorized separately, and permission is limited to that action alone.

The same pattern can be applied to API wallets. When a transaction is made, the system recovers the signer, locates the main account, and then checks the permission bit for the relevant action type to determine whether the API wallet is authorized. The only additional state is one bitmap per API wallet.

The core design principle is that API wallet permissions do not expand automatically when the network is upgraded.

Expected benefits include:

API permissions can be safely expanded. Agents that need the relevant permissions can be granted the ability to stake, withdraw, and transfer without compromising the overall security architecture.

New L1 actions or network upgrades will no longer automatically expand the permissions of existing API wallets. Actions can be added to API wallets more freely without compromising overall security.

HyperCore accounts can be fully programmable without relying on custodial infrastructure. Combining CoreWriter with constrained API wallets allows custom security rules to be configured for every action, without causing state bloat in HyperCore.

The core advantages of blockchains are composability and programmability. Early on, Hyperliquid deliberately sacrificed programmability in pursuit of performance. HyperEVM and CoreWriter were introduced to add programmability to HyperCore at low resource cost.

Without a native, minimal API wallet control layer, this capability remains incomplete.