Odyssey uses a subaccount system to allow a single wallet to interact with multiple isolated markets. There are two types of subaccounts: Primary Accounts, and Market Margin Accouts.

Primary Subaccounts

Primary accounts (id = 0) are special case subaccounts that may not hold any positions on Odyssey. All deposits/withdrawals from the protocol start and end with the primary account. Primary accounts cannot be liquidated. Transfers from the primary subaccount can skip margin checks.

Market Margin Account

All other subaccounts (id > 0) are used to trade within a single market. The subaccount can only be set to operate within 0 or 1 market at a time. If a market is entered, which most commonly occurs when a subaccount trades, only valid collateral for that market (e.g. only WETH or USDC) may be deposited into the particular subaccount.

How subaccounts are addressed

Subaccounts are addressed using a single 32-byte word, and generally are accepted as a BigInt/string-encoded base10 uint256. The rightmost 160 bits are used to store the ETH address/public key for the account's owner. The next 64 bits are used to store the subaccount ID. The final 12 bits are reserved for future use.

Manually generating subaccounts

Subaccounts can be manually generated using an online hex-to-decimal converter, like the one at

First, enter the ETH Address and convert that to decimal. The decimal output is the Primary Subaccount (eg. subaccount_id = 0) of the eth address.

To find the subaccount with id=2, prepend the hex-encoded value "2" before the address. The output is the full subaccount for that address with subaccount id = 2.

Last updated