0

enter image description here

enter image description here

As shown in these two pictures, I want to know the exact meaning of "Prefix" in the struct StroageValue, so I go to core::marker file by follow rust-analyzer's guidance, and search the word "Prefix", but got nothing. So could anyone tell me why? And how to find the accurate define of the "Prefix" here?

1 Answer 1

0

At the pallet level, Prefix is a generic or you can understand it as a placeholder.

When you finally construct the pallet in construct_runtime!, the name is its prefix.

For example, https://github.com/paritytech/substrate/blob/78bff0efb83b8b3cff1d09561c335c9b76504066/bin/node-template/runtime/src/lib.rs#L286. pallet_balance use Balance as its prefix here.

Actually, it is twox128(b"Balance") in storage. It needs one hash.


Use subalfred you could easily get the storage key.

Or use PolkadotApps to navigate to the chain state page.

enter image description here

3
  • Thanks a lot, I think I partly understood now.
    – peilin
    Commented Sep 4, 2022 at 6:18
  • If this solve your problem, please mark it as the answer.
    – aurexav
    Commented Sep 4, 2022 at 6:48
  • oh, sorry, I didn't found the accept button before.
    – peilin
    Commented Sep 4, 2022 at 8:44

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.