Skip to main content
Solayer Chain uses 1% of Solana’s rent for account storage, making it 99% cheaper to create accounts. However, this difference requires developers to use the correct instructions to avoid overpaying rent when creating tokens and accounts.

Why This Matters

Solana programs can fetch rent in two ways: Instructions that rely on the Rent sysvar account internally use Rent::from_account_info(), which behaves like Rent::default() and returns Solana’s hardcoded rent values. This causes 100x overpayment on Solayer Chain.

Token Program Instructions

The original Token Program includes both legacy instructions (which use the Rent sysvar) and newer variants (which use the Rent::get() syscall).

Instructions to Avoid

Token 2022 Instructions

Token 2022 (Token Extensions) follows the same pattern. Always use the “V2” or “V3” variants.

Instructions to Avoid

Important for Token 2022: Account sizes vary based on enabled extensions. Always calculate sizes dynamically rather than hardcoding values.

Code Examples

Creating a Mint with InitializeMint2 (TypeScript)

Creating a Token Account with InitializeAccount3 (TypeScript)

Token 2022 with Extensions (TypeScript)

Rust: Correct vs Incorrect Rent Usage

When writing custom Solana programs, always use Rent::get() instead of Rent::default().

Best Practices Summary

  1. Always query rent from the chain
  2. Use “V2” or “V3” instruction variants - They use the Rent::get() syscall internally
  3. Calculate account sizes dynamically for Token 2022 - Use getMintLen() and getAccountLen() with your extensions
  4. In Rust programs, use Rent::get() - Never use Rent::default() which returns hardcoded values

Quick Reference

Safe Instructions (use Rent::get() syscall)

  • InitializeMint2
  • InitializeAccount2
  • InitializeAccount3
  • InitializeMultisig2

Instructions to Avoid (use Rent sysvar)

  • InitializeMint
  • InitializeAccount
  • InitializeMultisig
By following these guidelines, your applications will correctly use Solayer Chain’s 99% cheaper rent and avoid overpaying for account creation.