Substrate Types and Traits

To access substrate specific types, the module's Trait may inherit from the Substrate Runtime Module Library. For example, to access the Substrate types Hash, AccountId, and BlockNumber, it is sufficient to inherit the system module:

pub trait Trait: system::Trait {}

This provides access to Hash, AccountId, and BlockNumber anywhere that specifies the generic <T: Trait> using T::<Type>. It also provides access to other useful types, declared in the pub Trait {} block in systems/src/

basically add a note here on why traits are important for runtime development => we are in the business of building libraries to support the configuration and modular and extensible digital infrastructure...


Unlike in smart contract development, the way to inherit shared behavior is not to directly import other modules. Instead, it is common to either implement the same logic in the new context or utilize a trait from srml/support to guide the new implementation. By abstracting shared behavior from the runtime modules into srml/support, Substrate makes it easy to extract and enforce best practices in the runtime. You can find the trait documentation here.