# GenesisConfig in WASM Runtime: A Step Towards a Non-Native Future

**URL:** <https://forum.polkadot.network/t/genesisconfig-in-wasm-runtime-a-step-towards-a-non-native-future/2887>\
**Category:** Tech Talk\
**Created:** [May 17, 2023, 2:22pm UTC](https://forum.polkadot.network/t/genesisconfig-in-wasm-runtime-a-step-towards-a-non-native-future/2887 "2023-05-17T14:22:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michal](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/michal/32/1733_2.png) [@michal](https://forum.polkadot.network/u/michal)\
**Post date:** [May 17, 2023, 2:22pm UTC](https://forum.polkadot.network/t/genesisconfig-in-wasm-runtime-a-step-towards-a-non-native-future/2887/1 "2023-05-17T14:22:57Z")

</div>

At present, the `GenesisConfig` is not compatible with WASM environments. My current mission is to rectify this and fully incorporate `GenesisConfig` functionality into the WASM runtime. This is an important step for the progression towards a _non-native runtime_ environment.

The primary problem we’re addressing and proposed high-level plan are thoroughly detailed in this issue: [`GenesisConfig` in a native runtime free world · Issue #13334 · paritytech/substrate · GitHub](https://github.com/paritytech/substrate/issues/13334)

This post aims to shed further light on the issue, outline our strategy, and share the progress we have made so far.

Here’s an overview of our planned modifications:

- We intend to enable serialization support in substrate primitives by introducing a `serde` feature, regardless of `std`.
- We are proposing to integrate the `serde` crate (featuring Serialize/Deserialize traits) into the WASM runtime by default, without the need for a gate feature.
- `GenesisConfig`-related code will always be compiled for WASM, without the necessity to introduce `serde` or `genesis-config` features into pallets (this includes `Default` implementation for `GenesisConfig`).
- At the runtime level, we’re suggesting a `genesis-config` feature. We expect that disabling this feature will restrict linking any `serde` or `GenesisConfig` related functionality from pallets and the runtime into the WASM blob.
- To enhance interaction with `GenesisConfig` for the runtime, we’ve proposed a new runtime API called `GenesisBuilder`. This API simplifies the instantiation of a default `GenesisConfig`, its serialization to a JSON blob, deserialization from a given JSON blob, and storage of the `GenesisConfig`.

Several pull requests have already been initiated in this regard:

- `serde` support in `primitives`: [https://github.com/paritytech/substrate/pull/13027](https://github.com/paritytech/substrate/pull/13027)
- `GenesisBuilder` API proposal: [`GenesisBuilder` Runtime API: preliminary proposal by michalkucharczyk · Pull Request #14131 · paritytech/substrate · GitHub](https://github.com/paritytech/substrate/pull/14131)
- Enabling `GenesisConfig` in frame for `no_std`: [frame: Enable GenesisConfig in no\_std by michalkucharczyk · Pull Request #14108 · paritytech/substrate · GitHub](https://github.com/paritytech/substrate/pull/14108)
- Activating `GenesisBuild::build` for `no_std`: [frame: GenesisBuild::build allowed in no\_std by michalkucharczyk · Pull Request #14107 · paritytech/substrate · GitHub](https://github.com/paritytech/substrate/pull/14107)

For a practical demonstration of the new API’s usage and implementation on runtime side, check out our draft/proof of concept here:

> <https://github.com/paritytech/substrate/blob/55318dbd974942dc99f1592d56f84b487820163e/test-utils/runtime/src/lib.rs#L1310-L1342>

> <https://github.com/paritytech/substrate/blob/55318dbd974942dc99f1592d56f84b487820163e/test-utils/runtime/src/lib.rs#L717-L726>
