Skip to main content

Overview

Program Derived Addresses (PDAs) are deterministic addresses derived from seeds and a program ID. Orquestra automatically extracts PDA information from your Anchor IDL and provides endpoints to list and derive PDAs.

List PDA Accounts

Get all PDA-enabled accounts from a project’s IDL, including their seed requirements.

Endpoint

GET /api/:projectId/pda

Response

projectId
string
Project identifier
programId
string
Program ID (base58)
pdaAccounts
array
List of accounts with PDA metadata

Example

curl https://api.orquestra.so/api/my-project/pda

Response Example

{
  "projectId": "my-project",
  "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
  "pdaAccounts": [
    {
      "instruction": "initialize",
      "account": "userAccount",
      "seeds": [
        {
          "kind": "const",
          "description": "user"
        },
        {
          "kind": "account",
          "name": "authority"
        },
        {
          "kind": "arg",
          "name": "id",
          "type": "u64"
        }
      ],
      "customProgram": null
    },
    {
      "instruction": "createToken",
      "account": "associatedTokenAccount",
      "seeds": [
        {
          "kind": "account",
          "name": "owner"
        },
        {
          "kind": "const",
          "description": "0x06ddf6e1d765a193d9cbe146ceeb79ac1cb485ed5f5b37913a8cf5857eff00a9"
        },
        {
          "kind": "account",
          "name": "mint"
        }
      ],
      "customProgram": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
    }
  ]
}

Derive PDA

Derive a specific PDA address by providing the required seed values.

Endpoint

POST /api/:projectId/pda/derive

Request Body

instruction
string
required
Name of the instruction containing the PDA account
account
string
required
Name of the PDA account to derive
seedValues
object
required
Map of seed names to values
  • For arg seeds: provide the argument value (type must match IDL)
  • For account seeds: provide the public key (base58)
  • For const seeds: no value needed (automatically filled)
{
  "authority": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "id": 12345
}

Response

pda
string
Derived PDA address (base58)
bump
number
Bump seed used (0-255)
programId
string
Program ID used for derivation
seeds
array
List of seeds used in derivation

Example

curl -X POST https://api.orquestra.so/api/my-project/pda/derive \
  -H "Content-Type: application/json" \
  -d '{
    "instruction": "initialize",
    "account": "userAccount",
    "seedValues": {
      "authority": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
      "id": 12345
    }
  }'

Response Example

{
  "pda": "8qbHbw2BbbTHBW1sbeqakYXVKRQM8Ne7pLK7m6CVfeR",
  "bump": 255,
  "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
  "seeds": [
    {
      "kind": "const",
      "description": "user",
      "hex": "75736572"
    },
    {
      "kind": "account",
      "name": "authority",
      "value": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
      "hex": "5f8c6..."
    },
    {
      "kind": "arg",
      "name": "id",
      "value": 12345,
      "hex": "3930000000000000"
    }
  ]
}

Error Responses

400 Bad Request
  • Missing required fields
  • Invalid seed values
  • Invalid public key format
  • Missing required seed value
404 Not Found
  • Project not found or not public
  • Instruction not found
  • Account not found
  • Account has no PDA seeds

PDA Derivation Algorithm

Orquestra uses the standard Solana PDA derivation algorithm:
  1. Concatenate all seed bytes in order
  2. Append the program ID (32 bytes)
  3. Append the bump seed (1 byte, starting at 255)
  4. Compute SHA-256 hash of the concatenated bytes
  5. If the hash is on the ed25519 curve, decrement bump and retry
  6. Return the first valid off-curve address (PDA) and its bump

Seed Encoding

  • Constant seeds: UTF-8 bytes or raw bytes from IDL
  • String args: Raw UTF-8 bytes (no length prefix)
  • Integer args: Little-endian bytes matching the type width
  • Boolean args: Single byte (0 or 1)
  • Public key args/accounts: 32 raw bytes

Cross-Program PDAs

Some accounts (like Associated Token Accounts) are PDAs of a different program. The customProgram field indicates which program to use for derivation.

Use Cases

Wallet Integration

Calculate PDAs before submitting transactions to ensure correct account addresses.

Frontend Development

Derive PDAs client-side without requiring anchor-lang dependencies.

Testing & Debugging

Verify PDA derivation logic matches your program’s behavior.

Account Lookup

Find user-specific accounts by deriving their PDAs from known seeds.

Build docs developers (and LLMs) love