Account & Program
getMultipleAccounts
Returns the account information for multiple accounts
Parameters
Array of account public keys (base-58 encoded)
Response
Code Examples
Basic Request
Request with Encoding
Using web3.js
Notes
- Returns information for multiple accounts in a single request
- Non-existent accounts are returned as null
- Account data can be sliced to reduce response size
- The response is immediate as it reads from the current state
- Different encodings can be specified for account data
Best Practices
- Use this method to efficiently fetch multiple accounts
- Consider using dataSlice to reduce response size
- Cache results when appropriate to reduce RPC load
- Handle null values for non-existent accounts
- Use appropriate encoding based on your needs
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check pubkeys and config parameters |
-32007 | Account information unavailable | Node may be bootstrapping or syncing |
Use Cases
-
Account Batch Processing
-
Account Data Analysis
-
Account Monitoring