paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Dump state into new genesis file #2116

Closed atenjin closed 1 year ago

atenjin commented 5 years ago

I think substrate may need a checkpoint feature. it could be used in follow situation

xlc commented 5 years ago

Another similar feature I want is able to generate genesis file from current state. This means I can configure the testing environment once (deposit funds, deploy smart contract, doing configuration that is not possible with GenesisConfig, etc) and make a genesis file from it, and reuse it.

tomaka commented 4 years ago

Note that it is already possible to export and import blocks out of/into the database, if that's what this issue is about.

apopiak commented 3 years ago

The substrate export-state subcommand introduced in https://github.com/paritytech/substrate/pull/5842 should solve this, right?

bkchr commented 3 years ago

Not entirely. We still don't have checkpoints.

atenjin commented 2 years ago

The substrate export-state subcommand introduced in #5842 should solve this, right?

not the full feature. for now, the export-state just can start the new chain from 0 height. but in fact, the best way is to start the new chain with the same height.

I think it needs a lot of modification for substrate backend part, and related to some consensus part.

takahser commented 1 year ago

According to Kusama Network's YouTube video Part 1: How to Register a Parachain on Polkadot and Kusama it should be possible to generate the genesis file and the runtime wasm file by running the following command:

image

I tried that using the node-template however, I got an error:

$ ./node-template export-genesis-state --parachain-id 21; ./node-template export-genesis-wasm > wasmfile
error: The subcommand 'export-genesis-state' wasn't recognized

    Did you mean 'export-blocks' or 'export-state'?

Also, when I try to run the suggested command, the parachain-id arg is not recognized:

 % ./node-template export-state --parachain-id 2225;
error: Found argument '--parachain-id' which wasn't expected, or isn't valid in this context

So my questions are:

  1. What's the correct command for exporting the genesis state?
  2. Also, what's the correct command for exporting the runtime wasm, since the export-genesis-wasm command is not recognized at all?

    % ./node-template export-genesis-wasm > wasmfile
    error: The subcommand 'export-genesis-wasm' wasn't recognized
bkchr commented 1 year ago

@takahser you need to use the parachain node template.

kianenigma commented 1 year ago

This seems existent with the export-state subcommand, it is just a matter of using it right.