Persistent storage

Configuring a persistent storage for the PeerStore component

The peerStore is responsible for maintaining information about peers in the P2P network. 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 peerStore 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.

Ensure that the path given is relative to the location where you are running the CLI command. For example, specifying data/peerstore will create the directory under the current working directory.

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/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/data/dir

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

Last updated