Concepts
The threat Elyrail is built for#
Assume the attacker controls the agent's text output, for example through a prompt injection in a token name or a web page. They can make the agent call any tool with any arguments.
Elyrail's claim is narrow: even then, the agent cannot move more than the policy allows, to anyone the policy does not allow.
Life of a write#
When an agent calls a write tool, the wallet runs these steps in order. Any step can stop the action.
- Kill switch. If it is engaged, stop.
- Idempotency. A retried key returns the first result instead of acting again.
- Policy, as declared. Agent, chain, time window, rate limit, the rule for this kind of action, and spend caps for the declared amounts.
- Simulation.
eth_simulateV1with transfer tracing. The decoded transfers and approvals must match the declaration exactly: recipient, amount, token, spender. Any approval the action did not ask for is refused. - Policy, as simulated. The caps are checked again against the amounts that actually move.
- Gas caps. Gas limit and fee per gas.
- Reservation, under a lock. The policy is checked once more against fresh state, then the spend, the rate-limit slot and the nonce are reserved. Concurrent requests cannot each pass a cap that together they exceed.
- Human approval, if required. The approver sees a summary built from decoded values and the signing hash. The approval is valid only for that hash.
- Kill switch and chain ID, again. Every RPC endpoint must report the expected chain.
- Sign and verify. The signed transaction is parsed and compared field by field with the request, and its signer is recovered.
- Broadcast, then the receipt. If the receipt moves more tokens than the simulation, or adds approvals, the kill switch engages.
Every decision is written to the audit log.
Policy#
A JSON document, validated strictly and compiled into base units. It is the only place limits are set, and agents can read it (describe_policy) but not change it. See the policy reference.
Simulation is not proof#
A contract can behave differently in simulation than on chain. Elyrail limits the damage three ways:
- Only allowlisted contracts can be called at all.
- Caps bound every action.
- A divergent receipt halts the wallet.
The first divergent transaction can still complete. This is a residual risk, listed on the security page.
Hyperliquid#
Orders are signed by an agent (API) wallet that the account owner approves on Hyperliquid. Hyperliquid itself prevents agent wallets from withdrawing or transferring.
Before signing, Elyrail values each order from Hyperliquid's own mid price and the account's position. It then checks the market allowlist, leverage, order and position notional, distance from mid, the rate limit and the kill switch, and requests approval if the policy says so.
Untrusted text#
Token names, symbols and API strings are untrusted. They are stripped of control, bidirectional and zero-width characters, capped in length, returned as data fields, and listed in untrustedFields. Tool descriptions are static, so no external text ever appears in them.