Storage Best Practices
Recommendations
Use Pointers Correctly
Ensure the correct storage slot or pointer is used for the data being accessed. Incorrect pointers return unrelated or empty values without error.
Skip Proofs When Unnecessary
Set proofs to false for faster queries when cryptographic verification is not required. Proof generation adds overhead to each request.
Batch Requests
Read multiple storage values in parallel using Promise.all() to reduce overall latency when accessing several slots.
Handle Empty Values
Storage slots may be empty or zero-filled if never written. Check for empty arrays or zero values before decoding.
Historical Queries
Use the height parameter for point-in-time reads when analyzing past state or debugging historical transactions.
Cache Results
Storage values at specific block heights are immutable and can be cached indefinitely to reduce redundant queries.