Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 145 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lightning network development. It may be useful to you if you are:
* LND ✅
* CLN ✅
* Eclair ✅️
* LDK-node 🏗️
* LDK-server ✅

See our [tracking issue](https://github.com/bitcoin-dev-project/sim-ln/issues/26)
for updates on implementation support (contributions welcome!).
Expand All @@ -36,6 +36,7 @@ of the simulator uses keysend to execute payments, which must be enabled as foll
* LND: `--accept-keysend`
* CLN: enabled by default
* Eclair: `-Declair.features.keysend=optional` (or `--features.keysend=optional` if you're using Polar)
* LDK-server: enabled by default via `spontaneous_send`

NOTE: for CLN `keysend` to work with eclair, you need to add additional config to eclair:
```
Expand Down Expand Up @@ -98,6 +99,24 @@ The required access details will depend on the node implementation.
"api_password": <password_to_authorize>
}
```
* LDK-server:
```
{
"address": <ip:port or domain:port>,
"api_key": <hex_encoded_api_key>,
"cert": <path_to_tls_cert>,
"network": <bitcoin|testnet|signet|regtest>
}
```
The `api_key` is the raw bytes of `~/.ldk-server/<network>/api_key` hex-encoded.
Unlike other backends, ldk-server does not require an `id` field — the node's
public key is fetched automatically on startup.

Note: ldk-server channels are **unannounced by default**. Pass `--announce-channel`
to `open-channel` (and set `announcement_addresses` in the ldk-server config) to
make channels public and visible to other nodes for routing. Also ldk-server enforces a minimum final CLTV expiry delta
of **144 blocks** on inbound keysend payments. Ensure that sending nodes are configured with a sufficiently high final
CLTV delta.

Payment activity can be simulated in two different ways:
* [Random activity](#setup---random-activity): generate random activity on the `nodes` provided,
Expand Down Expand Up @@ -135,6 +154,12 @@ to send and receive payments when running with random activity.
"base_url": "127.0.0.1:8286",
"api_username": "",
"api_password": "eclairpw"
},
{
"address": "localhost:3536",
"api_key": "ldk_server_hex_encoded_api_key",
"cert": "/path/tls.crt",
"network": "signet"
}
]
}
Expand Down
8 changes: 5 additions & 3 deletions sim-cli/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use simln_lib::sim_node::{
SimGraph, SimNode, SimulatedChannel,
};
use simln_lib::{
cln, cln::ClnNode, eclair, eclair::EclairNode, lnd, lnd::LndNode, serializers,
ActivityDefinition, Amount, Interval, LightningError, LightningNode, NodeId, NodeInfo,
Simulation, SimulationCfg, WriteResults,
cln, cln::ClnNode, eclair, eclair::EclairNode, ldk, ldk::LdkNode, lnd, lnd::LndNode,
serializers, ActivityDefinition, Amount, Interval, LightningError, LightningNode, NodeId,
NodeInfo, Simulation, SimulationCfg, WriteResults,
};
use simln_lib::{ShortChannelID, SimulationError};
use std::collections::HashMap;
Expand Down Expand Up @@ -160,6 +160,7 @@ pub enum NodeConnection {
Lnd(lnd::LndConnection),
Cln(cln::ClnConnection),
Eclair(eclair::EclairConnection),
Ldk(ldk::LdkConnection),
}

/// Data structure that is used to parse information from the simulation file. It is used to
Expand Down Expand Up @@ -396,6 +397,7 @@ async fn get_clients(
NodeConnection::Lnd(c) => Arc::new(Mutex::new(LndNode::new(c).await?)),
NodeConnection::Cln(c) => Arc::new(Mutex::new(ClnNode::new(c).await?)),
NodeConnection::Eclair(c) => Arc::new(Mutex::new(EclairNode::new(c).await?)),
NodeConnection::Ldk(c) => Arc::new(Mutex::new(LdkNode::new(c).await?)),
};

let node_info = node.lock().await.get_info().clone();
Expand Down
1 change: 1 addition & 0 deletions simln-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rand_distr = "0.4.3"
rand_chacha = "0.3.1"
reqwest = { version = "0.12", features = ["json", "multipart"] }
tokio-util = { version = "0.7.13", features = ["rt"] }
ldk-server-client = { git = "https://github.com/lightningdevkit/ldk-server", rev = "570ed527535da0ec1dae431fac3ce46e5e6a468f" }

[dev-dependencies]
ntest = "0.9.0"
Expand Down
Loading
Loading