過去のアカウント
getHistoricalAccountInfo
過去のスロット時点、または特定のトランザクション直後の任意の Solana アカウントを、getAccountInfo のエンコーディングと最終書き込み位置を含めて読み取ります。
POST
/
getHistoricalAccountInfo
curl --request POST \
--url 'https://mainnet.helius-rpc.com/?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getHistoricalAccountInfo",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{
"slot": 445000000
},
{
"encoding": "jsonParsed"
}
]
}
'import requests
url = "https://mainnet.helius-rpc.com/?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getHistoricalAccountInfo",
"params": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", { "slot": 445000000 }, { "encoding": "jsonParsed" }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getHistoricalAccountInfo',
params: [
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
{slot: 445000000},
{encoding: 'jsonParsed'}
]
})
};
fetch('https://mainnet.helius-rpc.com/?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.helius-rpc.com/?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getHistoricalAccountInfo',
'params' => [
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
[
'slot' => 445000000
],
[
'encoding' => 'jsonParsed'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.helius-rpc.com/?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "1",
"result": {
"context": {
"slot": 468129571
},
"value": {
"lamports": 531589475273,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"data": [
"<string>"
],
"executable": false,
"rentEpoch": 123,
"space": 82,
"lastUpdatedAt": {
"slot": 444999837,
"transactionIndex": 700
}
}
}
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Unauthorized"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Too many requests"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32002,
"message": "Service unavailable"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Gateway timeout"
},
"id": "1"
}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 を指定したクエリには、これらは含まれません。
リクエスト例
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 をカーソルとして使用します。アカウント履歴を遡るを参照してください。
エラー
| コード | 意味 |
|---|---|
-32018 | スロットが履歴の対象範囲の開始時点(スロット 444,959,999)より前です |
-32004 | スロットが、リクエストされたコミットメントで許可される範囲より新しいです。confirmed を使用するか、より古いスロットをクエリしてください |
-32602 | slot を伴わない transactionIndex、base58 エンコーディング、不明な設定フィールドなど、パラメータが無効です |
-32601 | メソッドが見つかりません。Helius のメインネットまたは Gatekeeper エンドポイントを呼び出してください。このメソッドは devnet では利用できません |
関連メソッド
Historical Accounts Guide
履歴アカウントメソッドにおける位置、対象範囲、lastUpdatedAt の仕組み
getHistoricalTokenAccountsByOwner
過去のスロット時点におけるウォレットのトークンアカウントを一覧表示します
getTransactionsForAddress
確認するトランザクションのスロットと transactionIndex を検索します
getAccountInfo
アカウントの現在の状態を読み取ります
リクエストパラメータ
状態を読み取るスロットです。このスロットの終了時点でのアカウントを返します。サポートされる最も古いスロットは 444959999 で、エポック 1030 の開始時点の状態です。省略すると、リクエストされたコミットメントを上限として、インデックス作成済みの最新スロットを読み取ります。
承認
Helius APIキーです。ダッシュボードから無料で取得できます。
ボディ
application/json
このページは役に立ちましたか?
⌘I
getHistoricalAccountInfo
curl --request POST \
--url 'https://mainnet.helius-rpc.com/?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getHistoricalAccountInfo",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{
"slot": 445000000
},
{
"encoding": "jsonParsed"
}
]
}
'import requests
url = "https://mainnet.helius-rpc.com/?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getHistoricalAccountInfo",
"params": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", { "slot": 445000000 }, { "encoding": "jsonParsed" }]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getHistoricalAccountInfo',
params: [
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
{slot: 445000000},
{encoding: 'jsonParsed'}
]
})
};
fetch('https://mainnet.helius-rpc.com/?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.helius-rpc.com/?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getHistoricalAccountInfo',
'params' => [
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
[
'slot' => 445000000
],
[
'encoding' => 'jsonParsed'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.helius-rpc.com/?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getHistoricalAccountInfo\",\n \"params\": [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n {\n \"slot\": 445000000\n },\n {\n \"encoding\": \"jsonParsed\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "1",
"result": {
"context": {
"slot": 468129571
},
"value": {
"lamports": 531589475273,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"data": [
"<string>"
],
"executable": false,
"rentEpoch": 123,
"space": 82,
"lastUpdatedAt": {
"slot": 444999837,
"transactionIndex": 700
}
}
}
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Unauthorized"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Too many requests"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32002,
"message": "Service unavailable"
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Gateway timeout"
},
"id": "1"
}