> ## Documentation Index
> Fetch the complete documentation index at: https://docs.minaexplorer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Staking Data

Returns data from the staking ledgers The staking ledger of the current epoch is the snarked ledger of the last block of current epoch minus two.

## Stake by Delegate

Filters the staking ledger for delegates. Summing the balance determines the stake of the delegate in the current epoch. Timing may be used to determine if the account is eligible for the supercharged coinbase rewards. If there is timing available, the following fields are included:

* `timed_in_epoch` is a boolean that is `true` if the account has a time-locked balance at the **start** of the epoch.
* `untimed_slot` is the global slot at which the account is no longer timed. Useful if the account is untimed during the epoch.
* `timed_epoch_end` is a boolean that is `true` if the account has a time-locked balance at the **end** of the epoch. Returns `null` if `timed_in_epoch` is `false` .

If the account has no timing information in the ledger `timing`  will return `null` .

```json theme={null}
{
  stakes(
    query: {delegate: "B62...", ledgerHash: "jx94..."}
  ) {
    public_key
    balance
    timing {
      cliff_amount
      cliff_time
      initial_minimum_balance
      vesting_increment
      vesting_period
      untimed_slot
      timed_in_epoch
      timed_epoch_end
    }
  }
}
```

```bash theme={null}
curl -d '{"query":"{\\n  stakes(\\n    query: {delegate: \\"B62...\\"}\\n  ) {\\n    public_key\\n    balance\\n    timing {\\n      cliff_amount\\n      cliff_time\\n      initial_minimum_balance\\n      vesting_increment\\n      vesting_period\\n      untimed_slot\\n      timed_in_epoch\\n      timed_epoch_end\\n    }\\n  }\\n}\\n"}' -H 'Content-Type: application_json' https:__graphql.minaexplorer.com
```

```json theme={null}
{
  "data": {
    "stakes": [
      {
        "balance": 65949.4,
        "public_key": "B62qrAoKfgQx8oXMVQauRs9WYzXpCmYqQrLxivgc8qMYVkK9eH9GjjF",
        "timing": null
      },
      {
        "balance": 71771.5149999,
        "public_key": "B62qrKMAUagWp1VJhvb1AA6y1G4P4tr3inYyPqDRq1VyprA1wmVthcV",
        "timing": null
      },
      {
        "balance": 65958.8001,
        "public_key": "B62qoDaiV18ZGhLfb3j2SuDQEhjyM7c8sDppmvpAyE3cXjutPtHLBfA",
        "timing": {
          "cliff_amount": 12000,
          "cliff_time": 150,
          "initial_minimum_balance": 60000,
          "timed_epoch_end": null,
          "timed_in_epoch": false,
          "untimed_slot": 2070,
          "vesting_increment": 150,
          "vesting_period": 6
        }
      }
    ]
  }
}
```

## Filter By Staking Ledger

Filter by staking ledger hash to return a specific staking ledger. Includes all historical staking ledgers.

```json theme={null}
{
  stakes(limit: 10, query: {ledgerHash: "jx94FuTZwDmQrqczmWD3iBZcAmBqADdDj196dRXN9WqEBkMYTaY"}) {
    balance
    delegate
    public_key
  }
}
```

## Top 10 Accounts in Staking Ledger

Find the biggest whales in the staking ledger.

```json theme={null}
{
  stakes(
    query: {ledgerHash: "jx94FuTZwDmQrqczmWD3iBZcAmBqADdDj196dRXN9WqEBkMYTaY"}
    sortBy: BALANCE_DESC, limit: 10
  ) {
    public_key
    balance
  }
}
```

```bash theme={null}
curl -d '{"query":"{\\n  stakes(\\n    sortBy: BALANCE_DESC, limit: 10\\n  ) {\\n    public_key\\n    balance\\n  }\\n}"}' https:__graphql.minaexplorer.com
```

```json theme={null}
{
  "data": {
    "stakes": [
      {
        "balance": 2251664.0021,
        "public_key": "B62qmtS1GNjgqBs4n5FKsGMFYYuspGmLtrJmxGtNPtc6gpHMWV45SgT"
      },
      {
        "balance": 2251562.3917,
        "public_key": "B62qka2yxv6QHgUuyzxn47HMpReYuWrrGi2NqWZHVGLaoZZxPgc5rGU"
      },
      {
        "balance": 2251548.5881,
        "public_key": "B62qmfrWwaUR38Lbc5uW4kF5fQFX532FLk5D8xHjgfZGxYNLoR6Geib"
      },
      {
        "balance": 2250697.09833855,
        "public_key": "B62qoWjj77gk6UD55nAPMr8NeTwVgXGiannrZ34cmfjamuJjG3YNH5K"
      },
      {
        "balance": 2250296.932210155,
        "public_key": "B62qj7JjRrNfTBAUo9seVTxGBZsr4Zd3iCcoEQEeL9TN2JamefBZRVH"
      },
      {
        "balance": 2250113.176,
        "public_key": "B62qknuGAmW8ZB82yZ5xU245fBGCPJxavL8EtxDHgkqnoS1KEo3mpEC"
      },
      {
        "balance": 2250034.57824422,
        "public_key": "B62qpCdnMgLC5YzXM3qrqybsqHB35UFHHt9muUDuAm2d1ny1ZqEDJzh"
      },
      {
        "balance": 2250020.72624221,
        "public_key": "B62qiptquSVjVM3rNYarUta8g1qgxfKus931RAnheNKX6LxssJbRiYf"
      },
      {
        "balance": 2250020.2019,
        "public_key": "B62qpB1oBckU1wXkRFxcwwCheq3chiKtVhY6T3q8aQiwJUaoCjpqgXS"
      },
      {
        "balance": 2250018.8531,
        "public_key": "B62qn6xwANH3jgqqxyqmDEHK5a3jbVd54p2oBdahRuMLmL7qfAxXWGF"
      }
    ]
  }
}
```

## Determine the Last Block of Epoch

The next staking ledger is only available after `k`  blocks from the last block of the prior epoch. Adding `k` to the following result will determine when the next epoch ledger is available.

```json theme={null}
{
  blocks(
    query: {protocolState: {consensusState: {epoch: 1}}}
    sortBy: DATETIME_DESC
    limit: 1
  ) {
    protocolState {
      consensusState {
        blockHeight
      }
    }
  }
}
```

```bash theme={null}
curl -d '{"query":"{\\n  blocks(\\n    query: {protocolState: {consensusState: {epoch: \\"1\\"}}}\\n    sortBy: DATETIME_DESC\\n    limit: 1\\n  ) {\\n    protocolState {\\n      consensusState {\\n        blockHeight\\n      }\\n    }\\n  }\\n}"}' https:__graphql.minaexplorer.com
```

```json theme={null}
{
  "data": {
    "blocks": [
      {
        "protocolState": {
          "consensusState": {
            "blockHeight": "4329"
          }
        }
      }
    ]
  }
}
```

## Filter Delegates to only those with Timed Account

Only show those delegates that have a timed account at the start of the current epoch.

```json theme={null}
{
  stakes(
    query: {
      delegate: "B62..."
      timing: { timed_in_epoch: true }
    }
  ) {
    public_key
    balance
    timing {
      cliff_amount
      cliff_time
      initial_minimum_balance
      vesting_increment
      vesting_period
      untimed_slot
      timed_in_epoch
      timed_epoch_end
    }
  }
}
```

## Balances and total count of delegators

You can retrieve the total amount delegated and total number of delegators to a staking pool.

```json theme={null}
{
  stake(query: {public_key: "B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN"}) {
    delegationTotals {
      countDelegates
      totalDelegated
    }
  }
}
```
