Skip to content

Repository files navigation

Stake Program

Solana Core BPF Stake Program.

InformationAccount Address
Stake ProgramStake11111111111111111111111111111111111111

Overview

This repository contains the BPF port of the native Agave Stake Program, along with the official Rust interface and Codama-generated Rust and Javascript clients for interacting with it. The Stake Program is what allows stake accounts to be created, delegated, split, merged, and so forth.

Historically, the Stake Program was built into the Agave validator client as a pseudo-program. This would necessitate that any future validator client reimplement it exactly. To ease the development of new validator clients, the Stake Program has been converted to an ordinary BPF program which can be invoked like any normal program. This BPF Stake Program is now live on all clusters.

Security Audits

The BPF Stake Program has received two external audits:

Building and Verifying

To build the BPF Stake Program, you can run cargo-build-sbf or use the Makefile command:

cargo build-sbf --manifest-path program/Cargo.tomlmake build-sbf-program

The BPF program deployed on all clusters is built with solana-verify. It may be verified independently by comparing the output of:

solana-verify get-program-hash -um Stake11111111111111111111111111111111111111

with:

solana-verify build --library-name solana_stake_program

Interface

Instructions, errors, and assorted structs related to the stake program, which used to live in the Solana SDK repo, now live here. For more, see docs.rs.

Compute Units

Previously, the Stake Program was essentially free, costing 1500 Compute Units irrespective of any work the program actually did. As a normal BPF program, the Stake Program now pays Compute Units as any other program.

For the initial 1.0.0 release, we followed the existing Agave code as closely as possible, to minimize the possibility of introducing any bugs or changing any behaviors in the port because of the total rewrite of the calling interface the port necessitated. This means the existing program is expected to be non-optimal. With the ability to test more thoroughly against this 1.0.0 version, we expect to be able to optimize these costs in the future.

Based on the sample invocations in program/tests/interface.rs, approximate costs as of 2025-11-14 are as follows. These should be treated as baselines and are rounded to hundreds; instructions may do less or more work depending on arguments and account states.

InstructionEstimated Cost
Authorize10500
AuthorizeChecked10200
AuthorizeCheckedWithSeed11500
AuthorizeWithSeed11700
Deactivate10600
DeactivateDelinquent11400
DelegateStake10800
GetMinimumDelegation(negligible)
Initialize7500
InitializeChecked5200
Merge17600
MoveLamports12500
MoveStake21700
SetLockup9300
SetLockupChecked9100
Split16900
Withdraw7300

About

The Solana Stake program and its clients

Resources

Security policy

Stars

62 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages