I'm working on a project using Substrate and have encountered a technical question regarding data storage. I would like to understand the fundamental difference between using the Preimage pallet and storing a data hash using T::Hashing.

  1. What are the specific use cases where it is more advantageous to use the Preimage pallet over simply creating a data hash with T::Hashing?
  2. Are there any differences in terms of performance or security between these two methods?
  3. How does memory management differ between these two approaches?

1 Answer 1


There isn't much difference between them.

Preimage is more of a general version. It offers a place for those who don't want to store this themselves, and it provides a calculation for the general storage cost fee. And it also has a nice UI on Polkadot Apps for people to review the existing items.

If you have a lot of specific logic, it's best to write it yourself.

In terms of memory management, you can't keep a long-lifetime variable in the runtime. There are many tasks that need to be completed within a block.

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.