As an example, in the Kitties tutorial :

#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum Gender {

Why do we use Serialize and Deserialize given that the implementations are not compiled when building the WASM runtime?

  • I can give short answer on that. The substrate runtime is compiled in native and wasm, and also if u remove serder and just use parity scale codec its just works fine. And honestly no need to use serde Mar 30, 2022 at 14:06

1 Answer 1


We use serde for exporting/importing the GenesisConfig. So, if you want to use something as part of the GenesisConfig of your pallet you need to derive Serialize/Deserialize.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.