Account & Program
getMinimumBalanceForRentExemption
Returns the minimum balance required for an account to be rent exempt
Parameters
The length of the account data in bytes
Response
The minimum balance required for rent exemption in lamports
Code Examples
Basic Request
Using web3.js
Notes
- Returns the minimum balance required for an account to be rent exempt
- The balance is returned in lamports
- The required balance depends on the account’s data length
- The response is immediate as it reads from the current state
- This value can change with network upgrades
Best Practices
- Use this method to determine account creation costs
- Cache results when appropriate to reduce RPC load
- Consider the impact of data length on costs
- Monitor for changes in rent exemption requirements
- Use in conjunction with other account-related methods
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check dataLength parameter |
-32007 | Balance information unavailable | Node may be bootstrapping or syncing |
Use Cases
-
Account Cost Analysis
-
Balance Monitoring
-
Account Planning