Skip to main content

Technical overview

L1 actions use a phantom agent construction - a temporary signing identity created from your action’s hash. This provides privacy by hashing the actual data before signing.
The Hyperliquid Python SDK v0.18.0+ handles phantom agent construction internally. You don’t need to implement this complexity yourself.

Key characteristics

What is a phantom agent?

A phantom agent is a cryptographic construct that provides privacy for trading operations:
1

Serialize action

Action is serialized using msgpack binary format
2

Append metadata

Nonce and vault address (if applicable) are appended
3

Hash the data

Complete data is hashed with keccak256
4

Create agent object

Temporary “agent” object created with hash as connectionId
5

Sign via EIP-712

This phantom agent is signed using EIP-712 typed data

Supported L1 actions

All L1 actions use the same signing method sign_l1_action() - only the action payload changes:

Trading actions

  • order — Place new orders
  • cancel — Cancel orders by order ID
  • cancelByCloid — Cancel orders by client order ID
  • modify — Modify existing orders
  • batchModify — Modify multiple orders

Position management

  • updateLeverage — Adjust leverage for positions
  • updateIsolatedMargin — Manage isolated margin

Transfers

  • vaultTransfer — Transfer between vault accounts
  • subAccountTransfer — Transfer between sub-accounts

Utility

  • scheduleCancel — Schedule order cancellation
  • noop — No operation (for testing)

Complete implementation example

Action payload examples

Place order

Cancel order

Modify order

Update leverage

Technical implementation details

Phantom agent construction

EIP-712 domain

Type definition

TypeScript implementation

Configuration file

Create a config.json file:

Common errors and solutions

Wrong chain ID

Never use Arbitrum’s chain ID (42161) for L1 actions. Always use chain ID 1337.

Invalid action format

Ensure action payloads match the expected structure:

Nonce issues

Always use current timestamp in milliseconds:

Testing your implementation

1

Start with noop

Test with a noop action first - it validates signing without any side effects
2

Use testnet

Test on testnet before mainnet: constants.TESTNET_API_URL or connect to a reliable Hyperliquid RPC endpoint
3

Verify signatures

Check that signatures have proper r, s, v components
4

Monitor responses

Successful actions return {"status": "ok"} or order details

Best practices

DO
  • Use the official SDK when possible
  • Keep private keys secure (use environment variables)
  • Test thoroughly on testnet first
  • Handle errors gracefully
  • Use proper nonce management
DON’T
  • Hardcode private keys in code
  • Mix up chain IDs (1337 vs 0x66eee)
  • Reuse nonces across requests
  • Skip error handling
  • Use outdated SDK versions

Summary

L1 actions use phantom agent construction for privacy - the actual data is hashed before signing. The SDK’s sign_l1_action handles all complexity internally, making it easy to implement trading operations securely.
Last modified on April 13, 2026