Generate a PFN Identity
Generate a PFN Identity
Public fullnodes (PFNs) will automatically start up with a randomly generated (ephemeral) network identity. This works well for regular PFNs. However, you may want to generate and assign a static network identity to your PFN. This is useful when:
You wish to advertise your PFN as a seed (i.e., for other Endless PFNs to connect to).
You wish to add your PFN to an allowlist of known identities on an upstream PFN or VFN.
You wish to fix the identity of your PFN across restarts and releases so that telemetry and other monitoring tools can track your PFN over time.
This guide will show you how to generate a static network identity and start your PFN with this identity.
Generate a static identity
To create a static identity for your PFN, you will first need to generate a private and public key pair. You will then need to derive the peer_id
from the public key, and use the peer_id
in your configuration file (e.g., fullnode.yaml
) to configure the static network identity for your PFN.
The steps below will guide you through the process of generating a static identity for your PFN. The exact steps depend on whether you are using the endless-core
source code to run your PFN, or Docker.
Using the endless-core source code
If you use the endless-core
source code to run your PFN, follow these steps:
Generate the private key
First, use the Endless CLI (endless
) to produce a hex encoded static x25519 private key. This will be the private key for your network identity. Run the following endless
CLI command:
This command will create a file private-key.txt
with the private key in it, and a corresponding private-key.txt.pub
file with the public key in it. An example private-key.txt
file and private-key.txt.pub
file are shown below:
2. Retrieve the peer identity
Next, retrieve the peer identity from the public key using the endless
CLI. The --host
flag in the command will provide the host information to output a network address for your PFN. Run the following command (be sure to update the --host
flag with your actual host information):
This command will output the public identity information for your PFN to a file peer-info.yaml
. For example:
In this example, B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813
is the peer_id
.
Start a PFN with the identity
After extracting the peer identity from the public key, you can start your PFN with the identity using the public key in the peer_id
field of the configuration file (e.g., fullnode.yaml
). For example:
In our example (from above), the configuration file (fullnode.yaml
) should now have the following information:
Starting your PFN with this configuration will assign your PFN with the static network identity you generated.
Using Docker
If you use Docker to run your PFN, follow these steps:
Prepare your tools
First, cd
into the directory for your local PFN and start a Docker container with the latest tools, for example:
Generate the private key
Next, follow the remaining steps from inside the endlesslabs/tools
Docker container.
Open a new terminal and cd
into the directory where you started the Docker container for your PFN. Making sure to provide the full path to where you want the private key file to be stored, run the command:
Retrieve the peer identity
Next, retrieve the peer identity from the public key using the endless
CLI. The --host
flag in the command will provide the host information to output a network address for your PFN. Run the following command (be sure to update the --host
flag with your actual host information):
This command will output the public identity information for your PFN to a file peer-info.yaml
. For example:
In this example, B881EA2C174D8211C123E5A91D86227DB116A44BB345A6E66874F83D8993F813
is the peer_id
.
Start a PFN with the identity
After extracting the peer identity from the public key, you can start your PFN with the identity using the public key in the peer_id
field of the configuration file (e.g., fullnode.yaml
). For example:
In our example (from above), the configuration file (fullnode.yaml
) should now have the following information:
Starting your PFN with this configuration will assign your PFN with the static network identity you generated.
Last updated