@@ -42,143 +42,21 @@ present at a time, freeing others from that duty.
42
42
43
43
# Getting started
44
44
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:
54
47
``` 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
57
49
```
58
50
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:
108
52
``` 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
146
54
```
55
+ This command will display an overview of all available commands.
147
56
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 ] .
152
58
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
182
60
183
61
# Best practices
184
62
0 commit comments