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
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.