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,27 +127,29 @@ 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 and amount for payments that you'd like
140
- to execute. Note that ` source ` nodes * must* be contained in ` nodes ` ,
141
- but destination nodes can be any public node in the network (though
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
142
153
this may result in liquidity draining over time).
143
154
144
155
Required fields:
@@ -166,6 +177,7 @@ The example simulation file below sets up the following simulation:
166
177
* Dispatch 140000 msat payments from ` Bob ` to ` Alice ` every 50 seconds.
167
178
* Dispatch 1000 msat payments from ` Bob ` to ` Dave ` every 2 seconds.
168
179
* Dispatch 10 payments (5000 msat each) from ` Erin ` to ` Frank ` at 2 second intervals, starting 20 seconds into the sim.
180
+
169
181
```
170
182
{
171
183
"nodes": [
@@ -200,7 +212,8 @@ The example simulation file below sets up the following simulation:
200
212
"source": "Alice",
201
213
"destination": "02d804ad31429c8cc29e20ec43b4129553eb97623801e534ab5a66cdcd2149dbed",
202
214
"interval_secs": 1,
203
- "amount_msat": 2000
215
+ "amount_msat": 2000,
216
+ "activity_name": "Daily Contribution"
204
217
},
205
218
{
206
219
"source": "0230a16a05c5ca120136b3a770a2adfdad88a68d526e63448a9eef88bddd6a30d8",
@@ -228,10 +241,10 @@ The example simulation file below sets up the following simulation:
228
241
229
242
** Note that node addresses must be declare with HTTPS transport, i.e < https://ip-or-domain > **
230
243
231
- Nodes can be identified by their public key or an id string (as
232
- described above). Activity sources and destinations may reference the
233
- ` id ` defined in ` nodes ` , but destinations that are not listed in ` nodes `
234
- * must * provide a valid public key.
244
+ Nodes can be identified by their public key or an id string (as
245
+ described above). Activity sources and destinations may reference the
246
+ ` id ` defined in ` nodes ` , but destinations that are not listed in ` nodes `
247
+ _ must _ provide a valid public key.
235
248
236
249
### Simulation Output
237
250
@@ -242,10 +255,12 @@ Run `sim-cli -h` for details on data directory (`--data-dir`) and other options
242
255
which affect how simulation outputs are persisted
243
256
244
257
## Lightning Environments
258
+
245
259
If you're looking to get started with local lightning development, we
246
- recommend [ polar] ( https://lightningpolar.com/ ) . For larger deployments,
247
- see the [ Scaling Lightning] ( https://github.com/scaling-lightning/scaling-lightning )
260
+ recommend [ polar] ( https://lightningpolar.com/ ) . For larger deployments,
261
+ see the [ Scaling Lightning] ( https://github.com/scaling-lightning/scaling-lightning )
248
262
project.
249
263
250
264
## Docker
265
+
251
266
If you want to run the cli in a containerized environment, see the docker set up docs [ here] ( ./docker/README.md )
0 commit comments