Solana IDL reference › Drift V2 › User

User account layout

Drift V2 account type. Program ID dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH. Data starts with the 8-byte account discriminator, computed with the standard Anchor rule: first 8 bytes of sha256("account:User").

Discriminator (computed with the standard Anchor rule: first 8 bytes of sha256("account:User"))

hex 0x9f755fe3ef973aec

bytes [159, 117, 95, 227, 239, 151, 58, 236]

base58 TfwwBiNJtao

Fields (offsets include the 8-byte discriminator)

FieldTypeOffsetSize
authoritypubkey832
delegatepubkey4032
name[u8; 32]7232
spotPositions[SpotPosition; 8]104320
perpPositions[PerpPosition; 8]424768
orders[Order; 32]11923072
lastAddPerpLpSharesTsi6442648
totalDepositsu6442728
totalWithdrawsu6442808
totalSocialLossu6442888
settledPerpPnli6442968
cumulativeSpotFeesi6443048
cumulativePerpFundingi6443128
liquidationMarginFreedu6443208
lastActiveSlotu6443288
nextOrderIdu3243364
maxMarginRatiou3243404
nextLiquidationIdu1643442
subAccountIdu1643462
statusu843481
isMarginTradingEnabledbool43491
idlebool43501
openOrdersu843511
hasOpenOrderbool43521
openAuctionsu843531
hasOpenAuctionbool43541
marginModeMarginMode43551
poolIdu843561
padding1[u8; 3]43573
lastFuelBonusUpdateTsu3243604
padding[u8; 12]436412

getProgramAccounts filter

Every User account starts with the same discriminator, so a memcmp at offset 0 selects this account type. The second filter matches authority at offset 8. A dataSize: 4376 filter would also work only while live accounts still have the snapshot size; programs often add fields in upgrades, so it is left out here. getProgramAccounts on a large program is heavy; many RPC providers limit or disable it.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccounts",
  "params": [
    "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH",
    {
      "encoding": "base64",
      "filters": [
        {
          "memcmp": {
            "offset": 0,
            "bytes": "TfwwBiNJtao"
          }
        },
        {
          "memcmp": {
            "offset": 8,
            "bytes": "<authority as base58>"
          }
        }
      ]
    }
  ]
}

Decode account data

Decoding runs on Rugsight's server against the bundled snapshot. Nothing is fetched from the chain. Paste public account data only; never paste a private key or seed phrase.

Other Drift V2 account types

Drift V2 instructions · Explain a transaction

Data: solana-idls@1.2.1 (MIT, © Obsidian Protocol) and SPL Token / Token-2022 state layouts (Apache-2.0), snapshot 2026-11-17. Programs can upgrade and an IDL snapshot can lag the deployed program, so check important offsets against current account data.