> ## 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.

# Solana プライオリティ料金 API：スマートなトランザクション料金の推定

> Solana のトランザクションの最適なプライオリティ料金を推定します。迅速な確認とコスト効率を確保するための6段階のプライオリティレベルによるリアルタイム料金分析。

<Info>
  **コストを節約し、パフォーマンスを向上**: リアルタイムのネットワーク状況に基づいた正確なプライオリティ料金を取得します。望みの速度に対し必要な分だけ支払うことができます。
</Info>

## プライオリティ料金とは？

Solanaでのプライオリティ料金は、ネットワークの混雑時にトランザクションをバリデータキューの前に移動させるためのものです。それはトランザクションのための高速レーンのようなものです。

<CardGroup cols={2}>
  <Card title="基本料金 vs プライオリティ料金" icon="coins">
    **基本料金**はトランザクション処理の固定コストです

    **プライオリティ料金**は高速処理のためのオプションの支払いです
  </Card>

  <Card title="仕組み" icon="rocket">
    コンピュート単位あたりの価格を設定し、ネットワークの混雑時には高い価格が優先して処理されます
  </Card>
</CardGroup>

## なぜプライオリティ料金を使用するのか

プライオリティ料金は、Solana トランザクションの標準的な一部となり、信頼性のある確認時間と最適なネットワークパフォーマンスを確保するのに役立ちます。

<CardGroup cols={2}>
  <Card title="信頼性のある確認" icon="circle-check">
    様々なネットワーク状況でもトランザクションが迅速かつ確実に確認されることを保証します
  </Card>

  <Card title="競争力" icon="trophy">
    取引、ミンティング、DeFiの相互作用のような時間が重要な操作で競争力を維持します
  </Card>

  <Card title="ユーザー体験" icon="heart">
    より良いユーザー体験のために一貫した迅速なトランザクション処理を提供します
  </Card>

  <Card title="ネットワーク効率" icon="gauge">
    ネットワークリソースの配分と全体的なパフォーマンスを最適化するのに役立ちます
  </Card>
</CardGroup>

## プライオリティレベルの説明

当社のAPIは、最近のネットワーク活動に基づいた6つのプライオリティレベルを提供します：

<AccordionGroup>
  <Accordion title="Min">
    **最低観測料金** - 最近のスロットで見られた最小料金に基づく

    **最適**: コスト最適化を重視する非緊急トランザクション

    **注意**: 確認時間が遅れる可能性があります
  </Accordion>

  <Accordion title="Low">
    **25パーセンタイル** - 手頃な価格で合理的な確認時間

    **最適**: 速度が重要でない標準操作

    **注意**: コストと信頼性の良いバランス
  </Accordion>

  <Accordion title="Medium (推奨)>">
    **50パーセンタイル** - 信頼性のある確認時間を提供する中央値料金

    **最適**: ほとんどのアプリケーションと一般的な使用ケース

    **注意**: ほとんどの開発者にとっての推奨開始点
  </Accordion>

  <Accordion title="High">
    **75パーセンタイル** - より速い処理のための高い料金

    **最適**: 時間が重要な操作と競争的な状況

    **注意**: ネットワーク活動中の優先処理
  </Accordion>

  <Accordion title="VeryHigh">
    **95パーセンタイル** - 最大速度のためのプレミアム料金

    **最適**: 重要な操作、MEV戦略、緊急トランザクション

    **注意**: 高いネットワーク活動中でも迅速な確認
  </Accordion>

  <Accordion title="UnsafeMax">
    **最大観測** - 最近のスロットで見られた最高料金

    **最適**: 緊急事態のみ

    **警告**: 不必要に高いことが多い - 使用は注意が必要
  </Accordion>
</AccordionGroup>

<Warning>
  **コスト計算**: 総プライオリティ料金 = コンピュート単位あたりの価格 × 消費されたコンピュート単位

  通常のトランザクションは 200,000 〜 400,000 コンピュート単位を使用します。現在のMediumレベル（単位あたり約40,000マイクロランポート）では、プライオリティ料金は0.000008〜0.000016 SOLです。正確な推定のために常に現在のネットワーク状況を確認してください。
</Warning>

## 実装方法

<CardGroup cols={2}>
  <Card title="シリアライズされたトランザクション（推奨）" icon="file-code" href="/ja/priority-fee/estimating-fees-using-serialized-transaction">
    **主要な方法** - 正確性を最大限にするために正確なトランザクションを分析します

    **最適**: ほとんどのアプリケーションとプロダクションの使用ケース

    **利点**:

    * インストラクション固有の分析
    * 最高の正確性
    * プロダクション準備完了
    * トランザクションの複雑性を考慮
  </Card>

  <Card title="アカウントキー（高度）" icon="key" href="/ja/priority-fee/estimating-fees-using-account-keys">
    **特化した使用ケース** - アカウントパターンに基づく推定

    **最適**: トランザクション前の分析、バッチ操作、特化したアーキテクチャ

    **利点**:

    * アカウントレベルのパターン分析
    * 計画と研究に有益
    * バッチアカウント分析
  </Card>
</CardGroup>

## クイックスタート例

<CodeGroup>
  ```javascript JavaScript theme={"system"}
  import { Transaction, SystemProgram, ComputeBudgetProgram } from "@solana/web3.js";
  import bs58 from "bs58";

  // 1. Build your transaction (without priority fee)
  const transaction = new Transaction();
  const transferIx = SystemProgram.transfer({
    fromPubkey: senderKeypair.publicKey,
    toPubkey: recipientPublicKey,
    lamports: 1000000, // 0.001 SOL
  });
  transaction.add(transferIx);

  // 2. Set required fields and serialize
  transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
  transaction.feePayer = senderKeypair.publicKey;
  const serializedTx = bs58.encode(transaction.serialize());

  // 3. Get priority fee estimate
  const response = await fetch("https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: "1",
      method: "getPriorityFeeEstimate",
      params: [{
        transaction: serializedTx,
        options: { 
          priorityLevel: "Medium",
          recommended: true 
        }
      }]
    })
  });

  const result = await response.json();
  const priorityFee = result.result.priorityFeeEstimate;

  // 4. Add priority fee and send
  transaction.instructions = []; // Reset
  transaction.add(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFee }));
  transaction.add(transferIx);
  transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
  transaction.sign(senderKeypair);
  ```

  ```python Python theme={"system"}
  import requests
  import base58
  from solana.transaction import Transaction
  from solana.system_program import transfer, TransferParams

  # 1. Build and serialize your transaction
  # (transaction building code here)
  serialized_tx = base58.b58encode(transaction.serialize()).decode('utf-8')

  # 2. Get priority fee estimate
  response = requests.post(
      "https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY",
      json={
          "jsonrpc": "2.0",
          "id": "1",
          "method": "getPriorityFeeEstimate",
          "params": [{
              "transaction": serialized_tx,
              "options": {
                  "priorityLevel": "Medium",
                  "recommended": True
              }
          }]
      }
  )

  result = response.json()
  priority_fee = result["result"]["priorityFeeEstimate"]
  print(f"Recommended priority fee: {priority_fee} micro-lamports")

  # 3. Rebuild transaction with priority fee and send
  ```

  ```curl cURL theme={"system"}
  curl -X POST "https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "id": "1",
      "method": "getPriorityFeeEstimate",
      "params": [{
        "transaction": "SERIALIZED_TRANSACTION_BASE58",
        "options": {
          "priorityLevel": "Medium",
          "recommended": true
        }
      }]
    }'
  ```
</CodeGroup>

## API リファレンス

<Card title="getPriorityFeeEstimate" icon="code" href="/ja/api-reference/priority-fee/getpriorityfeeestimate">
  すべてのパラメータと応答フォーマットを含むAPIドキュメンテーション
</Card>

## リアルタイムネットワーク監視

<Tip>
  **プロのヒント**: ネットワーク状況を監視してプライオリティ料金の戦略を最適化してください。通常の状態では低めのプライオリティレベルを使用します。混雑時には、時間が重要な操作には高めのレベルを検討してください。

  現在のネットワーク状況は、Solanaエクスプローラーや`getRecentPerformanceSamples` RPCメソッドを使用して確認できます。
</Tip>

## サポートとリソース

<CardGroup cols={2}>
  <Card title="Discordコミュニティ" icon="discord" href="https://discord.com/invite/6GXdee3gBj">
    コミュニティとHeliusチームから支援を受ける
  </Card>

  <Card title="直接サポート" icon="headset" href="/ja/support">
    プライオリティ料金に関する質問と最適化支援
  </Card>
</CardGroup>
