#greenlight #lightning #bitcoin #blockchain #command-line-interface #cli

bin+lib gl-cli

A command-line interface for running a Greenlight signer and operating a Greenlight node

1 unstable release

new 0.1.0 Feb 13, 2025

#691 in Magic Beans

Download history 118/week @ 2025-02-11

118 downloads per month

MIT license

320KB
7K SLoC

glcli

glcli is a command-line interface for running a Greenlight signer and operating a Greenlight_node. It is built on top of the gl-client library.

Features

glcli is not yet feature-complete but already provides a basic set of commands necessary for everyday node operations. Planned future enhancements include additional commands and broader integration.

  • Scheduler: Interact with Greenlight's scheduler to provision and start nodes.
  • Signer: Run and interact with a local signer.
  • Node: Operate and control a lightning node hosted on Greenlight.

Installation

Since glcli is not yet published on crates.io, you can install it locally using

cargo install --path=.

Run this command from the glcli directory.

Prerequisites

Ensure Rust is installed on your system. If it is not installed, you can set it up using Rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Build and Install Locally

Navigate to the glcli directory and use Cargo to install glcli into your CARGO_HOME (which defaults to $HOME/.cargo/):

cargo install --path=.

Ensure that CARGO_HOME/bin is in your PATH.

Usage

After installation, run:

glcli --help

This will display an overview of the available commands.

By default, glcli stores application data in the system's default data directory:

  • Linux: $XDG_DATA_HOME or $HOME/.local/share
  • macOS: $HOME/Library/Application Support

To specify a custom data directory, use the --data-dir or -d option. For example:

glcli -d "${HOME}/.greenlight_node_1" node getinfo

Register a Node

Before you can operate a Greenlight node you have to register one. Currently, you need an invite code or a developer certificate to register a new node. glcli currently supports registration via an invite code using the --invite-code option:

glcli scheduler register --invite-code=<YOUR_INVITE_CODE>

Run a Local Signer

To operate your node, you need to attach a local signer to your Greenlight node. The signer is responsible for handling cryptographic signing operations, ensuring transaction security and validating requests before granting signatures locally.

Start a local signer and attach it to Greenlight by running:

glcli signer run

The signer now listens for incomming requests.

Operate a Greenlight Node

(Optional scheduling): When executing a node command, glcli will automatically start the node by calling Greenlight's scheduler if necessary. However, you can manually schedule your node in advance by running:

glcli scheduler schedule

Once provisioned, you can interact with your node using node subcommands. For example to check the node's operational state:

glcli node getinfo

Advanced Bitcoin Network Configuration

Greenlight supports running nodes on the bitcoin and signet networks, defaulting to bitcoin. To register a Greenlight node on signet, use the --network option:

glcli --network="signet" scheduler register

Include the --network option in all susequent commands for this node. For example:

glcli --network="signet" signer run
glcli --network="signet" node getinfo

Please note that we do not support testnet at the moment. Please open an issue describing your use case if you need support for other networks.

Development

Build glcli

cargo build

Run Tests

cargo test

Contributing

glcli is under active development and currently lacks many major commands from Core-Lightning such as listinvoices, fundchannel, close and sendpay. Contributions to add these and other missing commands are welcome. If you need a command that is not yet available, feel free to submit a pull request or open an issue describing your use case.

If you encounter any bugs, please report them via an issue or contribute a fix through a pull request.

License

glcli is licensed under the MIT License

Dependencies

~68MB
~1M SLoC