1
1
# SimLN
2
2
3
- SimLN is a simulation tool that can be used to generate realistic
4
- payment activity on any lightning network topology. It is intentionally
5
- environment-agnostic so that it can be used across many environments -
6
- from integration tests to public signets.
3
+ SimLN is a simulation tool that can be used to generate realistic
4
+ payment activity on any lightning network topology. It is intentionally
5
+ environment-agnostic so that it can be used across many environments -
6
+ from integration tests to public signets.
7
7
8
- This tool is intended to serve developers who are familiar with
8
+ This tool is intended to serve developers who are familiar with
9
9
lightning network development. It may be useful to you if you are:
10
- * A protocol developer looking to test proposals.
11
- * An application developer load-testing your application.
12
- * A signet operator interested in a hands-off way to run an active node.
13
- * A researcher generating synthetic data for a target topology.
10
+
11
+ - A protocol developer looking to test proposals.
12
+ - An application developer load-testing your application.
13
+ - A signet operator interested in a hands-off way to run an active node.
14
+ - A researcher generating synthetic data for a target topology.
14
15
15
16
## Pre-Requisites
16
- SimLN requires you to "bring your own network" to generate activity
17
+
18
+ SimLN requires you to "bring your own network" to generate activity
17
19
on. You will need:
18
- * A [ lightning network] ( #lightning-environments ) connected with any
20
+
21
+ - A [ lightning network] ( #lightning-environments ) connected with any
19
22
topology of channels.
20
- * Access to execute commands on _ at least_ one node in the network.
21
- * Rust compiler [ installed] ( https://www.rust-lang.org/tools/install ) .
23
+ - Access to execute commands on _ at least_ one node in the network.
24
+ - Rust compiler [ installed] ( https://www.rust-lang.org/tools/install ) .
22
25
23
26
## LN Implementation Support
24
- * LND ✅
25
- * CLN ✅
26
- * Eclair 🏗️
27
- * LDK-node 🏗️
27
+
28
+ - LND ✅
29
+ - CLN ✅
30
+ - Eclair 🏗️
31
+ - LDK-node 🏗️
28
32
29
33
See our [ tracking issue] ( https://github.com/bitcoin-dev-project/sim-ln/issues/26 )
30
34
for updates on implementation support (contributions welcome!).
31
35
32
36
## Getting Started
33
- Clone the repo:
37
+
38
+ Clone the repo:
39
+
34
40
```
35
41
git clone https://github.com/bitcoin-dev-project/sim-ln
36
42
cd sim-ln
37
43
```
38
44
39
- Install the CLI:
45
+ Install the CLI:
46
+
40
47
```
41
48
cargo install --locked --path sim-cli/
42
49
```
@@ -52,9 +59,10 @@ Run `sim-cli -h` for details on `--data-dir` and `--sim-file` options that allow
52
59
Interested in contributing to the project? See [ CONTRIBUTING] ( CONTRIBUTING.md ) for more details.
53
60
54
61
### Simulation File Setup
55
- The simulator requires access details for a set of ` nodes ` that you
56
- have permission to execute commands on. Note that the current version
57
- of the simulator uses keysend to execute payments, which must be
62
+
63
+ The simulator requires access details for a set of ` nodes ` that you
64
+ have permission to execute commands on. Note that the current version
65
+ of the simulator uses keysend to execute payments, which must be
58
66
enabled in LND using ` --accept-keysend ` (for CLN node it is enabled by default).
59
67
60
68
The required access details will depend on the node implementation. For LND, the following
@@ -72,7 +80,7 @@ information is required:
72
80
Whereas for CLN nodes, the following information is required:
73
81
74
82
```
75
- {
83
+ {
76
84
"id": <node_id>,
77
85
"address": https://<ip:port or domain:port>,
78
86
"ca_cert": <path_to_ca_cert>,
@@ -84,17 +92,18 @@ Whereas for CLN nodes, the following information is required:
84
92
** Note that node addresses must be declare with HTTPS transport, i.e. < https://ip-or-domain:port > **
85
93
86
94
Payment activity can be simulated in two different ways:
87
- * Random activity: generate random activity on the ` nodes ` provided,
95
+
96
+ - Random activity: generate random activity on the ` nodes ` provided,
88
97
using the graph topology to determine payment frequency and size.
89
- * Defined activity: provide descriptions of specific payments that
98
+ - Defined activity: provide descriptions of specific payments that
90
99
you would like the generator to execute.
91
100
92
101
### Setup - Random Activity
93
102
94
- To run the simulator with random activity generation, you just need to
95
- provide a set of nodes and the simulator will generate activity based
96
- on the topology of the underlying graph. Note that payments will only
97
- be sent between the ` nodes ` that are provided so that liquidity does
103
+ To run the simulator with random activity generation, you just need to
104
+ provide a set of nodes and the simulator will generate activity based
105
+ on the topology of the underlying graph. Note that payments will only
106
+ be sent between the ` nodes ` that are provided so that liquidity does
98
107
not "drain" from the simulation.
99
108
100
109
```
@@ -106,7 +115,7 @@ not "drain" from the simulation.
106
115
"macaroon": "/path/admin.macaroon",
107
116
"cert": "/path/tls.cert"
108
117
},
109
- {
118
+ {
110
119
"id": "0230a16a05c5ca120136b3a770a2adfdad88a68d526e63448a9eef88bddd6a30d8",
111
120
"address": "https://localhost:10013",
112
121
"ca_cert": "/path/ca.pem",
@@ -118,31 +127,32 @@ not "drain" from the simulation.
118
127
```
119
128
120
129
Nodes can be identified by an arbitrary string ("Alice", "CLN1", etc) or
121
- by their node public key. If a valid public key is provided it * must *
130
+ by their node public key. If a valid public key is provided it _ must _
122
131
match the public key reported by the node.
123
132
124
- There are a few cli flags that can be used to toggle the characteristics
125
- of the random activity that is generated:
126
- * ` --expected-payment-amount ` : the approximate average amount that
133
+ There are a few cli flags that can be used to toggle the characteristics
134
+ of the random activity that is generated:
135
+
136
+ - ` --expected-payment-amount ` : the approximate average amount that
127
137
will be sent by nodes, randomness will be introduced such that larger
128
138
nodes send a wider variety of payment sizes around this expectation.
129
- * ` --capacity-multiplier ` : the number of times over that each node in
139
+ - ` --capacity-multiplier ` : the number of times over that each node in
130
140
the network sends their capacity in a calendar month, for example:
131
- * ` capacity-multiplier=2 ` means that each node sends double their
132
- capacity in a month.
133
- * ` capacity-multiplier=0.5 ` means that each node sends half their
141
+ - ` capacity-multiplier=2 ` means that each node sends double their
142
+ capacity in a month.
143
+ - ` capacity-multiplier=0.5 ` means that each node sends half their
134
144
capacity in a month.
135
145
136
146
### Setup - Defined Activity
137
- If you would like SimLN to generate a specific payments between source
138
- and destination nodes, you can provide ` activity ` descriptions of the
139
- source, destination, frequency, amount for payments that you'd like
140
- to execute and an optional name for each ` activity ` description that is used
141
- as the logging prefix to relate logs to their corresponding activity description
142
- (The index of each ` activity ` description will be used if a name is not
143
- provided for the ` activity ` description ). Note that ` source ` nodes * must * be contained in ` nodes ` ,
144
- but destination nodes can be any public node in the network (though
145
- this may result in liquidity draining over time ).
147
+
148
+ If you would like SimLN to generate a specific payments between source
149
+ and destination nodes, you can provide ` activity ` descriptions of the
150
+ source, destination, frequency and amount for payments that you'd like
151
+ to execute. Note that ` source ` nodes _ must _ be contained in ` nodes ` ,
152
+ but destination nodes can be any public node in the network (though
153
+ this may result in liquidity draining over time ). You can also add an optional name for each ` activity ` description that is
154
+ used as the logging prefix to relate logs to their corresponding activity
155
+ description (The index of each ` activity ` description will be used if a name is not provided for the ` activity ` description ).
146
156
147
157
Required fields:
148
158
```
@@ -169,6 +179,13 @@ The example simulation file below sets up the following simulation:
169
179
* Dispatch 140000 msat payments from ` Bob ` to ` Alice ` every 50 seconds.
170
180
* Dispatch 1000 msat payments from ` Bob ` to ` Dave ` every 2 seconds.
171
181
* Dispatch 10 payments (5000 msat each) from ` Erin ` to ` Frank ` at 2 second intervals, starting 20 seconds into the sim.
182
+
183
+ - Connect to ` Alice ` running LND to generate activity.
184
+ - Connect to ` Bob ` running CLN to generate activity.
185
+ - Dispatch 2000 msat payments from ` Alice ` to ` Carol ` every 1 seconds.
186
+ - Dispatch 140000 msat payments from ` Bob ` to ` Alice ` every 50 seconds.
187
+ - Dispatch 1000 msat payments from ` Bob ` to ` Dave ` every 2 seconds.
188
+
172
189
```
173
190
{
174
191
"nodes": [
@@ -232,10 +249,10 @@ The example simulation file below sets up the following simulation:
232
249
233
250
** Note that node addresses must be declare with HTTPS transport, i.e < https://ip-or-domain > **
234
251
235
- Nodes can be identified by their public key or an id string (as
236
- described above). Activity sources and destinations may reference the
237
- ` id ` defined in ` nodes ` , but destinations that are not listed in ` nodes `
238
- * must * provide a valid public key.
252
+ Nodes can be identified by their public key or an id string (as
253
+ described above). Activity sources and destinations may reference the
254
+ ` id ` defined in ` nodes ` , but destinations that are not listed in ` nodes `
255
+ _ must _ provide a valid public key.
239
256
240
257
### Simulation Output
241
258
@@ -246,10 +263,12 @@ Run `sim-cli -h` for details on data directory (`--data-dir`) and other options
246
263
which affect how simulation outputs are persisted
247
264
248
265
## Lightning Environments
266
+
249
267
If you're looking to get started with local lightning development, we
250
- recommend [ polar] ( https://lightningpolar.com/ ) . For larger deployments,
251
- see the [ Scaling Lightning] ( https://github.com/scaling-lightning/scaling-lightning )
268
+ recommend [ polar] ( https://lightningpolar.com/ ) . For larger deployments,
269
+ see the [ Scaling Lightning] ( https://github.com/scaling-lightning/scaling-lightning )
252
270
project.
253
271
254
272
## Docker
273
+
255
274
If you want to run the cli in a containerized environment, see the docker set up docs [ here] ( ./docker/README.md )
0 commit comments