Full lesson
agave
Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
What it does
From the project README:
[](https://crates.io/crates/agave-validator) [](https://docs.rs/agave-validator) [](https://buildkite.com/anza/agave-secondary) [](https://github.com/anza-xyz/agave/actions/workflows/release.yml) [](https://codecov.io/gh/anza-xyz/agave)
- Original
- anza-xyz/agave
- SuperStack fork
- Blockchains/agave @
5770743 - Stars
- 1,983
- Last push (original)
- 2026-11-02
- Languages
- Rust, Shell, C, C++, Python, Makefile
- Detected stack
- Native Rust
- Categories
- Other
- Licence
- Apache-2.0
- Homepage
- https://www.anza.xyz/
Architecture
1255 source files. By extension: .rs ×1217, .c ×35, .py ×3.
| Top-level directory | Source files |
|---|---|
programs | 120 |
core | 117 |
runtime | 86 |
accounts-db | 65 |
ledger | 45 |
svm | 45 |
gossip | 37 |
validator | 34 |
On-chain programs: programs/compute-budget, programs/sbf/rust/128bit, programs/sbf/rust/128bit_dep, programs/sbf/rust/account_mem, programs/sbf/rust/account_mem_deprecated, programs/sbf/rust/alloc, programs/sbf/rust/alt_bn128, programs/sbf/rust/alt_bn128_compression
Dapp: deploying
This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/agave/, once it is deployed and checked on devnet. Until then, run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
programs/sbf/rust/invoke/src/lib.rs L253–276 @ 5770743 · Apache-2.0 · original let _ref_mut = accounts[readable].try_borrow_data()?; invoke(&instruction, accounts)?; } } msg!("Test create_program_address"); { assert_eq!( &Pubkey::create_program_address( &[b"You pass butter", &[bump_seed1]], program_id )?, accounts[DERIVED_KEY1_INDEX].key ); let new_program_id = Pubkey::new_from_array([6u8; 32]); assert_eq!( Pubkey::create_program_address(&[b"You pass butter"], &new_program_id) .unwrap_err(), PubkeyError::InvalidSeeds ); } msg!("Test try_find_program_address"); {- Line 254
invoke(&instruction, accounts)?;: Makes a cross-program invocation into another program. - Line 258
msg!("Test create_program_address");: Logs to the program log, which is visible in explorers and the test output. - Line 275
msg!("Test try_find_program_address");: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
programs/sbf/rust/realloc_invoke/src/lib.rs L13–36 @ 5770743 · Apache-2.0 · original std::convert::TryInto,}; solana_program_entrypoint::entrypoint_no_alloc!(process_instruction);fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], instruction_data: &[u8],) -> ProgramResult { let account = &accounts[0]; let invoke_program_id = accounts[1].key; let pre_len = account.data_len(); let mut bump = 0; match instruction_data[0] { INVOKE_REALLOC_ZERO_RO => { msg!("invoke realloc to zero of ro account"); // Realloc RO account let mut instruction = realloc(invoke_program_id, account.key, 0, &mut bump); instruction.accounts[0].is_writable = false; invoke(&instruction, accounts)?; } INVOKE_REALLOC_ZERO => { msg!("invoke realloc to zero");- Line 25
let mut bump = 0;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 29
msg!("invoke realloc to zero of ro account");: Logs to the program log, which is visible in explorers and the test output. - Line 33
invoke(&instruction, accounts)?;: Makes a cross-program invocation into another program.
runtime/src/alpenglow_epoch_type.rs L25–48 @ 5770743 · Apache-2.0 · original pub(crate) epoch: Epoch, pub(crate) delegated_stakes: Vec<RewardEpochDelegatedStake>,} #[derive(Debug, Clone, SchemaRead, SchemaWrite)]struct RewardEpochDelegatedStake { pub(crate) vote_pubkey: Pubkey, pub(crate) delegated_stake: u64,} /// The off-curve account where we store the bounded reward-epoch delegated stake/// denominators used for non-Tower reward recalculation after snapshot restore.static REWARD_EPOCH_DELEGATED_STAKES_ACCOUNT: LazyLock<Pubkey> = LazyLock::new(|| { let (pubkey, _) = Pubkey::find_program_address( &[b"reward_epoch_delegated_stakes"], &agave_feature_set::alpenglow::id(), ); pubkey}); impl RewardEpochDelegatedStakesAccount { pub(crate) fn max_size() -> usize { static REWARD_EPOCH_DELEGATED_STAKES_ACCOUNT_MAX_SIZE: LazyLock<usize> = LazyLock::new(|| {- Line 35
/// The off-curve account where we store the bounded reward-epoch delegated stake: Touches staking state: the amount locked and when it was locked. - Line 38
let (pubkey, _) = Pubkey::find_program_address(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
runtime/src/stake_utils.rs L25–48 @ 5770743 · Apache-2.0 · original 1 }} /// Utility function for creating a stake account from basic parameters./// Only used in tests and CLIs.pub fn create_stake_account_with_activation_and_deactivation_epochs( authorized: &Pubkey, voter_pubkey: &Pubkey, vote_account: &AccountSharedData, rent: &Rent, lamports: u64, activation_epoch: Epoch, deactivation_epoch: Epoch,) -> AccountSharedData { let mut stake_account = AccountSharedData::new(lamports, StakeStateV2::size_of(), &stake_program::id()); let vote_state = VoteStateV4::deserialize(vote_account.data(), voter_pubkey).unwrap(); let credits_observed = vote_state.credits(); let rent_exempt_reserve = rent.minimum_balance(stake_account.data().len()); let stake_amount = lamports .checked_sub(rent_exempt_reserve)- Line 29
/// Utility function for creating a stake account from basic parameters.: Touches staking state: the amount locked and when it was locked. - Line 48
.checked_sub(rent_exempt_reserve): Uses checked arithmetic so overflow fails instead of wrapping.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)