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.
(default host is `127.0.0.1` and port is `30303`).
!!! example
If the [`--p2p-host`](../Reference/Pantheon-CLI-Syntax.md#p2p-host) or [`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port) options are not specified and the node public key is `0xc35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f`
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`: