Run a Logos storage node
Get started running a Logos storage node and uploading your first file to the Logos network.
This document is accurate for Testnet v0.3.
This procedure covers how to build and run the Logos Storage Module, connect it to the testnet bootstrap nodes, publish a file, and verify that the file can be downloaded. It is intended for node operators on testnet v0.3 who want to contribute storage capacity to the Logos network.
- A supported OS:
- Linux
- Mac OS (should work, but not tested)
- Windows 10 or 11 x86_64. The commands in this guide use POSIX shell syntax, so run them in Git Bash (part of Git for Windows).
jqon yourPATH.- To verify, run:
jq --version - On Windows, install it with
winget install jqlang.jq.
- To verify, run:
logosctlinstalled.- Install it by running
curl -fsSL https://raw.githubusercontent.com/logos-co/logos-docs/main/resources/scripts/install-logosctl.sh | sudo sh - On Windows, run
irm https://raw.githubusercontent.com/logos-co/logos-docs/main/resources/scripts/install-logosctl.ps1 | iexin PowerShell instead, then open a new terminal.
- Install it by running
What to expect
In this tutorial, you will:
- Connect a Logos Storage node to the testnet.
- Publish a file to the network.
- Download an existing file - the Logos book, Farewell to Westphalia - from the Logos storage network.
Load the Logos storage module
logosctl ships the Logos storage module and loads it when the daemon starts, because the package downloader uses it as an optional dependency to fetch packages. The package downloader may also have started the storage node already, with the default configuration or the one saved by your last init. Stop it first so that you can start it with your own configuration.
-
Start
logosctl:logosctl daemon start -
In a new terminal window with the same user, confirm that
storage_moduleis loaded:logosctl module ls- If it isn't listed, install it from the catalogue, pinned to version 3.0.0, and load it:
logosctl catalog refreshlogosctl package install storage_module --version 3.0.0 --yeslogosctl module load storage_module- A
module loadsent before the daemon is ready fails with an RPC or missing client config error. If that happens, checklogosctl statusagain and retry.
noteIndividual module package versions (for example, storage module version 3.0.0) are pinned independently and do not necessarily match the testnet version number (0.3.0).
-
Check whether the storage node is already running:
logosctl call storage_module isRunning -
If the result is
true, stop the node, wait untilisRunningreturnsfalse, then destroy it:logosctl call storage_module stop# Wait a few seconds, then check that isRunning returns falselogosctl call storage_module isRunninglogosctl call storage_module destroy- Don't unload and reload the module instead: the package downloader starts the node again as soon as the module is back.
Configure and start the node
Initialise and start the storage module with logosctl.
Several module calls in this procedure are asynchronous: the call returns "result":true as soon as the command is accepted, and the real outcome is delivered later as an event (storageStart, storageUploadDone, storageDownloadDone, storageRemoveDone, storageDownloadManifestDone). These events are emitted to event subscribers (such as the Storage UI); the logosctl call client does not subscribe to them, so they do not appear in the daemon log (~/.logosctl/logs/daemon.log). Each step below instead waits briefly and confirms the outcome with a follow-up query (for example manifests or exists).
To see every method the module exposes (the same methods you can call), run logosctl module-info storage_module.
-
Use the Storage module to produce a suitable default configuration:
logosctl call storage_module loadConfigOrDefault | jq ".result.value | fromjson" > config.jsonNow edit the configuration and modify:
data-dir: should point to an absolute path on your disk, to which you have write access. On Windows, use a Windows path such asC:/Users/<you>/logos-storage-data: Git Bash converts paths in command arguments, but not inside the JSON file;listen-port: should contain a valid TCP port which is currently free on your local machine.
tip- The default settings for Logos Storage should be enough to get your node properly connected onto the Logos testnet. In case you want more control over port allocation, or want to learn more about how Logos storage operates, see Connectivity.
- If you plan on running a node for longer, consider helping the network by setting up port mapping on your router (see Connectivity for details).
-
Initialise the Storage module.
initis synchronous and returnstrueon success (the@config.jsonsyntax loads the file's contents as the argument):logosctl call storage_module init @config.json -
Start the node.
startis asynchronous: the return value only confirms the command was accepted; completion is signalled later by thestorageStartevent (delivered to event subscribers, not written to the daemon log):logosctl call storage_module start# Wait few seconds to start -
Inspect the running node with
debug. It returns a lot of information about the node, including itsid(peer ID) and itsspr, the signed record other nodes use to connect to you (see Connectivity):logosctl call storage_module debug | jq .result.value.id# "16Uiu2HAmMA4NuQoCHz9p7jUskVjDd8WncwG3p6qBNnhnftUE5Q9C" # Your peer IDlogosctl call storage_module debug | jq .result.value.spr# "spr:CiUIAhIhA35P5KZosVyfWTfIHBVtC_PtI ... H9gX-vA" # Your SPR
Publish a file
We will now publish a file to the Logos storage network. We create a simple file just for this tutorial, but you could publish any file you'd like.
-
Create a file to publish:
echo "Hello world from Logos Storage" > "$(pwd)/hello.txt" -
Upload the file to the network with
uploadUrl. It takes an absolute path, a chunk size in bytes, and anadvertiseflag—trueannounces the file and serves it to other nodes. It returns immediately; the upload runs in the background and completes with astorageUploadDoneevent:logosctl call storage_module uploadUrl "$(pwd)/hello.txt" 65536 trueinfoThe default chunk size is 65536.
-
Extract the content ID (CID) from the first
manifestsentry:# Wait a second for the upload to complete firstlogosctl call storage_module manifests \| jq -er '.result.value[0].cid' > cid.txt
Download Farewell to Westphalia
We will now download the Logos book, Farewell to Westphalia, from the Logos storage network.
-
We will use
downloadToUrlto download the file from the network and place it into your local disk. It takes:- the CID;
- an absolute destination path;
- a
localflag; - a chunk size in bytes;
- an
isPrivateflag, and; - an
advertiseflag.
We set
localtofalseas this file is not currently available in your node;isPrivateto false so we download directly from a storage provider instead of using the Logos mix network, andadvertiseto false so we do not advertise ourselves as providers to the file.Like
uploadUrlit runs in the background and completes with astorageDownloadDoneevent:CID="zDvZRwzkzrrYB6sS1rRpRLt4gBhc1pWoyTSjkfszfmj1seaYYLCZ"logosctl call storage_module downloadToUrl "$CID" "$(pwd)/farewell-to-westphalia.pdf" false 65536 false falsenote- Setting
advertisetotruewhen you run an ephemeral node (a node that runs briefly and is then shut down) can be detrimental to network performance as your node announces itself and then leaves an advertisement pointing to a departed node. - When you download over mix (not shown here), you typically also do not want to set
advertisetotrue, as that would reveal to other nodes that you've downloaded the file, defeating the purpose of the using mix in the first place. - The
localflag reads only from locally cached data when set totrue;falsefetches from the network.
-
Wait for a while for the file to download. After a few seconds, check if the downloaded file is present at the destination path. You should try to open the pdf, and it should contain the whole book.
shasum "$(pwd)/farewell-to-westphalia.pdf"# 2c6b4dc8e8e4dae336b87b9922c38f3c94217872 farewell-to-westphalia.pdf
Remove content and shut everything down
To clear your local storage, destroy the storage node, and stop the daemon, follow the steps below.
-
Remove content from local storage by its CID.
removereturns immediately; the outcome arrives as astorageRemoveDoneevent:# Deletes the first file we uploaded.logosctl call storage_module remove "$(cat cid.txt)"# Deletes the Farewell to Westphalia book.logosctl call storage_module remove "zDvZRwzkzrrYB6sS1rRpRLt4gBhc1pWoyTSjkfszfmj1seaYYLCZ" -
Confirm the content is gone:
# Wait a second for the removal to complete firstlogosctl call storage_module exists "$(cat cid.txt)" | jq '.result.value'logosctl call storage_module exists "zDvZRwzkzrrYB6sS1rRpRLt4gBhc1pWoyTSjkfszfmj1seaYYLCZ" | jq '.result.value'# false -
Stop the storage node.
stopis asynchronous likestart; completion is signalled by astorageStopevent (delivered to event subscribers, not written to the daemon log). The node can be started and stopped multiple times:logosctl call storage_module stop# Wait a few seconds for the node to stop before destroying it -
Destroy the storage context.
destroyis synchronous and must be called after the node is stopped:logosctl call storage_module destroy -
Stop the daemon:
logosctl daemon stop
Troubleshooting Logos Storage
Connectivity problems (downloads timing out from another machine, no peers, unreachable node) are covered in the Troubleshooting and Connectivity pages.