6

can someone explain what is SYSVAR_RENT_PUBKEY, and all the related PUBKEY defined in @solana/web3.js?

0

2 Answers 2

5

A system account. Sysvars provide cluster state information such as current tick height, rewards points values, etc. Programs can access Sysvars via a Sysvar account (pubkey) or by querying via a syscall.

  • clock: This account contains the clock slot, epoch, and leader_schedule_epoch

  • epoch_schedule: This account contains the current cluster rent

  • fees: This account contains the current cluster fees

  • instructions: This account contains the serialized transaction instructions

  • recent_blockhashes : recent blockhashes

  • rent: This account contains the current cluster rent

  • rewards DEPRECATED: This sysvar can be removed once the pico-inflation feature is enabled

  • slot_hashes: named accounts for synthesized data accounts for bank state, etc.

  • slot_history: named accounts for synthesized data accounts for bank state, etc.

  • stake_history: named accounts for synthesized data accounts for bank state, etc.

3

Solana exposes a variety of cluster state data to programs via sysvar accounts.

It's an address to an account on chain that contains the rental rate. These are static values.

Let's look at the account data:

{
   "data":{
      "parsed":{
         "info":{
            "burnPercent":100,
            "exemptionThreshold":2.0,
            "lamportsPerByteYear":"3480"
         },
         "type":"rent"
      },
      "program":"sysvar",
      "space":17
   },
   "executable":false,
   "lamports":1009200,
   "owner":"Sysvar1111111111111111111111111111111111111",
   "rentEpoch":337
}

This can be used to calculate rent exemption on chain.

Example: https://github.com/solana-labs/solana-program-library/blob/cc2739fce1/token-lending/program/src/processor.rs#L1716

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.