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

# getHistoricalAccountInfo

> 過去のスロット時点、または特定のトランザクション直後の任意の Solana アカウントを、getAccountInfo のエンコーディングと最終書き込み位置を含めて読み取ります。

> [!NOTE]
>
> `getHistoricalAccountInfo` はベータ版です。パラメータ、料金、レスポンス形式、データの対象範囲は変更される可能性があります。

## 概要

`getHistoricalAccountInfo` は、過去のスロット時点、またはそのスロット内の特定のトランザクション直後の Solana アカウントを返します。Helius 独自の RPC メソッドです。標準の `getAccountInfo` は現在の状態のみを返します。

レスポンスには `getAccountInfo` と同じアカウントフィールドに加えて、`lastUpdatedAt` が含まれます。これは、返された状態を最後に書き込んだスロットとトランザクションです。

履歴は、エポック 1030 の開始時点の状態にあたるスロット 444,959,999（2026 年 9 月 7 日）以降で利用できます。それより前のスロットに対するリクエストでは、エラー `-32018` が返されます。

`getHistoricalAccountInfo` は、Business プラン以上のメインネットで利用でき、ベータ期間中は 1 回の呼び出しあたり 0 クレジットです。料金は変更される可能性があります。

## 履歴上の位置を選択する

2 番目のパラメータは、履歴のどの時点を読み取るかを選択するクエリオブジェクトです。

| クエリ | 返されるアカウント |
| - | - |
| 省略または `{}` | リクエストされたコミットメントを上限とする、インデックス作成済みの最新スロット時点 |
| `{ "slot": 445000000 }` | スロット 445,000,000 の終了時点 |
| `{ "slot": 445000000, "transactionIndex": 10 }` | スロット 445,000,000 のインデックス 10 にあるトランザクションの実行直後 |

`transactionIndex` には `slot` が必要です。インデックス `N` のトランザクション直前のアカウントを読み取るには、`transactionIndex: N - 1` をクエリします。スロット内の最初のトランザクションについては、`transactionIndex` を指定せずに前のスロットをクエリします。

エポック報酬など、トランザクション以外による書き込みは、スロットの終了時に適用されます。`transactionIndex` を指定したクエリには、これらは含まれません。

## リクエスト例

```bash theme={"system"}
curl https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "getHistoricalAccountInfo",
    "params": [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      { "slot": 445000000 },
      { "encoding": "jsonParsed" }
    ]
  }'
```

## レスポンスを読み取る

* **`value`** は、リクエストされた位置でのアカウントです。その時点でアカウントが存在しなかった場合、つまりまだ作成されていなかったか、すでに閉じられていた場合は `null` になります。`null` レスポンスには `lastUpdatedAt` がありません。
* **`lastUpdatedAt.slot`** と **`lastUpdatedAt.transactionIndex`** は、この状態を生成した書き込みを識別します。この書き込みは、リクエストした位置以前に行われています。
* エポック報酬など、トランザクション外で書き込みが行われた場合、**`lastUpdatedAt.transactionIndex` は `null`** になります。
* **`lastUpdatedAt.slot` が 444,959,999 で、`transactionIndex` が `null`** の場合、履歴の対象範囲が始まってからアカウントが変更されていないことを意味します。そのスロットでアカウントが書き込まれたという意味ではありません。
* **`context.slot`** は、リクエストの処理時に Helius がインデックスを作成済みだった最新スロットであり、クエリしたスロットではありません。
* **`jsonParsed` トークンアカウント**では、リクエストされた位置でのミントの小数桁数が使用されます。その位置でミントを読み取れない場合、アカウントは base64 にフォールバックします。

アカウントの過去のすべての状態を一覧表示するには、`lastUpdatedAt` をカーソルとして使用します。[アカウント履歴を遡る](https://www.helius.dev/docs/ja/rpc/historical-accounts.md#アカウント履歴を遡る)を参照してください。

## エラー

| コード | 意味 |
| - | - |
| `-32018` | スロットが履歴の対象範囲の開始時点（スロット 444,959,999）より前です |
| `-32004` | スロットが、リクエストされたコミットメントで許可される範囲より新しいです。`confirmed` を使用するか、より古いスロットをクエリしてください |
| `-32602` | `slot` を伴わない `transactionIndex`、`base58` エンコーディング、不明な設定フィールドなど、パラメータが無効です |
| `-32601` | メソッドが見つかりません。Helius のメインネットまたは Gatekeeper エンドポイントを呼び出してください。このメソッドは devnet では利用できません |

## 関連メソッド

> [card] [Historical Accounts Guide](https://www.helius.dev/docs/ja/rpc/historical-accounts.md)
>
> 履歴アカウントメソッドにおける位置、対象範囲、lastUpdatedAt の仕組み

> [card] [getHistoricalTokenAccountsByOwner](https://www.helius.dev/docs/ja/api-reference/rpc/http/gethistoricaltokenaccountsbyowner.md)
>
> 過去のスロット時点におけるウォレットのトークンアカウントを一覧表示します

> [card] [getTransactionsForAddress](https://www.helius.dev/docs/ja/rpc/gettransactionsforaddress.md)
>
> 確認するトランザクションのスロットと transactionIndex を検索します

> [card] [getAccountInfo](https://www.helius.dev/docs/ja/api-reference/rpc/http/getaccountinfo.md)
>
> アカウントの現在の状態を読み取ります

## リクエストパラメータ

**pubkey** `string` *required*

読み取るアカウントの Base-58 エンコードされたアドレスです。

**slot** `number`

状態を読み取るスロットです。このスロットの終了時点でのアカウントを返します。サポートされる最も古いスロットは 444959999 で、エポック 1030 の開始時点の状態です。省略すると、リクエストされたコミットメントを上限として、インデックス作成済みの最新スロットを読み取ります。

**transactionIndex** `number`

スロット内のトランザクションの位置です。スロットの終了時点ではなく、そのトランザクションの実行直後のアカウント状態を返します。slot が必要です。

**encoding** `string` (default: base64)

アカウントデータのエンコード形式です。base58 と binary はサポートされていません。

* `base64`
* `base64+zstd`
* `jsonParsed`

**dataSlice** `object`

各アカウントのデータの一部のみを返します。base64 および base64+zstd エンコーディングに適用されます。

**dataSlice.offset** `number` *required*

読み取りを開始するバイトオフセットです。

**dataSlice.length** `number` *required*

返すバイト数です。

**commitment** `string` (default: finalized)

コミットメントレベルです。processed はサポートされていません。

* `finalized`
* `confirmed`

**minContextSlot** `number`

リクエストを評価できる最小スロットです。


## OpenAPI

````yaml ja/openapi/rpc-http/getHistoricalAccountInfo.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: 過去のスロット時点、またはスロット内の特定のトランザクション直後の任意のアカウント状態を読み取るための、Solanaアカウント履歴APIです。
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: メインネットRPCエンドポイント
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getHistoricalAccountInfo
      description: |
        **ベータ版です。** パラメータ、レスポンス形式、およびデータの対象範囲は変更される可能性があります。

        過去のスロット時点、またはそのスロット内の特定のトランザクション直後の
        Solanaアカウントを返します。このHelius RPCメソッドは、getAccountInfoと同じ
        アドレスおよびエンコーディングオプションに加えて、読み取る履歴上の位置を選択する
        クエリオブジェクトを受け取ります。

        履歴はスロット444959999（エポック1030の開始）以降を対象とします。返される各アカウントには、
        受け取った状態が最後に書き込まれたスロットとトランザクションを示すlastUpdatedAtが
        含まれます。
      operationId: getHistoricalAccountInfo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  example: '2.0'
                  description: JSON-RPCプロトコルのバージョンです。
                  default: '2.0'
                id:
                  type: string
                  example: '1'
                  description: リクエストの一意の識別子です。
                  default: '1'
                method:
                  type: string
                  enum:
                    - getHistoricalAccountInfo
                  example: getHistoricalAccountInfo
                  description: 呼び出すRPCメソッドの名前です。
                  default: getHistoricalAccountInfo
                params:
                  type: array
                  description: アカウントアドレス、履歴上の位置を選択する省略可能なクエリオブジェクト、および省略可能な設定オブジェクトを含む配列です。
                  minItems: 1
                  maxItems: 3
                  default:
                    - EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                    - slot: 445000000
                    - encoding: jsonParsed
                  items:
                    oneOf:
                      - type: string
                        title: 公開鍵
                        description: 読み取るアカウントのBase-58エンコード済みアドレスです。
                        example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      - $ref: '#/components/schemas/HistoricalAccountQuery'
                        title: クエリ
                      - type: object
                        title: 設定
                        description: 省略可能な設定オブジェクトです。
                        properties:
                          encoding:
                            type: string
                            description: アカウントデータのエンコーディング形式です。base58とbinaryはサポートされていません。
                            enum:
                              - base64
                              - base64+zstd
                              - jsonParsed
                            default: base64
                            example: jsonParsed
                          dataSlice:
                            $ref: '#/components/schemas/DataSliceConfig'
                          commitment:
                            type: string
                            description: コミットメントレベルです。processedはサポートされていません。
                            enum:
                              - finalized
                              - confirmed
                            default: finalized
                            example: finalized
                          minContextSlot:
                            type: integer
                            description: リクエストを評価できる最小スロットです。
                            example: 445000000
                        additionalProperties: false
      responses:
        '200':
          description: アカウントの履歴状態を正常に取得しました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPCプロトコルのバージョンです。
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: リクエストと一致する識別子です。
                    example: '1'
                  result:
                    type: object
                    properties:
                      context:
                        $ref: '#/components/schemas/HistoricalContext'
                      value:
                        oneOf:
                          - $ref: '#/components/schemas/HistoricalAccount'
                          - type: 'null'
                        description: 指定された位置でのアカウントです。その時点で存在しなかった場合はnullです。
        '400':
          description: 不正なリクエスト - リクエストパラメータが無効であるか、リクエストの形式が正しくありません。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: 認証されていません - APIキーが無効であるか指定されていません。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: リクエストが多すぎます - レート制限を超過しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: 内部サーバーエラー - サーバーでエラーが発生しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: サービスを利用できません - サービスは一時的に利用できません。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Service unavailable
                id: '1'
        '504':
          description: ゲートウェイタイムアウト - リクエストがタイムアウトしました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Gateway timeout
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    HistoricalAccountQuery:
      type: object
      description: 読み取る履歴上の位置です。省略するか空のオブジェクトを送信すると、インデックス済みの最新スロットを読み取ります。
      properties:
        slot:
          type: integer
          description: >-
            状態を読み取るスロットです。このスロットの終了時点のアカウントを返します。サポートされる最も古いスロットは444959999で、エポック1030の開始時点の状態です。省略した場合、指定されたコミットメントを上限として、インデックス済みの最新スロットを読み取ります。
          minimum: 444959999
          example: 445000000
        transactionIndex:
          type: integer
          description: >-
            スロット内のトランザクションの位置です。スロット終了時点ではなく、そのトランザクションの実行直後のアカウント状態を返します。slotが必要です。
          minimum: 0
          maximum: 16777214
          example: 10
      additionalProperties: false
    DataSliceConfig:
      type: object
      description: 各アカウントのデータの一部分のみを返します。base64およびbase64+zstdエンコーディングに適用されます。
      properties:
        offset:
          type: integer
          description: 読み取りを開始するバイトオフセットです。
          example: 0
        length:
          type: integer
          description: 返すバイト数です。
          example: 8
      required:
        - offset
        - length
    HistoricalContext:
      type: object
      description: レスポンスのメタデータです。
      properties:
        slot:
          type: integer
          description: リクエストの処理時に履歴ストアがインデックスを作成済みだった最新スロットです。照会したスロットではありません。
          example: 468129571
    HistoricalAccount:
      type: object
      description: 指定された位置でのアカウントと、その状態が最後に書き込まれた位置です。
      properties:
        lamports:
          type: integer
          description: このアカウントに割り当てられているlamportの数です。
          example: 531589475273
        owner:
          type: string
          description: このアカウントの割り当て先プログラムのBase-58エンコード済み公開鍵です。
          example: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
        data:
          description: >-
            アカウントデータです。base64またはbase64+zstdの場合、エンコード済みデータとエンコーディングで構成される2要素の配列です。jsonParsedの場合、program、parsed、spaceを含むオブジェクトです。解析できないアカウントはbase64配列にフォールバックします。
          oneOf:
            - type: array
              items:
                type: string
            - type: object
              properties:
                program:
                  type: string
                  description: アカウントを所有するプログラムの名前です。
                  example: spl-token
                parsed:
                  type: object
                  description: プログラム固有の解析済みアカウント状態です。
                space:
                  type: integer
                  description: アカウントのデータサイズです。
                  example: 82
        executable:
          type: boolean
          description: アカウントにプログラムが含まれているかどうかを示します。
          example: false
        rentEpoch:
          type: integer
          description: このアカウントに次回rentが発生するエポックです。rent免除アカウントでは、u64の最大値が返されます。
        space:
          type: integer
          description: アカウントのデータサイズ（バイト単位）です。
          example: 82
        lastUpdatedAt:
          $ref: '#/components/schemas/AccountWritePosition'
      required:
        - lamports
        - owner
        - data
        - executable
        - rentEpoch
        - space
        - lastUpdatedAt
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: JSON-RPCプロトコルのバージョンです。
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: エラーコードです。
              example: -32602
            message:
              type: string
              description: エラーメッセージです。
            data:
              type: object
              description: エラーに関する追加データです。
        id:
          type: string
          description: リクエストと一致する識別子です。
          example: '1'
    AccountWritePosition:
      type: object
      description: 返された状態が、指定された位置以前に最後に書き込まれた位置です。
      properties:
        slot:
          type: integer
          description: >-
            最後に書き込まれたスロットです。値が444959999でtransactionIndexがnullの場合、履歴の対象期間が始まってからアカウントが変更されていないことを示します。
          example: 444999837
        transactionIndex:
          oneOf:
            - type: integer
            - type: 'null'
          description: >-
            最後の書き込みを行ったトランザクションの位置です。トランザクション外で書き込みが行われた場合（エポック報酬など）、または履歴の対象期間が始まってからアカウントが変更されていない場合はnullです。
          example: 700
      required:
        - slot
        - transactionIndex
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Helius
        APIキーです。[ダッシュボード](https://dashboard.helius.dev/api-keys)から無料で取得できます。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.