Deep Overview of Staking in Solana

Snehendu RoySnehendu Roy
14 min read

Introduction

In Solana, staking is the process by which SOL token holders delegate their tokens to validators. These validators are responsible for processing transactions and securing the network by participating in consensus voting to determine which blocks are added to the blockchain. The weight of a validator's vote is determined by the amount of SOL staked with them.

Staking Basics

Proof Of Stake(PoS)

In this system, many different people and entities run a programme on specialised computers known as a validator. These validators play a vital role in maintaining and securing the Solana blockchain.

Validators are responsible for:

  • Processing new incoming transactions on the network.

  • Voting on and appending new blocks to the blockchain.

Validators around the world may receive information at different times, so the network needs a way to come to an agreement about which transactions and data are added to the blockchain. The strategy used is known as the consensus mechanism. Reaching consensus in a fast and cost-efficient manner is a core challenge to building a successful decentralised blockchain.

Every validator on the network can participate in consensus by casting votes for the blocks they believe should be added to the blockchain. In doing so they confirm any valid transactions contained in those blocks. However, not all validator’s votes are weighted equally.

Validator's consensus votes are stake-weighted. This means the more stake an individual validator has, the more influence that validator has when determining the outcome of the consensus voting. Similarly, validators with less stake have less weight and validators with no stake cannot influence the outcome.

What is Staking?

In the Solana network, staking is the process by which a SOL token holder assigns some, or all, of their tokens to a particular validator, or validators. This process can be also called "delegating" tokens. Delegating tokens does not give the validator ownership or control over the delegated tokens. Token holders retain control of all their staked tokens.

By staking tokens, token holders show a degree of trust in their chosen validator. As a validator gains more stake delegations, it acts as “proof” to the network that the validator's consensus votes are trustworthy.

Proof of History

Overview of PoH for 5 year old

Imagine you’re drawing in a colouring book. You finish one page, and then start the next page. Each page is coloured in a specific order, and you can see exactly which page came first, second, third, and so on.

Proof of History (PoH) is like having a colouring book where every page is marked with the time you coloured it. This way, even if someone else looks at your book, they can tell exactly when each page was coloured, without asking you.

In the Solana blockchain, PoH helps keep track of events in order, like marking pages in a book, so everyone knows exactly what happened and when—without slowing down to check with everyone else. This helps Solana go super fast!

Technical Working

For validation of transaction, normally validators need to communicate with each other through some kind of protocols or mechanisms. Solana uses the Proof Of History to organise and verify the order of transactions in its blockchain network which eliminates the need for the constant communication between validator nodes. Here’s the technical working of it:

1. Transaction Ordering

  • Solana’s validators use PoH to sequence and timestamp incoming transactions before they’re even added to a block.

  • Each validator has its own PoH generator, which runs continuously, creating a unique “timestamp” (like a cryptographic tick-tock) that allows the validator to organize transactions in the correct order independently.

  • When a validator collects transactions, it can quickly and accurately slot them based on their PoH timestamps, eliminating the need for extensive time-syncing across the network.

2. Block Creation and Verification

  • Validators use PoH to create blocks (organised batches of transactions) and add them to the blockchain.

  • Since PoH timestamps are easy to verify, other validators can quickly confirm that the transactions happened in the right order without redoing the work.

  • This verification speed allows for parallel processing of blocks, meaning validators can process multiple transactions at once rather than waiting for one block to complete before starting another.

3. Efficient Leader Rotation

  • Solana uses a Proof of Stake (PoS) system for leader selection, where leaders are responsible for creating blocks.

  • PoH helps coordinate which validator should be the leader at any given time, maintaining a predictable and reliable rotation. This coordination reduces network congestion and improves the speed of block production, contributing to Solana’s high throughput.

    Work of the Leader

    • Gathers and timestamps transactions in the correct sequence.

    • Creates blocks with this ordered data (based on timestamps).

    • Proposes these blocks to validators for efficient verification.

    • Coordinates leader rotation to ensure a seamless hand-off for the next block production. The next leader is selected by using the Proof of Stake mechanism

4. Verification Without Communication Overhead:

  • PoH allows validators to verify transaction order and block information without needing to constantly communicate with each other, reducing the load on the network.

  • Validators only need to sync their PoH clocks occasionally, reducing the number of messages exchanged across the network, making Solana much faster and more scalable.

Due to this mechanism of proof of history, solana is able to achieve faster transaction with minimum transaction fees

Mechanics of Staking in Solana

How to Stake

To stake SOL tokens, you must use a wallet that supports staking

SOL tokens in your wallet must first be moved into a stake account. You can create as many stake accounts as you like, and deposit as much or as little SOL into each stake account as you want. Each new stake account has a unique address, and a single wallet can manage or “authorize” many different stake accounts.

Stake Accounts

As mentioned earlier, your sol tokens should be moved to a stake account for you to stake sol. Staking accounts are different from those of traditional system accounts. A system account is only able to send and receive SOL from other accounts on the network, whereas a stake account supports more complex operations needed to manage a delegation of tokens.

The sol in one staking account are assigned to only one validator of the Solana Blockchain. To delegate tokens to multiple validators it is important to delegate tokens into different staking accounts.

To have a more detailed guide on creating a staking account with solana cli, you can check out this Solana staking using CLI doc

One stake account can have one or more signing authorities. You can set the stake authority , widthdraw authority , lockup authority , fee payer to different accounts of your choice while creating a stake account.

The account with stake authority is responsible to:

  • Delegating stake

  • Deactivating the stake delegation

  • Splitting the stake account, creating a new stake account with a portion of the funds in the first account

  • Merging two stake accounts into one

  • Setting a new stake authority

The account with withdraw authority is responsible to:

  • Withdrawing un-delegated stake into a wallet address

  • Setting a new withdraw authority

  • Setting a new stake authority

The stake authority and withdraw authority are set when the stake account is created, and they can be changed to authorize a new signing address at any time. The stake and withdraw authority can be the same address or two different addresses.

The withdraw authority keypair holds more control over the account as it is needed to liquidate the tokens in the stake account, and can be used to reset the stake authority if the stake authority keypair becomes lost or compromised.

Securing the withdraw authority against loss or theft is of utmost importance when managing a stake account.

Stake accounts can have a lockup which prevents the tokens they hold from being withdrawn before a particular date or epoch has been reached. While locked up, the stake account can still be delegated, un-delegated, or split, and its stake authority can be changed as normal. Only withdrawal into another wallet or updating the withdraw authority is not allowed.

A lockup can only be added when a stake account is first created, but it can be modified later, by the lockup authority or custodian, the address of which is also set when the account is created.

Validator Selection and Delegation

As mentioned earlier, the tokens in one single staking account can only be passed to just one validator. Choosing the right validator to stake your tokens is an important decision which will affect the rewards that you get through staking. It is always advised to choose a validator with good validator uptime, reputation, performance.

Selection

In the Solana blockchain, validator uptime refers to the amount of time a validator node is online, active, and correctly participating in the network's operations. High uptime is crucial because it directly affects network performance, the reliability of transaction processing, and the rewards validators and delegators earn.

The site SolanaBeach provides some high-level graphical information about the network as a whole, as well as a list of each validator and some recent performance statistics about each one.

Delegation

After your stake account is funded, you can use commands like solana validators to see the vote account address of validator accounts. The first column of each row contains the validator's identity and the second is the vote account address. Choose a validator and use its vote account address in solana delegate-stake . Here’s the command to delegate your stake:

solana delegate-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <VOTE_ACCOUNT_ADDRESS> \\
    --fee-payer <KEYPAIR>

The stake authority <KEYPAIR> authorizes the operation on the account with address <STAKE_ACCOUNT_ADDRESS>. The stake is delegated to the vote account with address <VOTE_ACCOUNT_ADDRESS>.

After delegating stake, use solana stake-account to observe the changes to the stake account:

Read more to know about the commands of delegation, deactivation, withdrawing, splitting stake from the official docs

Epoach and staking cycle

Explained like 5

  • Epochs:

    • An epoch is like a school day. Each day (or epoch), the students who want to teach get chosen in a new order.

    • Every epoch, the class reviews who will be the teachers for that day, making sure everyone who wants to teach has a fair turn based on how much they contribute.

  • Staking Cycle:

    • In our classroom, some students bring their favorite toys (like a game or a pencil) to show that they’re committed to teaching.

    • When a student brings a toy and says, “I want to help teach,” they’re staking. This means they’re showing they’re serious about helping the class.

    • These students don’t get to use their toys while they’re teaching – their toys are kept safe until they’re done.

  • Activating Stake:

    • When a student first puts their toy forward to teach, they have to wait a bit for the rest of the class to agree they’re ready. This waiting time is like the “activation” period. After that, they can start teaching in the next day (epoch).
  • Earning Rewards:

    • When students do a good job teaching, they earn little prizes, like stickers. These stickers are rewards for staking and helping keep the classroom running smoothly.

    • The rewards are added to their toys, so next time they can earn even more because they have more to show for their work.

  • Deactivating Stake:

    • If a student wants to stop teaching and take their toy back, they say, “I’m done!” This means they have to wait one more day (epoch) before they can take their toy home. This helps the class stay organized, so we don’t have too many people leaving at once.

In short:

  • Each epoch is like a new school day where new teachers (validators) are chosen.

  • Staking is like bringing your toy to help show commitment.

  • Rewards (stickers) are earned for doing a good job, and you have to wait a bit to take your toy back if you decide to stop.

Technical Overview

Epochs are fundamental time periods in the Solana blockchain, lasting approximately two days each. They play a crucial role in the staking cycle, determining when stake accounts change state and when rewards are calculated and distributed.

Here's a breakdown of how epochs impact the staking cycle:

1. Stake Account State Changes:

  • Activation (Warming Up): When you delegate SOL tokens to a validator, they don't become active immediately. The tokens enter an "activating" or "warming up" state. They become eligible to earn rewards only when they are fully activated.

  • Deactivation (Cooling Down): Similarly, when you undelegate tokens, they go through a "deactivating" or "cooling down" period before becoming available for withdrawal.

  • Epoch Boundary: The crucial point is that these state changes (activation and deactivation) only occur at the beginning of a new epoch. This means if you delegate tokens in the middle of an epoch, they won't become active until the next epoch starts.

2. Epoch Boundary Limits:

  • The Solana protocol imposes a limit on how much stake can change state within a single epoch. This limit is set at 25% of the total active stake on the network. This mechanism prevents large, sudden shifts in stake distribution, ensuring network stability.

  • Queueing: If more than 25% of the total active stake is attempting to activate or deactivate in a single epoch, a portion will finish changing state at the epoch boundary, while the remaining portion will need to wait for at least one more epoch.

3. Reward Calculation and Distribution:

  • Epoch-based Rewards: Staking rewards are calculated and distributed once per epoch.

  • Distribution Timing: Rewards earned in a given epoch are paid out to validators and their delegators in the first block of the following epoch. This means there's a slight delay between earning rewards and receiving them.

4. Impact on Staking Strategy:

  • Understanding the epoch-based nature of stake activation, deactivation, and reward distribution is important for optimizing your staking strategy.

  • You might want to time your delegation and undelegation actions to minimize the time your tokens spend in transition states, maximizing your reward-earning potential.

5. Monitoring Epoch Information:

  • You can check the current epoch details using the Solana command-line tool: solana epoch-info. This information can help you plan your staking actions more effectively.

In summary, epochs are integral to the Solana staking cycle. They govern the timing of stake account state changes, impose limits on stake fluctuations, and determine the schedule for reward calculation and distribution.

When and where Staking rewards are issued

Rewards are issued once per epoch and are deposited into the stake account that earned them. Stake rewards are automatically re-delegated as active stake.

If the rewards due to a validator or one of their stakes is less than one lamport for a given epoch, reward issuance is deferred until the next epoch in which both would receive at least one lamport.

Advance Staking Concepts

Stake Pools

  • Stake pools are the foundation for collective staking. Instead of staking individually, users pool their assets together in a stake pool, which then delegates those assets across multiple validators. This helps users who may not have enough tokens for individual staking to participate and earn rewards collectively.

  • Stake pools are often the basis for liquid staking platforms, as they allow many users to stake together with less hassle and without meeting minimum staking requirements on their own.

Liquid Staking

  • Liquid staking builds on the concept of stake pools but takes it further by providing liquidity for staked assets. When users stake in a liquid staking platform, they still earn staking rewards, but they also receive a staking derivative (a liquid token that represents their stake in the pool).

  • These staking derivatives (like “stSOL” from Lido or “mSOL” from Marinade) act as a form of "receipt" for the staked tokens, giving users the freedom to use this derivative token while their real tokens are locked in staking.

  • Liquid staking protocols usually rely on stake pools to ensure that the underlying assets are securely staked and distributed across multiple validators.

Staking Derivatives

  • Staking derivatives are tokens issued through liquid staking. They represent the user’s staked assets and can be freely traded, used in DeFi, or even swapped back for the underlying asset once unstaking is complete.

  • These derivatives are crucial to the liquid staking model, as they allow users to have access to a "liquid" (or usable) version of their staked tokens. They bring flexibility and capital efficiency to staking by allowing users to earn rewards and simultaneously engage in other blockchain activities.

Summary of Their Relationship

  • Stake pools provide the basic infrastructure for collective staking, which benefits smaller holders and increases decentralization.

  • Liquid staking extends this by giving users a way to keep their assets staked while unlocking liquidity through staking derivatives.

  • Staking derivatives are the "output" of liquid staking, allowing users to earn rewards and retain liquidity, ultimately providing a more versatile staking experience.

Conclusion and Summary

  • Staking in Solana involves delegating SOL tokens to validators who process transactions and secure the network.

  • Validators participate in consensus through a Proof of Stake mechanism, with their influence determined by the amount of SOL staked.

  • Proof of History (PoH) is used to timestamp transactions and order them efficiently without constant validator communication.

  • Stake accounts are created to delegate SOL tokens to validators, with various authorities for managing these accounts.

  • Epochs determine the timing of stake activation, deactivation, and reward distribution, impacting staking strategy.

  • Advanced concepts include stake pools for collective staking and liquid staking, which provides liquidity through staking derivatives.

0
Subscribe to my newsletter

Read articles from Snehendu Roy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Snehendu Roy
Snehendu Roy