Sysvar Cluster Data
Sysvar Cluster Data
PUT exposes a variety of cluster state data to programs via sysvar accounts.
These accounts are populated at known addresses published along with the account layouts in the put-program crate, and outlined below.
There are two ways for a program to access a sysvar.
The first is to query the sysvar at runtime via the sysvar's get() function:
The following sysvars support get:
The second is to pass the sysvar to the program as an account by including its address as one of the accounts in the Instruction and then deserializing the data during execution.
Access to sysvars accounts is always readonly.
The first method is more efficient and does not require that the sysvar account be passed to the program, or specified in the Instruction the program is processing.
Clock
The Clock sysvar contains data on cluster time, including the current slot, epoch, and estimated wall-clock Unix timestamp. It is updated every slot.
EpochSchedule
The EpochSchedule sysvar contains epoch scheduling constants that are set in genesis, and enables calculating the number of slots in a given epoch, the epoch for a given slot, etc. (Note: the epoch schedule is distinct from the leader schedule)
Fees
The Fees sysvar contains the fee calculator for the current slot.
It is updated every slot, based on the fee-rate governor.
Instructions
The Instructions sysvar contains the serialized instructions in a Message while that Message is being processed.
This allows program instructions to reference other instructions in the same transaction. Read more information on instruction introspection.
RecentBlockhashes
The RecentBlockhashes sysvar contains the active recent blockhashes as well as their associated fee calculators. It is updated every slot. Entries are ordered by descending block height, so the first entry holds the most recent block hash, and the last entry holds an old block hash.
Rent
The Rent sysvar contains the rental rate. Currently, the rate is static and set in genesis. The Rent burn percentage is modified by manual feature activation.
SlotHashes
The SlotHashes sysvar contains the most recent hashes of the slot's parent banks. It is updated every slot.
SlotHistory
The SlotHistory sysvar contains a bitvector of slots present over the last epoch. It is updated every slot.
StakeHistory
The StakeHistory sysvar contains the history of cluster-wide stake activations and de-activations per epoch. It is updated at the start of every epoch.
Last updated