I need to store the chain state after some interval and start it with new genesis. How I can do that? Please read this issue for reference. Also, is there any other way to achieve this except re-genesis?
There are a lot of ways you can dump the existing state of your chain, and use that as the genesis state for a new chain.
Note that all state for a Substrate chain is simply a key-value pair, so by copying the keys and values into your new chain, you will basically copy the state. You should be a bit careful, things like the current block number, block hash, consensus information, and other things which you DO intend to reset should not be copied over to your new chain.
Probably the easiest tool to do this for you automatically is: https://github.com/maxsam4/fork-off-substrate
Which automates the steps of:
- grabbing all keys and values from an existing chain
- cleaning up any keys which you do not want to migrate
- placing the final key and values into a genesis json that can be used to start your new chain
You can of course write your own tool to do this quite easily.