Introduction
Fleek Network incentivizes participation by rewarding its node providers. A node is identifiable by an identity, which the reward mechanism uses to identify the node to reward it.
At time of writing the rewards mechanism hasn't yet been introduced, read the testnet plans to get a high level perspective over the plans. A token and economics paper should be released in the future.
We'll use the term identity to describe the key store declared in the configuration, in our case PEM files. The content of the PEM files and the file itself should be kept secret.
The key store is in the file system and the location is defined in the Fleek Network ~/.lightning/config.toml
, as a private key stored in an identity named PEM file (by default consensus.pem
and node.pem
). It's essential to understand this, as you may want to copy the identity to a new server setup, to persist the identity accross to the new server setup.
Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.
The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you're migrating to.
Pre-requisites
To follow the guide, you will need the following:
- Familiarity with the command-line interface
- A basic understanding of how public key cryptography works
Configuration file
Locating the file
The Lightning CLI has a configuration file in the home directory of the user, which by default is located in the path $HOME/.lightning
or ~/.lightning
under the name config.toml
. It's generally described as ~/.lightning/config.toml
.
The tilde in ~/.lightning
represents $HOME
which is simpler, but we'll use $HOME
to make it easy to follow.
If you're following the install recommendations you should be logged in with a sudoer account. For our guide, let's imagine that the sudoer username we are logged in with is lgtn.
The word sudo is the abbreviation of the term "super user do". As the name suggests, it is the privilege that a super user, such as an administrator has to do whatever it wants in the system. A super user can be an administrator, like the root or what we described here as a user in the group sudo aka sudoer.
If you are logged in with a username, that'd be:
/home/<USERNAME>/.lightning/config.toml
For our example for user lgtn
that is:
/home/lgtn/.lightning/config.toml
If you log in with another user, let's say fleek
it'd be:
/home/fleek/.lightning/config.toml
At any time, you can check which user you are logged in with by running the command:
whoami
Here's an example of our user lgtn
, which for the command above outputs:
lgtn
To switch to a particular user, you can run the command su <USERNAME>
e.g. for the user lgtn we would execute the command su lgtn
.
Now that you know where to locate the configuration file for any given user you are logged in with, learn about the Configuration sections.
Configuration sections
The Fleek Network node configuration settings are located in the path $HOME/.lightning/config.toml
, and it's organized by configuration sections.
At the time of writing, we have a TOML file with sections. Here are some examples amongst others:
- application
- origin-ipfs
- rpc
- signer
Each of the sections holds several property names and values. If you are accustomed to the JSON or YAML formats, you'll find the TOML format a bit similar (if you'd like to learn more about the TOML file format, read about it here).
By default, and at time of writing the Lightning CLI configuration file (config.toml) is similar to:
[BLANK]
[application]
db_path = "/home/lgtn/.lightning/data/app_db"
mode = "Prod"
storage = "RocksDb"
testnet = true
[blockserver]
address = "0.0.0.0:4211"
[broadcast]
address = "0.0.0.0:4200"
[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"
[dht]
address = "0.0.0.0:8101"
bootstrappers = []
[fetcher]
[fsstore]
root = "/home/lgtn/.lightning/blockstore"
[[handshake.transport]]
signal_address = "0.0.0.0:4210"
type = "WebRTC"
[[handshake.worker]]
type = "AsyncWorker"
[[handshake.worker]]
type = "AsyncWorker"
[[handshake.worker]]
type = "AsyncWorker"
[[handshake.worker]]
type = "AsyncWorker"
[[origin-ipfs.gateways]]
authority = "ipfs.io"
protocol = "Https"
[[origin-ipfs.gateways]]
authority = "fleek.ipfs.io"
protocol = "Https"
[[origin-ipfs.gateways]]
authority = "ipfs.runfission.com"
protocol = "Https"
[rep-collector]
reporter_buffer_size = 5
[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"
[rpc]
addr = "0.0.0.0"
port = 4230
[service-executor]
services = [0, 1]
[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"
[topology]
testing_min_nodes = 9
testing_target_k = 8
Beware that the configuration file might look a bit different depending on the version you're running and the current development features in place by the Fleek Network core team. You shouldn't copy the example above and replace with yours, as this only servers for illustrative purposes.
Some advanced use cases might require dealing with the host and port number binding, depending on the service provider's needs and customization. We'll keep things simple and assume the default settings.
In this guide, we are interested in the [signer]
section settings for the consensus_key_path
and node_key_path
which by default is set to ~/.lightning/keystore
.
The identity is a text description for the Keystore and at the time of writing we have not yet implemented multiple identity management via the CLI. Thereupon, the identity value serves to find the filename match in the keystore_path
. This might change as we progress with development. Check the Identity selection to learn more about it!
Type of keys
There are three types of keys related to the identity of a node and the account ownership. The keys are based in public-key cryptography, or asymmetric cryptography where each key pair consists of a public key and a corresponding private key. The keys are described in the section identity on the Fleek Network as follows:
-
A Node key (ConsensusPublicKey) is BLS12-381 which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates
-
A Node Networking key (NodePublicKey) is Ed25519 used for the speed and performance of the network communications
-
Account Owner keys are based on secp256k1, which corresponds to an Ethereum Address
For instance, a public key is open to anybody to see, and it represents a unique node identifier in the Fleek Network, a bit like a passport number. On the other hand, the private key is secret, and the operator is responsible to store it privately.
The Fleek Network relies on cryptography, thus the Fleek Network team and anybody can access, compromise or manipulate the secrets of an identity. On the other hand, the public key can be used by anyone, Fleek Network included, to identify a node or send rewards to the address without jeopardizing identity security.
To learn more about the identities on the Fleek Network here.
Key privacy
If you don’t keep your private keys secret, you'll have your node compromised.
Here are a few examples of what you should not do:
- Share the
$HOME/.lightning/keystore
directory file content publicly - Track the
$HOME/.lightning/keystore
directory files in a version control repository e.g. git - Have poor "rights" permissions in UNIX systems e.g. everyone can read, delete, modify
$HOME/.lightning
- Allow anyone to access the node provider physically without any access control to the operating and file systems e.g. a VPS provider
- Get rid of a hard drive unformatted or blind erased by selling to somebody or dumping in the bin, which contains
$HOME/.lightning/keystore
There are many other ways of getting compromised, but hopefully, the ones put above give you a good starter into the subject.
Remember, the node provider is the only one responsible when managing the key store. Neither Fleek Network nor the most sophisticated AI system presently can compromise the cryptography in use to help you out. You are fully responsible for securing and retaining your private keys.
Identity selection
Multiple identity management is yet to be implemented but in any case, some users might find it trivial to keep multiple identities and switch between them referencing them by name. The following section is not advocating this approach but sharing some approaches that can help certain use-cases.
Let's suppose that we've recently moved to a new server setup and copied our previous server keystore keys as consensus.pem
and node.pem
and renamed the $HOME/.lightning/keystore/*.pem
to $HOME/.lightning/keystore/new-*.pem
.
We are using a wildcard *
to reduce verbosity. The wildcard means as replacement for all the filenames encountered in the path and extension without having to name them individually as we know they are consensus.pem
and node.pem
.
To illustrate this scenario, here's an example of how our $HOME/.lightning/keystore
directory could look like:
.
├── new-consensus.pem
├── new-node.pem