NETConnecting

Docs Build

Stake ACRUX

Stake ACRUX on Acrux from slot 5,184,000 with the stock solana CLI or web3.js StakeProgram. Create a stake account, delegate it to a validator's vote account, deactivate and withdraw.

From Acrux slot 5,184,000 anyone stakes ACRUX on Acrux with Solana's own tools. Solana's Stake program runs at its mainnet address, a stake account delegates to a validator's vote account, and the stake draws that validator's windows in the proposer schedule.

Stake programStake11111111111111111111111111111111111111, from slot 5,184,000 (Programs on Acrux)
Vote accountsthe validators', from getVoteAccounts
Epoch432,000 slots; staking opens at the first slot of epoch 12
In the schedulefrom the next epoch when sent before the epoch's cut-off, from epoch 14 (When it counts)
Rewardsno inflation rewards; fees go to the validators whose blocks carry them (Fees)

The stake is native ACRUX, the balance that pays fees, bridged in from Solana (Move tokens across).

The vote accounts

getVoteAccounts lists them in current, one per identity with a vote account:

FieldMeaning
nodePubkeythe validator's identity
votePubkeyits vote account, the one a stake delegates to
activatedStakeits stake in lamports this epoch: the genesis weight and the stake delegated to it

Each vote account is the Vote program's PDA ["acrux_genesis_vote", identity], written into the state at slot 5,184,000 for each of the twelve genesis identities, and for an outside identity once its Hub Registry membership is in effect (Join a hub); a delegation counts only to these. Each genesis one starts at a genesis weight of 1,000,000 ACRUX, a weight in the schedule with no lamports behind it. Which hub each identity is in is on /hubs and GET /v1/hubs. Before slot 5,184,000, getVoteAccounts lists each identity as its own vote account.

With the solana CLI

  1. Create and delegate

    The default keypair pays, holds both authorities, and funds the stake account:

    Terminal
    solana config set --url https://rpc.acrux.computer
    solana-keygen new --no-bip39-passphrase -o stake-account.json
    solana create-stake-account stake-account.json 10
    solana delegate-stake stake-account.json <VOTE_ACCOUNT>

    create-stake-account moves 10 ACRUX into the account; the CLI prints amounts as SOL. <VOTE_ACCOUNT> is a votePubkey from getVoteAccounts.

  2. Deactivate and withdraw

    Terminal
    solana deactivate-stake stake-account.json
    solana withdraw-stake stake-account.json <RECIPIENT> ALL

    withdraw-stake goes through from the epoch after the deactivation, and ALL returns the whole balance, the account's rent included.

With web3.js

stake.mjs
import { Authorized, Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, StakeProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js'

const connection = new Connection('https://rpc.acrux.computer', 'confirmed')
const holder = Keypair.fromSecretKey(/* your Acrux key */)
const stake = Keypair.generate()

const { current } = await connection.getVoteAccounts()
const vote = new PublicKey(current[0].votePubkey)

const lamports = 10 * LAMPORTS_PER_SOL + await connection.getMinimumBalanceForRentExemption(StakeProgram.space)
await sendAndConfirmTransaction(connection, new Transaction().add(
  StakeProgram.createAccount({ fromPubkey: holder.publicKey, stakePubkey: stake.publicKey, authorized: new Authorized(holder.publicKey, holder.publicKey), lamports }),
  StakeProgram.delegate({ stakePubkey: stake.publicKey, authorizedPubkey: holder.publicKey, votePubkey: vote }),
), [holder, stake])

Later, deactivate, and from the next epoch withdraw the balance:

stake.mjs, continued
await sendAndConfirmTransaction(connection, new Transaction().add(
  StakeProgram.deactivate({ stakePubkey: stake.publicKey, authorizedPubkey: holder.publicKey }),
), [holder])

const balance = await connection.getBalance(stake.publicKey)
await sendAndConfirmTransaction(connection, new Transaction().add(
  StakeProgram.withdraw({ stakePubkey: stake.publicKey, authorizedPubkey: holder.publicKey, toPubkey: holder.publicKey, lamports: balance }),
), [holder])

When it counts

For a delegation or a deactivation sent in epoch e, from epoch 13:

Delegated in epoch eDeactivated in epoch e
getVoteAccountscounts it from epoch e + 1leaves it out from epoch e + 1
Validator set and schedulebefore the cut-off at slot e · 432,000 + 216,000, from epoch e + 1; after it, from e + 2before the cut-off, out from epoch e + 1; after it, from e + 2
The stake accountwithdraws in full from epoch e + 1

The set of epoch e + 1 is frozen at the cut-off, so a change after it moves the set of e + 2 (Admission). In epoch 12 the schedule draws from epoch e + 2, as the two-epoch lead rules. Acrux keeps no stake history, so activation and deactivation each take one epoch whatever their size.