@@ -270,6 +270,106 @@ project.
270
270
## Docker
271
271
If you want to run the cli in a containerized environment, see the docker set up docs [ here] ( ./docker/README.md )
272
272
273
+ ## Advanced Usage - Network Simulation
274
+
275
+ If you are looking to simulate payments are large lightning networks
276
+ without the resource consumption of setting up a large cluster of nodes,
277
+ you may be interested in dispatching payments on a simulated network.
278
+
279
+ To run on a simulated network, you will need to provide the desired
280
+ topology and channel policies for each edge in the graph. The nodes in
281
+ the network will be inferred from the edges provided. Simulation of
282
+ payments on both a mocked and real lightning network is not supported,
283
+ so the ` sim_network ` field is mutually exclusive with the ` nodes ` section
284
+ described above.
285
+
286
+ The example that follows will execute random payments on a network
287
+ consisting of three nodes and two channels. You may specify defined
288
+ activity to execute on the mocked network, though you must refer to
289
+ nodes by their pubkey (aliases are not yet supported).
290
+
291
+ ```
292
+ {
293
+ "sim_network": [
294
+ {
295
+ "scid": 1,
296
+ "capacity_msat": 250000,
297
+ "node_1": {
298
+ "pubkey": "0344f37d544896dcc95a08ddd9bdfc2b756bf3f91b3f65bce588bd9d0228c24977",
299
+ "max_htlc_count": 483,
300
+ "max_in_flight_msat": 250000,
301
+ "min_htlc_size_msat": 1,
302
+ "max_htlc_size_msat": 100000,
303
+ "cltv_expiry_delta": 40,
304
+ "base_fee": 1000,
305
+ "fee_rate_prop": 100
306
+ },
307
+ "node_2": {
308
+ "pubkey": "020a30431ce58843eedf8051214dbfadb65b107cc598b8277f14bb9b33c9cd026f",
309
+ "max_htlc_count": 15,
310
+ "max_in_flight_msat": 100000,
311
+ "min_htlc_size_msat": 1,
312
+ "max_htlc_size_msat": 50000,
313
+ "cltv_expiry_delta": 80,
314
+ "base_fee": 2000,
315
+ "fee_rate_prop": 500
316
+ }
317
+ },
318
+ {
319
+ "scid": 2,
320
+ "capacity_msat": 100000,
321
+ "node_1": {
322
+ "pubkey": "020a30431ce58843eedf8051214dbfadb65b107cc598b8277f14bb9b33c9cd026f",
323
+ "max_htlc_count": 200,
324
+ "max_in_flight_msat": 100000,
325
+ "min_htlc_size_msat": 1,
326
+ "max_htlc_size_msat": 25000,
327
+ "cltv_expiry_delta": 40,
328
+ "base_fee": 1750,
329
+ "fee_rate_prop": 100
330
+ },
331
+ "node_2": {
332
+ "pubkey": "035c0b392725bb7298d56bf1bcb23634fc509d86a39a8141d435f9d4d6cd4b12eb",
333
+ "max_htlc_count": 15,
334
+ "max_in_flight_msat": 50000,
335
+ "min_htlc_size_msat": 1,
336
+ "max_htlc_size_msat": 50000,
337
+ "cltv_expiry_delta": 80,
338
+ "base_fee": 3000,
339
+ "fee_rate_prop": 5
340
+ }
341
+ }
342
+ ]
343
+ }
344
+ ```
345
+
346
+ Note that you need to provide forwarding policies in each direction,
347
+ because each participant in the channel sets their own forwarding
348
+ policy and restrictions on their counterparty.
349
+
350
+ ### Inclusions and Limitations
351
+
352
+ The simulator will execute payments on the mocked out network as it
353
+ would for a network of real nodes. See the inclusions and exclusions
354
+ listed below for a description of the functionality covered by the
355
+ simulated network.
356
+
357
+ Included:
358
+ * Routing Policy Enforcement: mocked channels enforce fee and CLTV
359
+ requirements.
360
+ * Channel restrictions: mocked channels abide by the in-flight
361
+ count and value limitations set on channel creation.
362
+ * Liquidity checks: HTLCs are only forwarded if the node has sufficient
363
+ liquidity in the mocked channel.
364
+
365
+ Not included:
366
+ * Channel reserve: the required minimum reserve balance is not
367
+ subtracted from a node's available balance.
368
+ * On chain fees: the simulation does not subtract on chain fees from
369
+ available liquidity.
370
+ * Dust limits: the simulation node not account for restrictions on dust
371
+ HTLCs.
372
+
273
373
## Developers
274
374
275
375
* [ Developer documentation] ( docs/DEVELOPER.md )
0 commit comments