# Staking

1. [Stake API](#stake-request)\
   Returns an unsigned transaction to delegate SOL from your wallet to a validator.
2. [Balance API](#balance)\
   Returns the current balance and status of a wallet or stake account.

## API Reference

* [Stake Request](#stake-request)
  * [Sample Request](#sample-request)
  * [Types](#types)
    * [Stake Response Object](#id-200-ok-stake-response-object)
* [Balance Request](#balance)
  * [Sample Request](#sample-request-1)
    * [Balance Response Object](#id-200-ok-balance-response-object)

## Stake Request

<mark style="color:green;">`POST`</mark> `/api/v1/stake`

Submits a stake request to generate an unsigned transaction. This transaction needs to be signed by the private key of the wallet address and broadcasted to the network to trigger consolidation. This request also creates a stake account and user will have to pay one time rent fee for stake account creation.<br>

#### Headers

| Name                                        | Type   | Description                   |
| ------------------------------------------- | ------ | ----------------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | API Key provided by Luganodes |

#### Request Body

| Name                                              | Type   | Description                                                    |
| ------------------------------------------------- | ------ | -------------------------------------------------------------- |
| validatorPubKey<mark style="color:red;">\*</mark> | String | Public address of validator                                    |
| walletPubKey<mark style="color:red;">\*</mark>    | String | Wallet address                                                 |
| amount<mark style="color:red;">\*</mark>          | Number | <p>Stake amount in lamports. <br><br>1 SOL = 10^9 Lamports</p> |

{% tabs %}
{% tab title="200: OK Stake Response Object" %}

```json
{
    "success": true,
    "data": {
        "validatorPubkey": "6aow5rTURdbhbeMDrFrbP2GR5vZjMEhktEy87iH1VGPs",
        "walletPubkey": "2WeFEJbeXFrfm9v7zgF25bViroaHgLxX7imeMyLFzeBA",
        "stakeAccountPubkey": "6zvvTW6sNkuNtTfxZNZRtQrMVv1T6R3nT9E737v5Jizq",
        "stakeAmount": 1000000,
        "rentExemptAmount": 2282880,
        "totalAmount": 3282880,
        "unsignedTransactionBase64": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzdzie/leLci0dnkUHJcxfRxpuTLUHL4XTHaTzB+AjKR5l2J4UbR30Bf7RGUoFMpZC01H86zNYonRuPU/Xaz4HAgAHCRZzpNGTlwgo9JlR6hlKexfg+w05YkuOhVBPrAHlba4pWSGCmvVn+jv3z6eixWz1P5/QsY1UYpp74BX7xpFKhWYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFLzqwV3zcnF1DzQIFiTM4mDS8C6kifk5UY/cZ2Z/vLqBqHYF5E3VCqYNDe9/ip6slV/U1yKeHIraKSdwAAAAAAGodgXpQIFC2gHkebObbiOHltxUPYfxnkKTrTRAAAAAAan1RcYx3TJKFZjmGkdXraLXrijm0ttXHNVWyEAAAAABqfVFxksXFEhjMlMPUrxf1ja7gibof1E49vZigAAAAAGp9UXGTWE0P7tm7NDHRMga+VEKBtXuFZsxTdf9AAAAFhS3xilPpygxdfDGKQjwR5UVDEsMWT7s7DmfaNRxbs9AwICAAE0AAAAAMAXMgAAAAAAyAAAAAAAAAAGodgXkTdUKpg0N73+KnqyVX9TXIp4citopJ3AAAAAAAQCAQd0AAAAABZzpNGTlwgo9JlR6hlKexfg+w05YkuOhVBPrAHlba4pFnOk0ZOXCCj0mVHqGUp7F+D7DTliS46FUE+sAeVtrikAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBgEDBggFAAQCAAAA"
    }
}
```

{% endtab %}
{% endtabs %}

#### **Sample Request**

```bash
curl --location '{{url}}/v1/stake' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d' \
--data '{
    "validatorPubkey": "6aow5rTURdbhbeMDrFrbP2GR5vZjMEhktEy87iH1VGPs",
    "walletPubkey": "2WeFEJbeXFrfm9v7zgF25bViroaHgLxX7imeMyLFzeBA",
    "amount": 1000000
}'
```

#### **Types**

#### Stake Response Object

<table><thead><tr><th width="216.13020833333331">Property</th><th width="469">Description</th><th>Type</th></tr></thead><tbody><tr><td>validatorPubKey</td><td>Public address of validator  </td><td>String</td></tr><tr><td>walletPubKey</td><td>Public address of user wallet</td><td>String</td></tr><tr><td>stakeAccountPubKey</td><td>Public address of stake account </td><td>String</td></tr><tr><td>unsignedTransactionBase64</td><td>Unsigned transaction which needs to be signed with the private key of the user wallet</td><td>String</td></tr><tr><td>stakeAmount</td><td>Amount of SOL to be staked</td><td>Number</td></tr><tr><td>rentAmount</td><td>Rent used for creation for stake account. Rent is required to be paid for creation of stake account and is a one time fee.</td><td>Number</td></tr><tr><td>totalAmount</td><td>Total SOL to be deducted from balance. It is the sum of stake amount and rent.</td><td>Number</td></tr></tbody></table>

## Get Delegator Balance

<mark style="color:green;">`POST`</mark> `api/v1/balance`

Returns the list of stake accounts associated with a wallet address or for specified stake accounts. Each stake account now includes detailed **balance**, **authorities**, and **epoch** information.

#### Headers

| Name                                        | Type   | Description                   |
| ------------------------------------------- | ------ | ----------------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | API Key provided by Luganodes |

#### Request Body

| Name                    | Type                        | Description                                                                                                               |
| ----------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **walletPubKey**        | String *(optional)*         | Public address of user wallet                                                                                             |
| **stakeAccountPubKeys** | Array\<String> *(optional)* | List of stake account addresses to query                                                                                  |
| **⚠️ Validation Rule**  |                             | Exactly **one** of `walletPubKey` or `stakeAccountPubKeys` must be provided. If both are present, return 400 Bad Request. |

#### 200: OK — Balance Response Object

**When queried by wallet**

```json
{
  "success": true,
  "data": {
    "walletPubkey": "2WeFEJbeXFrfm9v7zgF25bViroaHgLxX7imeMyLFzeBA",
    "balance": 177596826,
    "stakeAccounts": [
      {
        "pubkey": "6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E",
        "status": "active",
        "balance": {
          "total_sol": "5.00228288",
          "active_sol": "5.0",
          "inactive_sol": "0.00228288",
          "rewards_sol": "0.00228288"
        },
        "authorities": {
          "stake_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC",
          "withdraw_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC"
        },
        "epochs": {
          "activation_epoch": 485,
          "deactivation_epoch": null,
          "current_epoch": 520
        },
        "voter": "6aow5rTURdbhbeMDrFrbP2GR5vZjMEhktEy87iH1VGPs",
        "created_at": "2024-08-15T10:30:00Z",
        "updated_at": "2025-11-03T08:15:32Z"
      }
    ]
  }
}
```

**When queried by stake accounts**

```json
{
  "success": true,
  "data": {
    "stakeAccounts": [
      {
        "pubkey": "6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E",
        "status": "active",
        "balance": {
          "total_sol": "5.00228288",
          "active_sol": "5.0",
          "inactive_sol": "0.00228288",
          "rewards_sol": "0.00228288"
        },
        "authorities": {
          "stake_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC",
          "withdraw_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC"
        },
        "epochs": {
          "activation_epoch": 485,
          "deactivation_epoch": null,
          "current_epoch": 520
        },
        "voter": "6aow5rTURdbhbeMDrFrbP2GR5vZjMEhktEy87iH1VGPs",
        "created_at": "2024-08-15T10:30:00Z",
        "updated_at": "2025-11-03T08:15:32Z"
      }
    ]
  }
}
```

#### **Sample Requests**

**By Wallet**

```bash
curl --location '{{url}}/v1/balance' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d' \
--data '{
    "walletPubKey": "2WeFEJbeXFrfm9v7zgF25bViroaHgLxX7imeMyLFzeBA"
}'
```

**By Multiple Stake Accounts**

```bash
curl --location '{{url}}/v1/balance' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d' \
--data '{
    "stakeAccountPubKeys": [
        "6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E",
        "BW8yWJoNPBQfKLLN2oKh7FxQEGimXFDHfDgrADPxRnxj"
    ]
}'
```

#### **Response Object Fields**

| Property          | Description                                                           | Type           |
| ----------------- | --------------------------------------------------------------------- | -------------- |
| **walletPubkey**  | Public address of the user wallet *(present only for wallet queries)* | String         |
| **balance**       | Wallet SOL balance (lamports)                                         | Number         |
| **stakeAccounts** | List of stake accounts with details                                   | Array\<Object> |

**Stake Account Object**

| Property                  | Description                            | Type          |
| ------------------------- | -------------------------------------- | ------------- |
| **pubkey**                | Public address of stake account        | String        |
| **status**                | `"active"` or `"inactive"`             | String        |
| **balance**               | SOL balance details                    | Object        |
| → **total\_sol**          | Total SOL in stake account             | String        |
| → **active\_sol**         | Active staked SOL                      | String        |
| → **inactive\_sol**       | Inactive SOL                           | String        |
| → **rewards\_sol**        | Earned rewards                         | String        |
| **authorities**           | Stake and withdraw authorities         | Object        |
| → **stake\_authority**    | Stake authority address                | String        |
| → **withdraw\_authority** | Withdraw authority address             | String        |
| **epochs**                | Epoch metadata                         | Object        |
| → **activation\_epoch**   | Epoch when stake became active         | Number / null |
| → **deactivation\_epoch** | Epoch when stake will deactivate       | Number / null |
| → **current\_epoch**      | Current epoch                          | Number        |
| **voter**                 | Validator vote account address         | String        |
| **created\_at**           | Stake account creation timestamp (UTC) | String        |
| **updated\_at**           | Last update timestamp (UTC)            | String        |

## Get Delegator Rewards

**GET** `/api/v1/rewards`

Returns aggregated rewards for a **delegator address** or specific **stake accounts** over a given time range. Rewards are grouped by the specified aggregation **period** (epoch, weekly, or monthly).

***

#### Query Parameters

| Name                                               | Type           | Description                                                                                                                       |
| -------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **start\_time** <mark style="color:red;">\*</mark> | Number         | Start of the query period (Unix timestamp)                                                                                        |
| **end\_time** <mark style="color:red;">\*</mark>   | Number         | End of the query period (Unix timestamp)                                                                                          |
| **period**                                         | String         | <p>Aggregation period — defaults to <code>epoch</code><br>Enum: <code>epoch</code>, <code>weekly</code>, <code>monthly</code></p> |
| **wallet\_address**                                | String         | Delegator wallet address                                                                                                          |
| **stake\_accounts**                                | Array\<String> | One or more stake account addresses                                                                                               |

> ⚠️ **Validation Rules**
>
> * Exactly one of `wallet_address` or `stake_accounts` must be provided.
> * If both are provided → return `400 Bad Request`.
> * The difference between `end_time` and `start_time` **must not exceed the selected period**.

***

#### 200: OK — Rewards Response Object

```json
{
  "status": "success",
  "data": {
    "delegator_address": "6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E",
    "period": "epoch",
    "total_rewards": {
      "sol": "0.00228288"
    },
    "rewards": [
      {
        "epoch": 485,
        "time_start": "2024-10-01T00:00:00Z",
        "time_end": "2024-10-03T12:30:00Z",
        "rewards_earned": {
          "sol": "0.00084592"
        },
        "reward_types": {
          "inflation_rewards": {
            "sol": "0.00074592"
          },
          "mev_rewards": {
            "sol": "0.0001"
          }
        },
        "starting_balance_sol": "5.0",
        "ending_balance_sol": "5.00084592"
      },
      {
        "epoch": 486,
        "time_start": "2024-10-03T12:30:00Z",
        "time_end": "2024-10-06T01:00:00Z",
        "rewards_earned": {
          "sol": "0.00085648"
        },
        "reward_types": {
          "inflation_rewards": {
            "sol": "0.00075648"
          },
          "mev_rewards": {
            "sol": "0.0001"
          }
        },
        "starting_balance_sol": "5.00084592",
        "ending_balance_sol": "5.00170240"
      },
      {
        "epoch": 487,
        "time_start": "2024-10-06T01:00:00Z",
        "time_end": "2024-10-08T13:30:00Z",
        "rewards_earned": {
          "sol": "0.00058048"
        },
        "reward_types": {
          "inflation_rewards": {
            "sol": "0.00048048"
          },
          "mev_rewards": {
            "sol": "0.0001"
          }
        },
        "starting_balance_sol": "5.00170240",
        "ending_balance_sol": "5.00228288"
      }
    ]
  },
  "metadata": {
    "query_time": "2025-11-03T10:25:30Z",
    "epochs_included": 3
  }
}
```

***

#### Response Object

| Property               | Description                                                   | Type           |
| ---------------------- | ------------------------------------------------------------- | -------------- |
| **delegator\_address** | Delegator wallet or stake account queried                     | String         |
| **period**             | Aggregation interval                                          | String         |
| **total\_rewards**     | Total rewards during the requested range                      | Object         |
| → **sol**              | Total rewards in SOL                                          | String         |
| **rewards**            | List of reward entries for each period (epoch/day/week/month) | Array\<Object> |

**Reward Entry Object**

| Property                     | Description                           | Type   |
| ---------------------------- | ------------------------------------- | ------ |
| **epoch**                    | Epoch number (for `period=epoch`)     | Number |
| **time\_start**              | Start timestamp of the interval (UTC) | String |
| **time\_end**                | End timestamp of the interval (UTC)   | String |
| **rewards\_earned**          | Total rewards earned in the period    | Object |
| → **sol**                    | Amount in SOL                         | String |
| **reward\_types**            | Breakdown of reward categories        | Object |
| → **inflation\_rewards.sol** | Rewards from inflation                | String |
| → **mev\_rewards.sol**       | Rewards from MEV (if applicable)      | String |
| **starting\_balance\_sol**   | Balance at start of period            | String |
| **ending\_balance\_sol**     | Balance at end of period              | String |

**Metadata Object**

| Property             | Description                           | Type   |
| -------------------- | ------------------------------------- | ------ |
| **query\_time**      | ISO timestamp when query was executed | String |
| **epochs\_included** | Number of epochs included in results  | Number |

***

#### Sample Request

**By Wallet**

```bash
curl --location '{{url}}/v1/history?wallet_address=6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E&start_time=1727740800&end_time=1728163200&period=epoch' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d'
```

**By Multiple Stake Accounts**

```bash
curl --location '{{url}}/v1/history?stake_accounts=6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E,7aNyy5FLrikPoTWcn5iGT4DUPsWqEk6v6pPNKWjDZyoG&start_time=1727740800&end_time=1728163200&period=daily' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d'
```

## Get Delegator History

**GET** `/api/v1/history/events`

Returns a detailed chronological log of all staking-related events for a **delegator wallet** or **specific stake accounts** within a given time range.\
Includes summary statistics, validator participation, and pagination support.

***

#### Query Parameters

| Name                                               | Type           | Description                                                                     |
| -------------------------------------------------- | -------------- | ------------------------------------------------------------------------------- |
| **start\_time** <mark style="color:red;">\*</mark> | Number         | Start of the query period (**Unix timestamp**)                                  |
| **end\_time** <mark style="color:red;">\*</mark>   | Number         | End of the query period (**Unix timestamp**)                                    |
| **wallet\_address**                                | String         | Delegator wallet address *(use **either** this or `stake_accounts`)*            |
| **stake\_accounts**                                | Array\<String> | One or more stake account addresses *(use **either** this or `wallet_address`)* |
| **page**                                           | Number         | Page number for pagination. Default: `1`                                        |
| **page\_size**                                     | Number         | Number of events per page. Default: `50`                                        |
| **excluded\_event\_type**                          | Array\<String> | Event types to exclude from results *(can take multiple values)*                |

> ⚠️ **Validation**
>
> * Provide **exactly one** of `wallet_address` or `stake_accounts`. If both are present → **400 Bad Request**.
> * Ensure `end_time` ≥ `start_time` (difference not excessively large to avoid truncation).

***

#### 200: OK — Response

```json
{
  "status": "success",
  "data": {
    "address": "6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E",
    "time_range": {
      "start": "2024-10-01T00:00:00Z",
      "end": "2024-10-31T23:59:59Z"
    },
    "summary": {
      "total_rewards_earned": { "sol": "0.00228288" },
      "starting_balance": { "sol": "5.0" },
      "ending_balance": { "sol": "5.00228288" },
      "epochs_active": 13,
      "status_changes": 1
    },
    "history": [
      {
        "event_type": "account_created",
        "timestamp": "2024-10-01T00:00:00Z",
        "epoch": 485,
        "details": {
          "initial_stake_sol": "5.0",
          "validator_vote_key": "FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk",
          "stake_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC",
          "withdraw_authority": "C83GxcNFTC2tK22rLCCrLKYRkckbNVGsjethN5iswgfC"
        }
      },
      {
        "event_type": "delegation_activated",
        "timestamp": "2024-10-03T12:30:00Z",
        "epoch": 486,
        "details": {
          "status_changed_from": "activating",
          "status_changed_to": "active",
          "active_stake_sol": "5.0"
        }
      },
      {
        "event_type": "rewards_earned",
        "timestamp": "2024-10-03T12:30:00Z",
        "epoch": 486,
        "details": {
          "rewards_sol": "0.00084592",
          "inflation_rewards_sol": "0.00074592",
          "mev_rewards_sol": "0.0001",
          "new_balance_sol": "5.00084592"
        }
      }
    ],
    "validators": [
      {
        "vote_account": "FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk",
        "identity": "7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy",
        "name": "Luganodes Validator",
        "epochs_delegated": 13,
        "total_rewards_from_validator": { "sol": "0.00228288" }
      }
    ]
  },
  "pagination": {
    "page": 1,
    "page_size": 50,
    "total_events": 5,
    "has_more": false
  },
  "metadata": {
    "query_time": "2025-11-03T10:40:22Z"
  }
}
```

***

#### Response Object

| Property                         | Description                                  | Type           |
| -------------------------------- | -------------------------------------------- | -------------- |
| **address**                      | Wallet or stake account address queried      | String         |
| **time\_range.start**            | Start timestamp (UTC)                        | String         |
| **time\_range.end**              | End timestamp (UTC)                          | String         |
| **summary**                      | Aggregated statistics over range             | Object         |
| → **total\_rewards\_earned.sol** | Total rewards (SOL)                          | String         |
| → **starting\_balance.sol**      | Starting SOL balance                         | String         |
| → **ending\_balance.sol**        | Ending SOL balance                           | String         |
| → **epochs\_active**             | Number of epochs stake was active            | Number         |
| → **status\_changes**            | Number of status transitions                 | Number         |
| **history**                      | Chronological list of staking events         | Array\<Object> |
| **validators**                   | Validators interacted with during the period | Array\<Object> |

**History Event Object**

| Property        | Description                                                                    | Type   |
| --------------- | ------------------------------------------------------------------------------ | ------ |
| **event\_type** | Event type (`account_created`, `delegation_activated`, `rewards_earned`, etc.) | String |
| **timestamp**   | UTC time of event                                                              | String |
| **epoch**       | Epoch when event occurred                                                      | Number |
| **details**     | Contextual event details                                                       | Object |

**Validator Object**

| Property                                | Description                                  | Type   |
| --------------------------------------- | -------------------------------------------- | ------ |
| **vote\_account**                       | Validator vote account address               | String |
| **identity**                            | Validator identity address                   | String |
| **name**                                | Validator name (if known)                    | String |
| **epochs\_delegated**                   | Number of epochs delegated to this validator | Number |
| **total\_rewards\_from\_validator.sol** | Rewards earned from this validator (SOL)     | String |

**Pagination Object**

| Property          | Description                  | Type    |
| ----------------- | ---------------------------- | ------- |
| **page**          | Current page number          | Number  |
| **page\_size**    | Items per page               | Number  |
| **total\_events** | Total number of events found | Number  |
| **has\_more**     | Whether more pages exist     | Boolean |

**Metadata Object**

| Property        | Description               | Type   |
| --------------- | ------------------------- | ------ |
| **query\_time** | API query timestamp (UTC) | String |

***

#### Sample Requests

**By Wallet**

```bash
curl --location '{{url}}/v1/history/events?wallet_address=6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E&start_time=1727740800&end_time=1730332799&page=1&page_size=50' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d'
```

**By Multiple Stake Accounts**

```bash
curl --location '{{url}}/v1/history/events?stake_accounts=6ZuLUCwVTvuQJrN1HrpoHJheQUw9Zk8CtiD3CEpHiA9E,7aNyy5FLrikPoTWcn5iGT4DUPsWqEk6v6pPNKWjDZyoG&start_time=1727740800&end_time=1730332799&page=1&page_size=50&excluded_event_type=rewards_earned,delegation_deactivated' \
--header 'api-key: ee908371-d13b-43dd-ae33-b854dade5e9d'
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luganodes.com/apis/staking-apis-v2/solana/staking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
