Persistent storage

The persistent storage is responsible for maintaining information about peers in the P2P network, all the received attestations and tasks submitted. Persistent storage ensures that this information is retained across restarts of the application. The storage is managed using datastore-level, which stores the data on the local filesystem.

A new flag, --p2p.datadir, has been introduced to specify the directory where the data should be stored. If the specified directory does not exist (e.g., when running the CLI with this option for the first time), the application will create it, provided the process has the necessary write permissions.

Setting Up the Data Directory with Correct Permissions

If the application encounters permission issues when creating the directory, you may need to manually create it and assign appropriate read/write permissions:

# e.g. your data path is .othentic/data/p2p
mkdir -p .othentic/data/p2p
chmod -R 755 .othentic

The --p2p.datadir flag can be used in the aggregator and attester commands as follows:

othentic-cli node aggregator \
    --json-rpc \
    --p2p.datadir /path/to/aggregator/data/dir

othentic-cli node attester \
    /ip4/127.0.0.1/tcp/9876/p2p/<BOOTSTRAP_NODE_ID> \
    --avs-webapi <HOST> \
    --avs-webapi-port <PORT> \
    --p2p.datadir /path/to/attester/data/dir

After restarting the node, it will attempt to reconnect to all known peers that are persisted in the storage.

If you're running in Docker, make sure to configure Volumes in the Docker file:

services: 
  aggregator:
      command: [
            "--p2p.datadir", "/path/to/aggregator/data/dir"
          ]
      volumes:
            - ./path/to/aggregator/data/dir: /app/path/to/aggregator/data/dir

When running the node through Docker, you need to identify which user ID (UID) runs the process and grant permissions.

To determine the UID for the above `docker-compose` setup, run:

// docker-compose exec <service_name> id
> docker-compose exec aggregator id
uid=1000(node) gid=1000(node) groups=1000(node)

This output lets us know the process is run with UID `1000`.

Therefore, grant the directory correct permissions using the following command:

sudo chown -R 1000:1000 .othentic/

For more details, check the Docker file in Simple Price Oracle Repository.

Last updated