Skip to content

Commit 11fac85

Browse files
authored
Merge branch 'main' into grpc-web-proxy-client-example
2 parents b79af42 + 92e10b5 commit 11fac85

File tree

14 files changed

+286
-311
lines changed

14 files changed

+286
-311
lines changed

.github/workflows/check-self.yml

+1
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ jobs:
6262
PYTEST_OPTS: -n 6
6363
run : |
6464
task clientpy:check
65+
task testing:check

.github/workflows/cln-version-manager-py.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
source:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-24.04
1717
steps:
1818
- name: Checkout code
1919
uses: actions/checkout@v3

.github/workflows/python.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
source:
19-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-24.04
2020
steps:
2121
- uses: actions/checkout@v3
2222

@@ -39,7 +39,7 @@ jobs:
3939
path: dist/gl_client-*.tar.gz
4040

4141
linux:
42-
runs-on: ubuntu-20.04
42+
runs-on: ubuntu-24.04
4343
strategy:
4444
fail-fast: false
4545
matrix:
@@ -79,7 +79,7 @@ jobs:
7979
if: matrix.target != 'ppc64' && matrix.target != 'x86_64' && matrix.target != 'i686'
8080
with:
8181
arch: ${{ matrix.target }}
82-
distro: ubuntu22.04
82+
distro: ubuntu24.04
8383
githubToken: ${{ github.token }}
8484
install: |
8585
apt-get update

README.md

+8-130
Original file line numberDiff line numberDiff line change
@@ -42,143 +42,21 @@ present at a time, freeing others from that duty.
4242

4343
# Getting started
4444

45-
The following is a quick walkthrough based on the python `glcli`
46-
command line tool to get you started:
47-
48-
## Install and updating `glcli` and python API
49-
50-
There are prebuilt `glcli` and `gl-client-py` packages on a private
51-
repository. These allow developers to hit a running start, without
52-
having to bother with compiling the binary extensions.
53-
45+
The easiest way to begin using __Greenlight__ is with its command-line
46+
interface `glcli`. You can install it directly from __crates.io__ by running:
5447
```bash
55-
pip install -U gl-client
56-
pip install --extra-index-url=https://us-west2-python.pkg.dev/c-lightning/greenlight-pypi/simple/ -U glcli
48+
cargo install gl-cli
5749
```
5850

59-
Should you encounter any issues with the installation it is likely due
60-
to there not being a prebuilt version of the `gl-client-py`
61-
library. Please refer to its [documentation][glpy-doc] on how to build
62-
the library from source, and let us know your platform so we can add
63-
it to our build system if possible.
64-
65-
[glpy-doc]: libs/gl-client-py
66-
67-
## Register / recover an account
68-
69-
Registration and recovery are managed by the scheduler, hence the
70-
`scheduler` prefix in the following commands.
71-
72-
```
73-
$ glcli scheduler register --network=testnet
74-
{
75-
"device_cert": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n\n\n",
76-
"device_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
77-
}
78-
```
79-
80-
This returns an mTLS certificate and a matching private key that is
81-
used to authenticate and authorize the application with the
82-
services. These should be stored on the device and be used for all
83-
future communication. In particular, nodes will only accept incoming
84-
connections that are authenticated with the user's certificate. In
85-
order to register as a new user a signature from the key manager is
86-
required.
87-
88-
The recovery process is also based on the key manager providing a
89-
signature:
90-
91-
```bash
92-
$ glcli scheduler recover
93-
{
94-
"device_cert": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n\n\n",
95-
"device_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
96-
}
97-
```
98-
99-
This too provides a certificate and a matching private key that can be
100-
used to authenticate and authorize the application.
101-
102-
## Scheduling
103-
104-
While `glcli` takes care of scheduling the node automatically if
105-
another command is provided, when implementing the client this must be
106-
done as a separate step:
107-
51+
Once installed execute:
10852
```bash
109-
$ glcli scheduler schedule
110-
{
111-
"grpc_uri": "https://35.236.110.178:6019",
112-
"node_id": "A27DtykCS7EjvnlUCB0yjrSMz4KSN4kGOo0Hm2Gd+lbi"
113-
}
114-
```
115-
116-
Notice that protocol buffers encode binary values using base64, which
117-
is why the `node_id` isn't hex encoded. The node can now be reached
118-
directly at the provided URI. Notice that `glcli` will automatically
119-
look up the current location:
120-
121-
```
122-
$ glcli getinfo
123-
{
124-
"addresses": [],
125-
"alias": "LATENTGLEE",
126-
"blockheight": 2003446,
127-
"color": "A27D",
128-
"network": "testnet",
129-
"node_id": "A27DtykCS7EjvnlUCB0yjrSMz4KSN4kGOo0Hm2Gd+lbi",
130-
"num_peers": 0,
131-
"version": "0.10.0"
132-
}
133-
```
134-
135-
In order to attach the `hsmd` to the node run the following:
136-
137-
```bash
138-
$ glcli hsmd
139-
[2021-06-07 18:38:02,574 - DEBUG] Found existing hsm_secret file, loading secret from it
140-
[2021-06-07 18:38:02,575 - DEBUG] Initializing libhsmd with secret
141-
[2021-06-07 18:38:02,583 - DEBUG] libhsmd initialized for node_id=036ec3b729024bb123be7954081d328eb48ccf82923789063a8d079b619dfa56e2
142-
[2021-06-07 18:38:02,584 - DEBUG] Contacting scheduler at 35.236.110.178:443 to wait for the node to be scheduled.
143-
[2021-06-07 18:38:02,594 - DEBUG] Waiting for node 036ec3b729024bb123be7954081d328eb48ccf82923789063a8d079b619dfa56e2 to be scheduled
144-
[2021-06-07 18:38:03,229 - INFO] Node was scheduled at https://35.236.110.178:6019, opening direct connection
145-
[2021-06-07 18:38:03,230 - DEBUG] Streaming HSM requests
53+
glcli --help
14654
```
55+
This command will display an overview of all available commands.
14756

148-
Not all commands require the `hsmd` to be running, however it is good
149-
practice to have it running in parallel with other commands being
150-
executed. Future versions of `glcli` will automatically spawn an
151-
instance if needed by the command in question.
57+
For additional details and usage examples, refer to `glcli` [README][glcli-doc].
15258

153-
From hereon the node can be managed just as if it were a local node,
154-
including sending and receiving on-chain transactions, sending and
155-
receiving off-chain transactions, opening and closing channels, etc.
156-
157-
```bash
158-
159-
glcli --help
160-
Usage: glcli [OPTIONS] COMMAND [ARGS]...
161-
162-
Options:
163-
--help Show this message and exit.
164-
165-
Commands:
166-
close
167-
connect
168-
destroy
169-
disconnect
170-
fundchannel
171-
getinfo
172-
hsmd Run the hsmd against the scheduler.
173-
invoice
174-
listfunds
175-
listpeers
176-
newaddr
177-
pay
178-
scheduler
179-
stop
180-
withdraw
181-
```
59+
[glcli-doc]: libs/gl-cli
18260

18361
# Best practices
18462

Taskfile.yml

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ includes:
99
taskfile: "libs/gl-client-py/.tasks.yml"
1010
dir: "libs/gl-client-py/"
1111

12+
testing:
13+
taskfile: "libs/gl-testing/.tasks.yml"
14+
dir: "libs/gl-testing/"
15+
1216
docker:
1317
taskfile: "docker/.tasks.yml"
1418
dir: "."
@@ -28,6 +32,7 @@ tasks:
2832
- ci-build
2933
cmds:
3034
- task: clientpy:check
35+
- task: testing:check
3136
- task: clnvm:check
3237

3338
docker-ci-check:

docker/gl-testing/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ ADD . /repo
215215
WORKDIR /repo
216216

217217
# Populate `uv` cache
218-
RUN uv sync --all-packages --extra dev
218+
RUN uv sync --all-packages --dev
219219

220220
# Populate CLN versions
221221
RUN uv run python3 -m clnvm --verbose get-all

0 commit comments

Comments
 (0)