Setting up a Trustee
Trustees are a core component of PAD. PAD relies on sufficient number of Trustees acting honestly. This is a means of decentralising trust. Given their essential role, Trustees should be run by trusted individuals.
We recommend running a Trustee on a Raspberry Pi. The Trustee software will then run as a daemon and periodically queries the PAD server and responds accordingly. The procedure is simple: download the scripts; edit the configuration file; then start the Trustee daemon.
In the following sections, we assume access to the Raspberry Pi is already set up, either with a monitor and mouse or in headless mode via secure shell (SSH) (See this for a tutorial on setting up a headless Raspberry Pi).
Clone the repository
The repository is currently private. Please email padtrustees@sw7group.com with your GitHub account name and we will send you a licence to provide access to the repo.
The repository consists of the installer script install.sh
, the NodeJS source code of the Trustee, a template configuration file config/pad-trustee.json
and a service file service/pad-trustee.service
that makes the Trustee a daemon.
Install node.js and npm
This will install Node.js and npm (Node Package Manager).
Run the installer
with the command
where ~/pad-trustee-node
is the location of the downloaded repository.
The script
checks if nvm (Node Version Manager) is installed
if not, prompts to install nvm. The user can also manually install nvm.
generates a random ID for the Trustee
generates the decryption key and signing key
creates directories that sit the configuration files and Trustee private keys, the source code and the service file
generates a configuration file with the Trustee's ID and private keys
installs NodeJS 14 and installs dependencies
most importantly, display the public details of the Trustee
Copy the last step's output of the installer. This information is required to register the Trustee on the PAD server. This is a sample output of the installer:
Register as a Trustee
Send the information above (Trustee ID, name, and the public keys) to padtrustees@sw7group.com. Until then, the PAD server will not process requests from the Trustee.
After registration, an Operator can nominate you to be a Trustee of their instance.
Start the Trustee daemon
Reload the list of user services:
Then, the Trustee daemon can be started:
The daemon should fail to start:
This is because we are using the template API key. We should obtain at least one working Trustee API key to get the daemon running properly.
Obtain Trustee API keys
Whenever a PAD instance is created with you nominated as a Trustee, we will send you the instance name and a Trustee API key associated with the instance. You can choose to join and serve the instance or not.
To join a PAD instance as a Trustee, update the configuration file at ~/.pad-trustee/config/pad-trustee.yaml
. The instances
section shows the list of instances the Trustee is serving. It is a dictionary where the key is the instance name and the value contains the API key.
Remove the template instance for the first time. Afterwards, add new entries in the dictionary with the corresponding instance name and API key.
For example, suppose two instances my-pad-1.0
and my-pad-2.0
have been created by Operators, and the Trustees' API key for them are pad.api.key1
and pad.api.key2
. This is how instances
should look like in the configuration file:
To apply the changes, restart the Trustee daemon:
Query Trustee status
You can query the Trustee daemon's status using systemctl
:
The status Active: active (running)
shows that the daemon is running properly.
For a more detailed log of the daemon, you may use journalctl
:
To see a live update of the log, use the -f
flag. Press Ctrl + C
to exit monitoring.
Updating the Trustee code
To update the Trustee code, download/clone the repository again. Then run patch.sh
.
The script will copy the up-to-date code over to the source directory of the Trustee daemon. It will then restart the daemon.
(Optional) Enable Trustee daemon to start on boot
You may wish the Trustee daemon to start automatically on boot. To do this, simply use the enable
command in systemctl
:
(Optional) Configure the Trustee daemon
A PEM-encoded string may be used as the keys in the config file instead of specifying a path. For example, instead of having the section
You may use a key directly like this:
You may change the list of instances the Trustee references in the
instances
section.You may change the
interval
in seconds in which the Trustee queries the PAD server.
Do not set
interval
too small, otherwise some requests may be blocked by the server because of rate-limiting.
You may change the path in which the states of the Trustee is stored at
storage.path
.
Last updated