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

# getStakeMinimumDelegationの使用方法

> getStakeMinimumDelegationのユースケース、コード例、リクエストパラメータ、レスポンス構造、ヒントを学びます。

[`getStakeMinimumDelegation`](https://www.helius.dev/docs/api-reference/rpc/http/getstakeminimumdelegation) RPCメソッドは、Solanaネットワークで新しい[ステーク](https://www.helius.dev/blog/how-to-stake-solana)デリゲーションを作成するために必要な現在の最小ラメンポート数を返します。この値は、ネットワークのガバナンスやアップデートによって時間とともに変わることがあります。

## 一般的な使用例

* **ステーク額の検証:** 新しいステークアカウントを作成したりステークを委任する前に、この値を確認して、予定しているデリゲーションが最小要件を満たしていることを確認します。
* **ステーキングUI/UX:** ユーザーにステーキングインターフェースで最小デリゲーション額を表示し、入力の指針とします。
* **自動ステーキングスクリプト:** 自動ステーキングプロセスが有効なデリゲーション額を使用するようにします。

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

このメソッドには1つのオプションパラメータがあります。

1. **`config`** (object, optional): 次のフィールドを含む設定オブジェクト:

* **`commitment`** (string, optional): 値をクエリするときに使用する[コミットメントレベル](https://www.helius.dev/blog/solana-commitment-levels)を指定します。省略した場合、RPCノードのデフォルトのコミットメントが使用されます（通常は`finalized`）。

## レスポンス構造

JSON-RPCレスポンスの`result`フィールドは、次のものを含む`RpcResponse`オブジェクトです。

* **`context`** (object): 次のフィールドを持つ`RpcResponseContext`オブジェクト。
* **`slot`** (`u64`): データが取得されたスロット。
* **`value`** (`u64`): ラメンポートでの最小ステークデリゲーション額。

**レスポンス例:**

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 123456789 },
    "value": 1000000000 // Represents 1 SOL, for example
  },
  "id": 1
}
```

## 例

### 1. 現在のステーク最小デリゲーションを取得

この例では、デフォルトのコミットメントを使用して現在の最小ステークデリゲーション額を取得します。

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getStakeMinimumDelegation"
    }'
  ```

  ```javascript JavaScript (using @solana/web3.js) theme={"system"}
  // Replace <api-key> with your Helius API key
  const { Connection } = require('@solana/web3.js');

  async function getMinimumDelegation() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    try {
      const minDelegation = await connection.getStakeMinimumDelegation();
      console.log(`Current minimum stake delegation: ${minDelegation} lamports`);
      // The raw response includes context:
      // const fullResponse = await connection.getStakeMinimumDelegation('confirmed'); // Example with commitment
      // console.log(JSON.stringify(fullResponse, null, 2));
    } catch (error) {
      console.error('Error fetching stake minimum delegation:', error);
    }
  }

  getMinimumDelegation();
  ```
</CodeGroup>

### 2. 特定のコミットメントでステーク最小デリゲーションを取得

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getStakeMinimumDelegation",
      "params": [
        {
          "commitment": "confirmed"
        }
      ]
    }'
  ```

  ```javascript JavaScript (using @solana/web3.js) theme={"system"}
  // Replace <api-key> with your Helius API key
  const { Connection } = require('@solana/web3.js');

  async function getMinimumDelegationConfirmed() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    try {
      const minDelegationResponse = await connection.getStakeMinimumDelegation('confirmed');
      console.log(`Confirmed minimum stake delegation: ${minDelegationResponse.value} lamports at slot ${minDelegationResponse.context.slot}`);
    } catch (error) {
      console.error('Error fetching confirmed stake minimum delegation:', error);
    }
  }

  getMinimumDelegationConfirmed();
  ```
</CodeGroup>

## 開発者へのヒント

* **ラメンポートとSOL:** 返される値はラメンポートです。1 SOL = 1,000,000,000ラメンポートであることを覚えておいてください。
* **動的な値:** 最小デリゲーション額は、ネットワークのパラメータによって変化する可能性があります。この値をハードコードするのではなく、定期的または重要な操作の前にクエリすることをお勧めします。詳細なガイドで[ステーキング](https://www.helius.dev/blog/how-to-stake-solana)について学びましょう。
* **コミットメントレベル:** 異なるコミットメントレベルを使用すると、返される値の最新度に影響を与える可能性があります。`finalized`は最も確実性を提供し、`processed`はまだクラスターによって完全に確認されていない新しい値を提供するかもしれません。

このガイドが、Solana上で必要な最小ステークデリゲーションを取得するための`getStakeMinimumDelegation` RPCメソッドの効果的な使用に役立つことを願っています。
