I have compiled my code successfully and it is running fine in development mode, when I make the staging environment for the same with 3 nodes the code written inside #[cfg(feature = "std")] is not working properly, means the code inside #[cfg(feature = "std")] is just skipping during runtime.

  • 1
    Are you saying your STD code is not being executed in the blockchain runtime? If so, then this is expected as the Wasm runtime for Substrate is always expected to be no-std
    – Shawn Tabrizi
    Sep 25, 2022 at 22:06
  • I was going through github.com/substrate-developer-hub/substrate-docs/issues/531, got some understanding. But is there a way to use STD during blockchian runtime it would be really helpful Sep 26, 2022 at 4:40

1 Answer 1


With --execution native, you can force your node to run in native mode. If the local spec_version match with the on-chain spec_version, some code will be executed in native mode automatically.

But there are a few things you need to know:

  1. the code must be no side-effect on the result
  2. your native node must compile from the latest runtime version code, different runtime versions might have different wasm code
  3. once the chain gets runtime upgrade, you should upgrade your native node or don't use the native mode

Generally, the std code is some logging code. It doesn't affect the execution result.

All in all, you must not get two different results between native and wasm env. Otherwise, this will cause a consensus problem.

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.