> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hashdit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana Transaction Simulation

> Simulate one or more Solana transactions.

<Note>
  Request fields accept both `camelCase` and `snake_case`. See [Request Field Names](/#request-field-names).
</Note>

Simulate one or more Solana transactions before they are broadcast. Same envelope, errors, and headers as [Transaction Simulation](/api-reference/endpoint/emulate), with Solana-shaped per-transaction fields.

Each item in `sol_transactions` is **one of two shapes**: a serialized transaction (`transaction` + optional `encoding`), or a structured transaction (`feePayer` + `instructions`). Alias `transactions` is also accepted for the array.

<Warning>
  Unlike the EVM endpoint, unrecognized fields on this endpoint are **dropped**, not forwarded. A typo is silently ignored rather than rejected.
</Warning>

<Note>
  This endpoint has no `approve_changes`, `ownership_changes`, `call_graph`, `balance_table`, `logs`, `revert`, or `revert_reason`. Solana has no ERC-20 approvals or EVM-style internal calls as primitives. Per-transaction failure is reported in `error` (`null` on success).
</Note>

<Note>
  Native SOL balance changes use `token_address: "native"`.
</Note>

## `risk_level` Scale

Used in `involved_addresses_risks`. Same scale as Transaction Simulation.

| Value   | Meaning                                                    |
| ------- | ---------------------------------------------------------- |
| `0`     | No known risk.                                             |
| `1`     | Low risk.                                                  |
| `2`–`5` | Increasing risk.                                           |
| `-1`    | Not present in HashDit's database — *unknown*, not *safe*. |

<Note>
  A failed simulation is still a successful API call. The envelope stays `code: "0"`, `status: "ok"`. Read `exec_summary.result_code` and `results[i].error`. Only infrastructure failures produce non-`"0"` codes. `compute_units_consumed` is `0` on simulator failure.
</Note>


## OpenAPI

````yaml POST /v2/hashdit/solana-emulate
openapi: 3.1.0
info:
  title: HashDit API
  description: >-
    HashDit threat intelligence API for domain security analysis, blockchain
    address classification, address poisoning detection, address security
    assessment, transaction simulation, transaction security, token security,
    Solana token security, token approval security, and EIP-712 signature
    security
  version: 2.0.0
servers:
  - url: https://service.hashdit.io
security: []
paths:
  /v2/hashdit/solana-emulate:
    post:
      summary: Solana Transaction Simulation
      description: Simulate one or more Solana transactions.
      operationId: solanaEmulate
      parameters:
        - name: X-API-KEY
          in: header
          description: Your HashDit API key
          required: true
          schema:
            type: string
      requestBody:
        description: Solana transactions to simulate
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SolanaEmulateRequest'
            examples:
              Serialized transaction:
                summary: Most common — serialized tx (base64 or base58)
                value:
                  sol_transactions:
                    - transaction: AfgyfPp6V8GhP...base64...==
                      encoding: base64
                      name: user-swap
                  requested_items:
                    balance_changes: true
                    involved_address_risks: true
              Structured transaction:
                summary: HashDit assembles the transaction from instructions
                value:
                  sol_transactions:
                    - feePayer: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      name: user-swap
                      instructions:
                        - programId: '11111111111111111111111111111111'
                          keys:
                            - pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                              isSigner: true
                              isWritable: true
                            - pubkey: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
                              isSigner: false
                              isWritable: true
                          data: AQIDBA==
                  requested_items:
                    balance_changes: true
                    involved_address_risks: true
      responses:
        '200':
          description: >-
            Successful API call. A failed simulation still returns `code: "0"`
            and `status: "ok"` — read `exec_summary.result_code` and
            `results[i].error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SolanaEmulateResponse'
              examples:
                Successful simulation:
                  summary: Simulation completed
                  value:
                    code: '0'
                    status: ok
                    data:
                      exec_summary:
                        result_code: '000000000'
                        result_description: Successful simulation.
                        error_data: null
                      results:
                        - from: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          to: '11111111111111111111111111111111'
                          compute_units_consumed: 12345
                          called_addresses:
                            - '11111111111111111111111111111111'
                          involved_addresses:
                            - '11111111111111111111111111111111'
                            - DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
                            - EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          involved_addresses_risks:
                            - address: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
                              risk_level: 1
                          balance_changes:
                            - token_address: native
                              tokenName: Solana
                              symbol: SOL
                              divisor: '9'
                              change_list:
                                - address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                                  amount_change: '-1.000005'
                                  delta_value: '-1000005000'
                                - address: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
                                  amount_change: '1.0'
                                  delta_value: '1000000000'
                          error: null
                          name: user-swap
                          block_height: 355123456
                          request_id: a4883040-96fe-4192-ad34-99ff9cdf0e5e
                Simulation error:
                  summary: 'Envelope still `code: "0"`; failure is in `error`'
                  value:
                    code: '0'
                    status: ok
                    data:
                      exec_summary:
                        result_code: <non-zero>
                        result_description: Simulation did not complete normally.
                        error_data: BlockhashNotFound
                      results:
                        - from: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          to: '11111111111111111111111111111111'
                          compute_units_consumed: 0
                          called_addresses: []
                          involved_addresses: []
                          balance_changes: []
                          error: BlockhashNotFound
                          name: user-swap
                          request_id: a4883040-96fe-4192-ad34-99ff9cdf0e5e
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
components:
  schemas:
    SolanaEmulateRequest:
      type: object
      required:
        - sol_transactions
      properties:
        sol_transactions:
          type: array
          minItems: 1
          description: >-
            Transactions to simulate. Minimum 1. Alias `transactions` also
            accepted. Each item is either a serialized transaction or a
            structured transaction.
          items:
            $ref: '#/components/schemas/SolanaTransaction'
        requested_items:
          $ref: '#/components/schemas/SolanaEmulateRequestedItems'
    SolanaEmulateResponse:
      type: object
      properties:
        code:
          type: string
          description: >-
            API status code. `"0"` indicates the API call succeeded, including
            when a simulation reports `error`.
          example: '0'
        status:
          type: string
          example: ok
        data:
          $ref: '#/components/schemas/SolanaEmulateData'
    SolanaTransaction:
      oneOf:
        - $ref: '#/components/schemas/SolanaSerializedTransaction'
        - $ref: '#/components/schemas/SolanaStructuredTransaction'
      description: Serialized (`transaction`) or structured (`feePayer` + `instructions`).
    SolanaEmulateRequestedItems:
      type: object
      properties:
        balance_changes:
          type: boolean
          default: true
          description: Net token balance change per holder.
        involved_address_risks:
          type: boolean
          default: false
          description: HashDit risk level for involved addresses.
    SolanaEmulateData:
      type: object
      properties:
        exec_summary:
          $ref: '#/components/schemas/EmulateExecSummary'
        results:
          type: array
          description: One entry per input transaction, in submission order.
          items:
            $ref: '#/components/schemas/SolanaEmulateResult'
    CurrentServiceError:
      type: object
      properties:
        code:
          type: string
          description: >-
            Error code. Typically `-1` for client errors, `-2` for server
            errors, or `401` / `429` for auth and rate limits.
        status:
          type: string
          description: Short error status string.
        detail:
          type: string
          description: Human-readable explanation of the error.
      required:
        - code
        - status
    MissingAPIKeyErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: '`401`'
          example: '401'
        status:
          type: string
          description: Missing API key
          example: Missing API key
        detail:
          type: string
          description: Missing API key
          example: Missing API key
      required:
        - code
        - status
        - detail
    RateLimitExceededErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: '`429`'
          example: '429'
        status:
          type: string
          description: '`error`'
          example: error
        message:
          type: string
          description: Rate limit exceeded
          example: Rate limit exceeded
    SolanaSerializedTransaction:
      title: Serialized transaction
      type: object
      required:
        - transaction
      properties:
        transaction:
          type: string
          description: Serialized transaction. Versioned (V0) and legacy both work.
          example: AfgyfPp6V8GhP...base64...==
        encoding:
          type: string
          enum:
            - base64
            - base58
          default: base64
          description: '`"base64"` (default) or `"base58"`.'
        name:
          type: string
          description: Label echoed back in the matching result.
    SolanaStructuredTransaction:
      title: Structured transaction
      type: object
      required:
        - feePayer
        - instructions
      properties:
        feePayer:
          type: string
          description: Base58 public key paying fees.
          example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
        instructions:
          type: array
          description: Ordered instructions. Key order matters.
          items:
            $ref: '#/components/schemas/SolanaInstruction'
        name:
          type: string
          description: Label echoed back in the matching result.
    EmulateExecSummary:
      type: object
      properties:
        result_code:
          type: string
          description: >-
            `"000000000"` when every transaction simulated normally. Any other
            value means the simulation did not complete normally — read
            `result_description` and `error_data`.
          example: '000000000'
        result_description:
          type: string
          description: Human-readable explanation of `result_code`.
          example: Successful simulation.
        error_data:
          type:
            - string
            - 'null'
          description: '`null` on success. On a revert, the decoded revert reason.'
          example: null
    SolanaEmulateResult:
      type: object
      properties:
        from:
          type:
            - string
            - 'null'
          description: Fee payer (base58).
        to:
          type:
            - string
            - 'null'
          description: >-
            First program ID invoked. `null` when the transaction has no
            instructions.
        compute_units_consumed:
          type: integer
          description: Solana's analogue to gas. `0` on simulator failure.
        called_addresses:
          type: array
          description: Program IDs touched, in execution order.
          items:
            type: string
        involved_addresses:
          type: array
          description: Fee payer + program IDs + accounts appearing in balance changes.
          items:
            type: string
        involved_addresses_risks:
          type: array
          description: >-
            `{address, risk_level}`. Only when `involved_address_risks` was
            requested.
          items:
            $ref: '#/components/schemas/EmulateAddressRisk'
        balance_changes:
          type: array
          description: 'Same shape as EVM. Native SOL uses `token_address: "native"`.'
          items:
            $ref: '#/components/schemas/EmulateBalanceChange'
        error:
          type:
            - string
            - 'null'
          description: >-
            `null` on success; otherwise the Solana error, e.g.
            `"BlockhashNotFound"`.
        name:
          type: string
          description: Echoed from the input.
        block_height:
          type: integer
          description: Slot simulated against.
        request_id:
          type: string
          description: Per-request UUID — quote this in support requests.
    SolanaInstruction:
      type: object
      required:
        - programId
        - keys
      properties:
        programId:
          type: string
          description: Program ID (base58).
        keys:
          type: array
          description: Account keys. Order matters.
          items:
            $ref: '#/components/schemas/SolanaInstructionKey'
        data:
          type: string
          description: Instruction data, base64.
    EmulateAddressRisk:
      type: object
      properties:
        address:
          type: string
        risk_level:
          type: integer
          description: >-
            `0` no known risk; `1` low risk; `2`–`5` increasing risk; `-1` not
            in HashDit's database — unknown, not safe.
    EmulateBalanceChange:
      type: object
      properties:
        token_address:
          type: string
          description: >-
            Token contract. Native SOL uses `"native"`. TRC-10 transfers use
            `"trc10:<id>"`.
          example: '0x55d398326f99059ff775485246999027b3197955'
        tokenName:
          type: string
          example: Binance-Peg BSC-USD
        symbol:
          type: string
          example: BSC-USD
        divisor:
          type: string
          description: Token decimals, as a decimal string.
          example: '18'
        tokenPriceUSD:
          type: string
          description: USD unit price used for `value_usd`.
        change_list:
          type: array
          items:
            $ref: '#/components/schemas/EmulateBalanceChangeItem'
    SolanaInstructionKey:
      type: object
      required:
        - pubkey
      properties:
        pubkey:
          type: string
          description: Account public key (base58).
        isSigner:
          type: boolean
          default: false
        isWritable:
          type: boolean
          default: false
    EmulateBalanceChangeItem:
      type: object
      properties:
        address:
          type: string
        amount_change:
          type: string
          description: >-
            Balance change in token units, normalized by the token's decimals
            (`divisor`). For an 18-decimal token, `delta_value`
            `"1000000000000000000"` is the equivalent of `amount_change` `"1"`.
            Negative means the address sent tokens. Use this for display;
            `delta_value` is the same change in raw smallest units.
        begin_value:
          type: string
          description: Balance before, raw smallest-unit decimal string.
        delta_value:
          type: string
          description: Change, raw smallest-unit decimal string.
        end_value:
          type: string
          description: Balance after, raw smallest-unit decimal string.
        value_usd:
          type: string
          description: >-
            The dollar amount changed, calculated as `amount_change ×
            tokenPriceUSD`.
  responses:
    BadRequest:
      description: >-
        Bad request — malformed or missing field, unsupported chain, or invalid
        address.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CurrentServiceError'
          examples:
            Invalid request:
              summary: Malformed or missing field
              value:
                code: '-1'
                status: invalid request
                detail: …
            Unsupported chain:
              summary: Chain not enabled for this endpoint
              value:
                code: '-1'
                status: unsupported chain
                detail: 'unsupported chainId: 137'
            Invalid address:
              summary: Address fails the format check for that chain
              value:
                code: '-1'
                status: invalid address
                detail: …
    Unauthorized:
      description: >-
        Missing or invalid `X-API-KEY`. This is the response customers see on
        current-service endpoints.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MissingAPIKeyErrorResponse'
          examples:
            Missing API key:
              summary: Missing or invalid API key
              value:
                code: '401'
                status: Missing API key
                detail: Missing API key
    UnprocessableEntity:
      description: Schema validation failed. `detail` names the failing field path.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CurrentServiceError'
          examples:
            Field required:
              summary: Schema validation
              value:
                code: '-1'
                status: invalid request
                detail: 'chainId: field required'
            Field path:
              summary: detail names the failing field path
              value:
                code: '-1'
                status: invalid request
                detail: evm_transactions[0].from
    RateLimitExceeded:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitExceededErrorResponse'
          examples:
            Rate limit exceeded:
              summary: Rate limit exceeded error
              value:
                code: '429'
                status: error
                message: Rate limit exceeded
    InternalServerError:
      description: Server-side failure
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CurrentServiceError'
          examples:
            Internal server error:
              summary: Internal server error
              value:
                code: '-2'
                status: internal server error
                detail: internal server error
    BadGateway:
      description: Upstream analysis service failed. Simulation endpoints only.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CurrentServiceError'
          examples:
            Bad gateway:
              summary: Upstream failure
              value:
                code: '-2'
                status: bad gateway
                detail: …
    GatewayTimeout:
      description: Upstream timed out. Simulation endpoints only.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CurrentServiceError'
          examples:
            Gateway timeout:
              summary: Upstream timeout
              value:
                code: '-2'
                status: gateway timeout
                detail: upstream service timed out

````