Skip to content

Conversation

@Abdulkbk
Copy link
Contributor

@Abdulkbk Abdulkbk commented Mar 18, 2025

Closes #829

Replaces #1038

Description

This PR integrates SimLn into Polar.

As mentioned in the previous PR implementing such:

SimLN is a simulation tool that can be used to generate realistic payment activity on any lightning network topology. It is intentionally environment-agnostic so that it can be used across many environments - from integration tests to public signets.

Polar provides a set of node configurations and payment activities (such as amount and frequency) to SimLN, which facilitates ongoing payments between the nodes.

Steps to Test

  1. Create a new network with 2 Lightning nodes. (LND, CLN, Eclair, or a mixture of 2)
  2. Start the network.
  3. Open a channel between the 2 nodes.
  4. Click on the "Simulation Designer" tab.
  5. Click the "Add a new Simulation" button.
  6. Select the source and destination nodes in the modal that appears.
  7. Click the "Create" button to add the simulation, and then Start.
  8. View the Docker logs for payment activities between the nodes.

Screenshots

Screenshot from 2025-03-18 01-24-25

Screenshot from 2025-03-18 01-25-08

Screenshot from 2025-03-18 01-25-29

Build the simln Image

cd docker/simln

docker build -t polarlightning/simln:0.2.5 --build-arg SIMLN_VERSION=0.2.5 .

Some parts of the code were taken from PR.

@codecov
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7a65b37) to head (ec07027).

Additional details and impacted files
@@            Coverage Diff             @@
##            master     #1159    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          156       160     +4     
  Lines         5713      5980   +267     
  Branches      1144      1212    +68     
==========================================
+ Hits          5713      5980   +267     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Abdulkbk Abdulkbk force-pushed the simln-support branch 4 times, most recently from 0f46f24 to 6ff46be Compare March 22, 2025 07:40
@Abdulkbk Abdulkbk marked this pull request as ready for review March 22, 2025 08:58
@Abdulkbk
Copy link
Contributor Author

Abdulkbk commented Mar 24, 2025

Tagging @kelvinator07 and @jamaljsr for reviews :)

@kelvinator07
Copy link
Contributor

Well Done @Abdulkbk I'll test the feature within the next couple of days and give feedback.

@Abdulkbk Abdulkbk force-pushed the simln-support branch 2 times, most recently from 3d84e75 to bfb199c Compare April 7, 2025 23:38
@Abdulkbk Abdulkbk force-pushed the simln-support branch 4 times, most recently from fa2dea5 to 95fce5a Compare May 13, 2025 10:03
@Abdulkbk
Copy link
Contributor Author

cc: @kelvinator07 👀

@Abdulkbk Abdulkbk force-pushed the simln-support branch 2 times, most recently from 08dae0c to cc84f1c Compare May 23, 2025 18:44
@Abdulkbk Abdulkbk changed the title 1/3: Add SimLn Support 1/2: Add SimLn Support May 25, 2025
@Abdulkbk Abdulkbk changed the title 1/2: Add SimLn Support SimLn Support in Polar Jun 24, 2025
@Abdulkbk Abdulkbk changed the title SimLn Support in Polar Feature: Simln integration in Polar Jun 24, 2025
@Abdulkbk Abdulkbk force-pushed the simln-support branch 2 times, most recently from b975944 to e2aee63 Compare June 25, 2025 12:05
@Abdulkbk
Copy link
Contributor Author

The project is now complete, and all LN implementations are now supported 💯

@Abdulkbk Abdulkbk force-pushed the simln-support branch 2 times, most recently from 92a52f9 to 147a294 Compare June 30, 2025 18:13
@jamaljsr
Copy link
Owner

Thanks for updating the Dockerfile. Apologies for the delay in approving this. Everything looks good when testing on my arm64 Mac but I also want to test on Linux, Windows, and x64 before merging this. I tried to do this today but ran into some OS issues on my other machine which I hope to resolve over the weekend. Just wanted to give you that update.

I also pushed the multi-platform docker image to Docker Hub as polarlightning/simln. Doing this made me realize we need to update the docker/README.md to include instructions for building the image. Can you please add a new section underneath Lightning Terminal for simln?

@Abdulkbk Abdulkbk force-pushed the simln-support branch 4 times, most recently from 412fab0 to 778fbe4 Compare September 29, 2025 20:41
Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this branch on Windows and ran into a problem. I still need to test on Linux.

Comment on lines 438 to 455
case 'LND':
const lnd = node as LndNode;
simNode = {
id: lnd.name,
macaroon: `/home/simln/.${lnd.paths.adminMacaroon.split('volumes/').pop()}`,
address: `https://host.docker.internal:${lnd.ports.grpc}`,
cert: `/home/simln/.${lnd.paths.tlsCert.split('volumes/').pop()}`,
};
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on Windows and am running into an issue with the simln container. I'm getting this error.

image

The problem is the difference in the file path strings on Windows. Here's the generated sim.json file:

{
  "nodes": [
    {
      "id": "alice",
      "macaroon": "/home/simln/.C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\data\\chain\\bitcoin\\regtest\\admin.macaroon",
      "address": "https://host.docker.internal:10001",
      "cert": "/home/simln/.C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\tls.cert"
    },
    {
      "id": "bob",
      "base_url": "http://host.docker.internal:8282",
      "api_username": "",
      "api_password": "eclairpw"
    },
    {
      "id": "carol",
      "macaroon": "/home/simln/.C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\carol\\data\\chain\\bitcoin\\regtest\\admin.macaroon",
      "address": "https://host.docker.internal:10003",
      "cert": "/home/simln/.C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\carol\\tls.cert"
    }
  ],
  "activity": [
    {
      "source": "alice",
      "destination": "bob",
      "interval_secs": 10,
      "amount_msat": 100000000
    },
    {
      "source": "alice",
      "destination": "carol",
      "interval_secs": 10,
      "amount_msat": 100000000
    }
  ]
}

And here's the contents of the LightningNode object in the network:

          {
            "id": 0,
            "networkId": 1,
            "name": "alice",
            "type": "lightning",
            "implementation": "LND",
            "version": "0.19.2-beta",
            "status": 1,
            "backendName": "backend1",
            "paths": {
              "tlsCert": "C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\tls.cert",
              "adminMacaroon": "C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\data\\chain\\bitcoin\\regtest\\admin.macaroon",
              "invoiceMacaroon": "C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\data\\chain\\bitcoin\\regtest\\invoice.macaroon",
              "readonlyMacaroon": "C:\\Users\\jamal\\.polar\\networks\\1\\volumes\\lnd\\alice\\data\\chain\\bitcoin\\regtest\\readonly.macaroon"
            },
            "ports": {
              "rest": 8081,
              "grpc": 10001,
              "p2p": 9735
            },
            "docker": {
              "image": "",
              "command": ""
            }
          },

Are you able to resolve this? If you don't have access to a Windows machine, you should be able to use mock data in a unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will use the mock data in unit test. Thanks.

In this commit, we split the DefaultDesigner component into Network
and Simulation tabs. We also added the default look for the
SimulationTab.
In this commit, we add simln and its related configurations to the
docker.
In this commit we extract status button logic into a component
so that we can reuse it in other places.
In the commit we add the sinln support to litd nodes.
@Abdulkbk
Copy link
Contributor Author

@jamaljsr, are you able to conclude the testing?

@jamaljsr
Copy link
Owner

jamaljsr commented Nov 4, 2025

Yes, I will test it again on Windows and Linux this week. Thanks for the updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: proposed integration of sim-ln in polar

3 participants