ERPC Solana RPC エンドポイント ドキュメント
Solana RPC エンドポイント
ERPC の Solana RPC エンドポイントは、Dashboard で発行した API key を
api-key パラメータに追加するだけで利用できます。HTTP の RPC endpoint と WebSocket は同じホストを使えるため、ウォレット、トレーディングボット、DeFi アプリの Solana エンドポイントとしてそのまま組み込めます。api-key パラメータにあなたの API key を追加してください。text
https://edge.erpc.global?api-key=<YOUR_API_KEY>https://edge.erpc.global?api-key=<YOUR_API_KEY>使用例:
HTTP 経由での呼び出し例です。
bash
curl https://edge.erpc.global?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
"jsonrpc":"2.0","id":1,
"method":"getBlockHeight"
}'curl https://edge.erpc.global?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
"jsonrpc":"2.0","id":1,
"method":"getBlockHeight"
}'WebSocket を使った購読の例です。接続先は HTTP と同じホストを使用します。
text
wss://edge.erpc.global?api-key=<YOUR_API_KEY>wss://edge.erpc.global?api-key=<YOUR_API_KEY>bash
# 例: slot の更新を購読
wscat -c "wss://edge.erpc.global?api-key=<YOUR_API_KEY>"
# 接続後に次の JSON を送信
{"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}# 例: slot の更新を購読
wscat -c "wss://edge.erpc.global?api-key=<YOUR_API_KEY>"
# 接続後に次の JSON を送信
{"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}API key は ERPC Web Dashboard 上にて取得、確認いただけます: ERPC Web Dashboard
WebSocket よりも高速な通信をお求めの方は Geyser gRPC や ShredStream の利用をご検討ください。詳細は ERPC Web Dashboard にてご相談いただけます。
ヒストリーアクセスの使い方
edge.erpc.global への HTTP リクエストに history=true を付けると、古いブロックやトランザクションを取得できます。付けなければ、getTransactionsForAddress 以外はノードの最近の範囲から返ります。history=true(値は小文字の true のみ有効)の対象メソッド:getBlockgetBlockTimegetBlocksgetBlocksWithLimitgetTransaction(getParsedTransactionを含む)getSignaturesForAddressgetSignatureStatuses(searchTransactionHistory: trueのとき)getTransactionsForAddress(transactionDetails: "full"のとき。history=trueが必須)
api-key パラメータで渡す場合です。text
https://edge.erpc.global?api-key=<YOUR_API_KEY>&history=truehttps://edge.erpc.global?api-key=<YOUR_API_KEY>&history=trueヘッダー
Authorization: Bearer <YOUR_API_KEY> で渡す場合です。text
https://edge.erpc.global?history=truehttps://edge.erpc.global?history=trueBearer ヘッダーを使った呼び出し例です。
bash
curl 'https://edge.erpc.global?history=true' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0","id":1,
"method":"getBlock",
"params":[<SLOT>,{"maxSupportedTransactionVersion":1}]
}'curl 'https://edge.erpc.global?history=true' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0","id":1,
"method":"getBlock",
"params":[<SLOT>,{"maxSupportedTransactionVersion":1}]
}'getTransactionsForAddress の full モードを除き、料金は次のとおりです。- ヒストリーアクセスで結果が返った場合は、
null・空・一部の結果でも、呼び出し 1 回あたり 640 トークンが上乗せされます(getBlock は 42 + 640 で 682)。 - 上乗せは、バッチ内では呼び出しごとに、getSignatureStatuses では署名ごとではなく呼び出しごとに数えます。
- ヒストリーアクセスでの取得に失敗した場合と、最近の範囲から返った場合は上乗せされません。着地待ちのポーリングには付けないでください。
Free プランなどの枠には、ヒストリーアクセスに使える量の上限があり、Free プランのヒストリーアクセスは 10 秒に 1 リクエストまでです。
edge.erpc.global への HTTP リクエストで getTransactionsForAddress の full モード(transactionDetails: "full")を使うときは、次のとおりです。history=trueが必須です。付けない場合は、トランザクションの新旧を問わず-32011のエラーが返り、料金はかかりません。- 通常の料金 420 トークンに、取得できたトランザクション 1 件ごとに 640 トークンが上乗せされます(N 件なら 420 + 640 × N)。トランザクションの新旧を問わず上乗せされ、
transactionがnullの行と空の結果には上乗せされません。 - バッチには入れられません。入れると、
history=trueの有無にかかわらず、バッチ内のすべての呼び出しに-32600のエラーが返ります。メッセージはThis request is not available in a mixed JSON-RPC batch. Please send it as a separate request.です。
デフォルトの
signatures モード(transactionDetails: "signatures")では、history=true は不要で、上乗せもありません。アドレスの新しいトランザクションを待つ場合は、signatures モードで署名を受け取り、必要なトランザクションは getTransaction で取得してください。ヒストリーアクセスは、通常のリクエストよりずっと時間がかかることがあり、秒単位になることもあります。
history=true で分けているため、通常のリクエストは速いまま保てます。history=true なしで古い slot を取得すると、次のエラーが返ることがあります。json
{
"jsonrpc": "2.0",
"error": {
"code": -32011,
"message": "This request needs history access. Add history=true to the endpoint URL.",
"data": {
"erpcCode": "ERPC_HISTORY_OPTION_REQUIRED"
}
},
"id": 1
}{
"jsonrpc": "2.0",
"error": {
"code": -32011,
"message": "This request needs history access. Add history=true to the endpoint URL.",
"data": {
"erpcCode": "ERPC_HISTORY_OPTION_REQUIRED"
}
},
"id": 1
}getBlock・getBlockTime では上のエラー、getTransaction・getParsedTransaction・getSignatureStatuses(searchTransactionHistory: true のとき)では null、getSignaturesForAddress・getBlocks・getBlocksWithLimit では空や一部の結果が、それぞれ返ることがあります。ヒストリーアクセスのリクエストに返ることがあるエラーです。
This plan has reached its limit for history access. Add a paid plan to use tokens for history access.(ヒストリーアクセスに使える量の上限に達したとき)History access is unavailable while your token balance is low. Add tokens.(有料プランでトークンの残高が少ないとき)On the Free plan, history access is limited to one request per 10 seconds. Slow down or use a paid plan.(Free プランでリクエストの間隔が短いとき)
Unlimited Endpoint の対応メソッド
Unlimited Endpoint は、低レイテンシな standard Solana RPC を高速に利用するための専有 HTTP エンドポイントです。
| 種別 | Unlimited Endpoint |
|---|---|
| 対応する standard Solana RPC メソッド | getSlot, getBlockHeight, getLatestBlockhash, getBalance, getAccountInfo, getMultipleAccounts, getTransaction, sendTransaction, simulateTransaction, getSignatureStatuses, getRecentPrioritizationFees, getHealth, getVersion, getEpochInfo, getBlock |
対応メソッド以外は
https://edge.erpc.global?api-key=<YOUR_API_KEY> を利用してください。Solana RPC メソッドとドキュメント
詳細なメソッド一覧やパラメータ、サブスクリプション仕様は公式ドキュメントをご参照ください。HTTP と WebSocket の利用方法がまとめられています。






