10

The Substrate Node Template says in the "Run" section of the README, that the single-node development chain will start with "non-persistent state" if run with the following command:

cargo run --release --dev --tmp

The Substrate Node's --help file says --dev specifies the development chain and sets, among other things, the --tmp flag.

But, what is --tmp is supposed to do? The node seems to run fine with only --dev. I can't find --tmp in --help either.

Also, if --help is accurate, then the --tmp doesn't need to be specified alongside --dev, and that may just be a mistake in the README?

3 Answers 3

9

Every blockchain maintains some amount of state on the computer which it runs. For example to store information about the history of the blockchain, the current block, the current state, etc...

When starting a Substrate blockchain with the --tmp flag, it will place all of these files into a temporary system folder which will be cleaned up once the program terminates. It would be equivalent to use the --purge-chain flag at the end of running your blockchain to delete all of the local files.

Indeed, if you have the --dev flag, you do not need the --tmp flag, since developer chains by default are now configured to be temporary by default.

6

--tmp means it runs a temporary node. And it stop when you close the terminal. This way you could run your development mode without purging the data.

1
  • 1
    When you run with --tmp, the entire idea is that the data is purged on closing the node.
    – bkchr
    Feb 9, 2022 at 15:14
5

--tmp will clear down the state before it starts, so rather than carrying on from the last agreed block it will start from the first block again.

But in this case it seemingly has no effect, because as of a few months ago --dev now implies --tmp by default.

1
  • 2
    I don't believe "clear down the state before it starts" is accurate. The blockchain state is placed in a temporary folder and is cleaned up as soon as the process ends.
    – Shawn Tabrizi
    Feb 9, 2022 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.