# Stake snapshots

At every epoch transition, the system performs a stake distribution snapshot. These snapshots are used for the slot leader election process and consist of:

* *Stake*: a mapping of credentials to lovelace
* *Delegations*: a mapping of credentials to stake pools
* *Pool parameters*: each stake pool's parameters storage

At any given time, the system must store the last three snapshots. To keep track of snapshots, `Mark, Set, and Go` naming is used. `Mark` is the most recent one, which becomes `Set` after an epoch and `Go` after another epoch.

A snapshot **Mark** at epoch transition from *EpochN* to *EpochN+1* will be used for the slot leader election process during *EpochN+2*, when it becomes **Set**. Finally, it is employed for rewards calculation during *Epoch N+3* when it becomes **Go**.

<figure><img src="https://1107559072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXBrFxra9Xk2qbyC9AUaf%2Fuploads%2Fgit-blob-fb20fcc51f7720332d830ba6ce1ee97ac75a9416%2FSNAPSHOT1.png?alt=media" alt=""><figcaption></figcaption></figure>

On any current epoch, **Mark** is not actively used, **Set** is used for the slot leader election process, and **Go** is used for the rewards calculation:

<figure><img src="https://1107559072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXBrFxra9Xk2qbyC9AUaf%2Fuploads%2Fgit-blob-84b562f0933aec7a6cba48baf77ed90c4df8cc30%2FMARKSETGO%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

For more details, please see section 11.1 of the [Shelley ledger specification](https://github.com/input-output-hk/cardano-ledger/releases/latest/download/shelley-ledger.pdf).

<figure><img src="https://1107559072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXBrFxra9Xk2qbyC9AUaf%2Fuploads%2Fgit-blob-fc8496a02579831d9dcbd5315ef8a19f27eff82c%2Fshelley-spec-.png?alt=media" alt=""><figcaption></figcaption></figure>

You can query the stake snapshots:

{% code overflow="wrap" %}

```
cardano-cli query stake-snapshot --testnet-magic 2 --stake-pool-id <POOL_ID>
```

{% endcode %}

```
{
    "activeStakeGo": 145769691498797,
    "activeStakeMark": 147258956481483,
    "activeStakeSet": 146034637994668,
    "poolStakeGo": 9497641630,
    "poolStakeMark": 9497641630,
    "poolStakeSet": 9497641630
}
```
