> ## Documentation Index
> Fetch the complete documentation index at: https://luminouslabs-cc5545c6-docs-main-reorder.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Retrieve the transaction data for the transaction with the given signature along with parsed compression info. RPC method guide with use cases, tips and examples.

# Gettransactionwithcompressioninfo

The`getTransactionWithCompressionInfo` RPC method returns transaction data along with compression information showing which compressed accounts were opened (created) and closed (consumed) during the transaction. This method helps with transaction analysis, account lifecycle tracking, and debugging of compression operations.

<Info>
  You can test this method via the OpenAPI example or custom examples below.
</Info>

**Common Use Cases**

* **Transaction Analysis**: Understand what compressed accounts were affected by a transaction
* **Account Lifecycle Tracking**: Monitor when compressed accounts are created and consumed
* **Debugging**: Identify which accounts changed during failed or unexpected transactions
* **Audit Trails**: Track compressed account state changes for compliance

**Parameters**

1. `signature` (string, required): Base58-encoded transaction signature to query compression information for.

**Note**: Only transactions involving compressed accounts will return compression data. Regular Solana transactions return null.

**Response**

The response contains compression information and transaction data, or null if transaction not found:

* `compressionInfo` (object): Contains details about compressed account changes
  * `closedAccounts` (array): Compressed accounts consumed (spent) in this transaction
    * `account` (object): Complete compressed account data with merkle context
    * `maybeTokenData` (object | null): Token data if this is a compressed token account
  * `openedAccounts` (array): New compressed accounts created in this transaction
    * `account` (object): Complete compressed account data with merkle context
    * `maybeTokenData` (object | null): Token data if this is a compressed token account
  * `preTokenBalances` (array, optional): Token balances before transaction
    * `owner` (PublicKey): Public key of token account owner
    * `mint` (PublicKey): Public key of token mint
    * `amount` (BN): Token amount as BN object
  * `postTokenBalances` (array, optional): Token balances after transaction
    * `owner` (PublicKey): Public key of token account owner
    * `mint` (PublicKey): Public key of token mint
    * `amount` (BN): Token amount as BN object
* `transaction` (object): Standard Solana transaction data

**Developer Tips**

* **Compression-only**: This method only works with transactions that involve compressed accounts
* **Real signatures required**: Use actual transaction signatures from compression operations
* **Account lifecycle**: opened = created, closed = consumed/spent in the transaction
* **Token data**: maybeTokenData is null for regular compressed accounts, populated for token accounts
* **Balance tracking**: Use pre/postTokenBalances for detailed token amount changes
* **State analysis**: Compare opened vs closed accounts to understand transaction effects

**Troubleshooting**

<AccordionGroup>
  <Accordion title="Transaction not found">
    **Invalid or non-existent transaction signature**

    Verify the signature format and check transaction existence:

    ```typescript theme={null}
    const result = await connection.getTransactionWithCompressionInfo(signature);

    if (!result) {
        console.log('Transaction not found or contains no compression operations');
    }
    ```
  </Accordion>

  <Accordion title="No compression info">
    **Transaction exists but has no compression data**

    This method only returns data for transactions involving compressed accounts:

    ```typescript theme={null}
    const result = await connection.getTransactionWithCompressionInfo(signature);

    if (!result) {
        console.log('Transaction does not involve compressed accounts');
        console.log('Use regular getTransaction for non-compression transactions');
    }
    ```
  </Accordion>

  <Accordion title="Empty account arrays">
    **Transaction has compression info but no account changes shown**

    Some compression operations may not create/consume accounts:

    ```typescript theme={null}
    const { compressionInfo } = result;

    if (compressionInfo.openedAccounts.length === 0 &&
        compressionInfo.closedAccounts.length === 0) {
        console.log('Compression transaction with no visible account changes');
        console.log('May be a proof verification or state update operation');
    }
    ```
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml post /getTransactionWithCompressionInfo
openapi: 3.0.3
info:
  title: photon-indexer
  description: Solana indexer for general compression
  license:
    name: Apache-2.0
  version: 0.50.0
servers:
  - url: https://devnet.helius-rpc.com
security: []
paths:
  /getTransactionWithCompressionInfo:
    summary: getTransactionWithCompressionInfo
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                id:
                  type: string
                  description: An ID to identify the request.
                  enum:
                    - test-account
                jsonrpc:
                  type: string
                  description: The version of the JSON-RPC protocol.
                  enum:
                    - '2.0'
                method:
                  type: string
                  description: The name of the method to invoke.
                  enum:
                    - getTransactionWithCompressionInfo
                params:
                  type: object
                  required:
                    - signature
                  properties:
                    signature:
                      $ref: '#/components/schemas/SerializableSignature'
                  additionalProperties: false
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                  id:
                    type: string
                    description: An ID to identify the response.
                    enum:
                      - test-account
                  jsonrpc:
                    type: string
                    description: The version of the JSON-RPC protocol.
                    enum:
                      - '2.0'
                  result:
                    type: object
                    description: >-
                      A Solana transaction with additional compression
                      information
                    properties:
                      compression_info:
                        type: object
                        required:
                          - closedAccounts
                          - openedAccounts
                        properties:
                          closedAccounts:
                            type: array
                            items:
                              $ref: >-
                                #/components/schemas/AccountWithOptionalTokenData
                          openedAccounts:
                            type: array
                            items:
                              $ref: >-
                                #/components/schemas/AccountWithOptionalTokenData
                        additionalProperties: false
                      transaction:
                        type: object
                        description: An encoded confirmed transaction with status meta
        '429':
          description: Exceeded rate limit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                  id:
                    type: string
                  jsonrpc:
                    type: string
        '500':
          description: >-
            The server encountered an unexpected condition that prevented it
            from fulfilling the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                  id:
                    type: string
                  jsonrpc:
                    type: string
components:
  schemas:
    SerializableSignature:
      type: string
      description: A Solana transaction signature.
      default: 5J8H5sTvEhnGcB4R8K1n7mfoiWUD9RzPVGES7e3WxC7c
      example: 5J8H5sTvEhnGcB4R8K1n7mfoiWUD9RzPVGES7e3WxC7c
    AccountWithOptionalTokenData:
      type: object
      required:
        - account
      properties:
        account:
          $ref: '#/components/schemas/Account'
        optionalTokenData:
          $ref: '#/components/schemas/TokenData'
      additionalProperties: false
    Account:
      type: object
      required:
        - hash
        - owner
        - lamports
        - tree
        - leafIndex
        - slotCreated
      properties:
        address:
          $ref: '#/components/schemas/SerializablePubkey'
        data:
          $ref: '#/components/schemas/AccountData'
        hash:
          $ref: '#/components/schemas/Hash'
        lamports:
          $ref: '#/components/schemas/UnsignedInteger'
        leafIndex:
          $ref: '#/components/schemas/UnsignedInteger'
        owner:
          $ref: '#/components/schemas/SerializablePubkey'
        seq:
          $ref: '#/components/schemas/UnsignedInteger'
        slotCreated:
          $ref: '#/components/schemas/UnsignedInteger'
        tree:
          $ref: '#/components/schemas/SerializablePubkey'
      additionalProperties: false
    TokenData:
      type: object
      required:
        - mint
        - owner
        - amount
        - state
      properties:
        amount:
          $ref: '#/components/schemas/UnsignedInteger'
        delegate:
          $ref: '#/components/schemas/SerializablePubkey'
        mint:
          $ref: '#/components/schemas/SerializablePubkey'
        owner:
          $ref: '#/components/schemas/SerializablePubkey'
        state:
          $ref: '#/components/schemas/AccountState'
        tlv:
          $ref: '#/components/schemas/Base64String'
    SerializablePubkey:
      type: string
      description: A Solana public key represented as a base58 string.
      default: 111111131h1vYVSYuKP6AhS86fbRdMw9XHiZAvAaj
      example: 111111131h1vYVSYuKP6AhS86fbRdMw9XHiZAvAaj
    AccountData:
      type: object
      required:
        - discriminator
        - data
        - dataHash
      properties:
        data:
          $ref: '#/components/schemas/Base64String'
        dataHash:
          $ref: '#/components/schemas/Hash'
        discriminator:
          $ref: '#/components/schemas/UnsignedInteger'
      additionalProperties: false
    Hash:
      type: string
      description: A 32-byte hash represented as a base58 string.
      example: 11111112cMQwSC9qirWGjZM6gLGwW69X22mqwLLGP
    UnsignedInteger:
      type: integer
      format: uint64
      default: 100
      example: 100
    AccountState:
      type: string
      enum:
        - initialized
        - frozen
    Base64String:
      type: string
      description: A base 64 encoded string.
      default: SGVsbG8sIFdvcmxkIQ==
      example: SGVsbG8sIFdvcmxkIQ==

````