The node public key is displayed in the log after starting Pantheon. Use the [`public-key`](../Reference/Pantheon-CLI-Syntax.md#public-key) subcommand to export the public key to a file.
If the `key` file exists, the node is started with the private key in the custom `key` file. If the custom `key` file does not exist,
a node private key is generated and written to the custom `key` file.
For example, the following command either reads the node private key from the `privatekeyfile` or writes the generated private key to the `privatekeyfile`: