Skip to main content

Start a Logos module from the CLI

Explore how to load and call a Logos module from the command line using logoscore.

This guide covers how to build and install a Logos module, start the logoscore daemon, and call module methods from the command line. It is intended for users who want to run an existing module, or developers who have already built a module binary and want to run it locally for testing or development. By the end you will have a running logoscore instance that loads accounts_module as an example module and returns results for mnemonic generation and relative strength.

Before you start, make sure you have the following:

  • Nix with flakes enabled. Install from nixos.org, then enable flakes:

    mkdir -p ~/.config/nix
    echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf

    Verify: nix flake --help >/dev/null 2>&1 && echo "Flakes enabled"

  • Git

  • Linux or macOS

  • logoscore, lgpd, and lgpm installed. To install these tools, use the install-node-tools.sh helper script:

    curl -fsSL https://raw.githubusercontent.com/logos-co/logos-docs/main/resources/scripts/install-node-tools.sh | sh
    export PATH="$PWD/bin:$PATH"

What to expect

  • You can load accounts_module into a running logoscore daemon and call its methods.
  • You can generate a BIP-39 mnemonic phrase and measure its entropy strength with no prior setup.
  • You have a working local modules directory that logoscore can scan for future modules.

Install the module

logoscore expects each module in its own subdirectory containing a manifest.json. The lgpm package manager handles this layout automatically when given an LGX package.

  1. Clone the logos-accounts-module repository and build the LGX package:

    git clone https://github.com/logos-co/logos-accounts-module.git
    cd logos-accounts-module

    nix build '.#lgx'

    cd ..
  2. Create the modules directory and copy the pre-loaded logos modules to it:

    mkdir -p modules
    cp -RL ./logos/modules/. ./modules/
  3. Install the LGX package into the modules directory:

    lgpm --modules-dir ./modules install --file ./logos-accounts-module/result/*.lgx

    After installation, the directory structure looks like this:

    modules/accounts_module/
    ├── accounts_module_plugin.dylib # (or .so on Linux)
    ├── manifest.json # Auto-generated by lgx
    └── variant # Platform variant identifier
  4. Confirm the module was installed correctly:

    lgpm --modules-dir ./modules list

Call module methods

With the module installed, start the logoscore daemon, load the module, and call its methods.

  1. Start the daemon in the background, pointing it at the modules directory, and wait to initialise:

    logoscore -D -m ./modules &
    sleep 3
  2. Check the status of logoscore:

    logoscore status
  3. Load the module and confirm that it was loaded:

    logoscore load-module accounts_module

    logoscore list-modules
  4. Generate a random BIP-39 mnemonic phrase with 12 words:

    logoscore call accounts_module createRandomMnemonic 12
  5. Map a mnemonic word count to its entropy strength in bits — for example, 12 words is 128 bits.

    logoscore call accounts_module lengthToEntropyStrength 12
  6. Inspect all available methods in accounts_module with module_info:

    logoscore module-info accounts_module
  7. Stop the daemon:

    logoscore stop
    sleep 2

    For inline (legacy) mode and other logoscore options, see the Developer Guide — Running with logoscore.

Troubleshooting logoscore module startup

The modules directory is not found

Confirm the module subdirectory exists and contains a manifest.json file. Installing the package again with the correct --modules-dir path resolves this in most cases.

The platform key in manifest.json does not match

logoscore matches the main object in manifest.json against your OS and architecture (for example, linux-aarch64 or darwin-arm64). Rebuild the LGX package on the target platform and reinstall.

The daemon does not respond after sleep 3

Increase the sleep duration if your machine is slow to initialise, or check for port conflicts by inspecting the daemon's stderr output.