|
| 1 | +# glcli |
| 2 | + |
| 3 | +`glcli` is a command-line interface for running a __Greenlight signer__ and |
| 4 | +operating a __Greenlight_node__. It is built on top of the `gl-client` library. |
| 5 | + |
| 6 | +## Features |
| 7 | + |
| 8 | +`glcli` is not yet feature-complete but already provides a basic set of |
| 9 | +commands necessary for everyday node operations. Planned future enhancements |
| 10 | +include additional commands and broader integration. |
| 11 | + |
| 12 | +* __Scheduler__: Interact with Greenlight's scheduler to provision and start nodes. |
| 13 | +* __Signer__: Run and interact with a local signer. |
| 14 | +* __Node__: Operate and control a lightning node hosted on Greenlight. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +Since `glcli` is not yet published on __crates.io__, you can install it locally |
| 19 | +using |
| 20 | +```bash |
| 21 | +cargo install --path=. |
| 22 | +``` |
| 23 | +Run this command from the `glcli` directory. |
| 24 | + |
| 25 | +### Prerequisites |
| 26 | + |
| 27 | +Ensure __Rust__ is installed on your system. If it is not installed, you can set |
| 28 | +it up using [Rustup]("https://rustup.rs/"): |
| 29 | +```bash |
| 30 | +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| 31 | +``` |
| 32 | + |
| 33 | +### Build and Install Locally |
| 34 | + |
| 35 | +Navigate to the `glcli` directory and use __Cargo__ to install `glcli` into |
| 36 | +your `CARGO_HOME` (which defaults to `$HOME/.cargo/`): |
| 37 | +```bash |
| 38 | +cargo install --path=. |
| 39 | +``` |
| 40 | +Ensure that `CARGO_HOME/bin` is in your `PATH`. |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +After installation, run: |
| 45 | +```bash |
| 46 | +glcli --help |
| 47 | +``` |
| 48 | +This will display an overview of the available commands. |
| 49 | + |
| 50 | +By default, `glcli` stores application data in the system's default data |
| 51 | +directory: |
| 52 | +* __Linux__: `$XDG_DATA_HOME` or `$HOME/.local/share` |
| 53 | +* __macOS__: `$HOME`/Library/Application Support |
| 54 | + |
| 55 | +To specify a custom data directory, use the `--data-dir` or `-d` option. For |
| 56 | +example: |
| 57 | +```bash |
| 58 | +glcli -d "${HOME}/.greenlight_node_1" node getinfo |
| 59 | +``` |
| 60 | + |
| 61 | +### Register a Node |
| 62 | + |
| 63 | +Before you can operate a Greenlight node you have to register one. Currently, |
| 64 | +you need an _invite code_ or a |
| 65 | +[developer certificate]("https://blockstream.github.io/greenlight/getting-started/certs/") |
| 66 | +to register a new node. `glcli` currently supports registration via an |
| 67 | +_invite code_ using the `--invite-code` option: |
| 68 | +```bash |
| 69 | +glcli scheduler register --invite-code=<YOUR_INVITE_CODE> |
| 70 | +``` |
| 71 | + |
| 72 | +### Run a Local Signer |
| 73 | + |
| 74 | +To operate your node, you need to attach a local signer to your Greenlight node. |
| 75 | +The signer is responsible for handling cryptographic signing operations, |
| 76 | +ensuring transaction security and validating requests before granting |
| 77 | +signatures locally. |
| 78 | + |
| 79 | +Start a local signer and attach it to Greenlight by running: |
| 80 | +```bash |
| 81 | +glcli signer run |
| 82 | +``` |
| 83 | + |
| 84 | +The signer now listens for incomming requests. |
| 85 | + |
| 86 | +### Operate a Greenlight Node |
| 87 | + |
| 88 | +_(Optional scheduling)_: When executing a `node` command, `glcli` will |
| 89 | +automatically start the node by calling Greenlight's scheduler if necessary. |
| 90 | +However, you can manually schedule your node in advance by running: |
| 91 | +```bash |
| 92 | +glcli scheduler schedule |
| 93 | +``` |
| 94 | + |
| 95 | +Once provisioned, you can interact with your node using `node` subcommands. For |
| 96 | +example to check the node's operational state: |
| 97 | +```bash |
| 98 | +glcli node getinfo |
| 99 | +``` |
| 100 | + |
| 101 | +## Advanced Bitcoin Network Configuration |
| 102 | + |
| 103 | +Greenlight supports running nodes on the `bitcoin` and `signet` networks, |
| 104 | +defaulting to `bitcoin`. To register a Greenlight node on `signet`, use the |
| 105 | +`--network` option: |
| 106 | +```bash |
| 107 | +glcli --network="signet" scheduler register |
| 108 | +``` |
| 109 | +Include the `--network` option in all susequent commands for this node. For |
| 110 | +example: |
| 111 | +```bash |
| 112 | +glcli --network="signet" signer run |
| 113 | +``` |
| 114 | +```bash |
| 115 | +glcli --network="signet" node getinfo |
| 116 | +``` |
| 117 | + |
| 118 | +_Please note that we __do not__ support `testnet` at the moment. Please open an |
| 119 | +issue describing your use case if you need support for other networks._ |
| 120 | + |
| 121 | +## Development |
| 122 | +### Build `glcli` |
| 123 | +```bash |
| 124 | +cargo build |
| 125 | +``` |
| 126 | +### Run Tests |
| 127 | +```bash |
| 128 | +cargo test |
| 129 | +``` |
| 130 | + |
| 131 | +## Contributing |
| 132 | +`glcli` is under active development and currently lacks many major commands from |
| 133 | +[Core-Lightning]("https://github.com/ElementsProject/lightning") such as |
| 134 | +`listinvoices`, `fundchannel`, `close` and `sendpay`. Contributions to |
| 135 | +add these and other missing commands are welcome. If you need a command |
| 136 | +that is not yet available, feel free to submit a pull request or open an issue |
| 137 | +describing your use case. |
| 138 | + |
| 139 | +If you encounter any bugs, please report them via an issue or contribute a fix |
| 140 | +through a pull request. |
| 141 | + |
| 142 | +## License |
| 143 | +`glcli` is licensed under the __MIT License__ |
0 commit comments