jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing
https://lightningpolar.com
MIT License
773 stars 145 forks source link

Feature Request: Locking Nodes #470

Open michaelWuensch opened 3 years ago

michaelWuensch commented 3 years ago

Is your feature request related to a problem? Please describe. The new lnd v0.13.0 version changed a lot in regards to unlocking nodes. I would like to be able to test if unlocking in my application works by locking those nodes in Polar

Describe the solution you'd like Ideally if a node was selected in the graph, in the details panel there could be a button "lock/unlock". To avoid password hazzle a standard password that is always "polar" could be used, as this is solely for testing purposes anyway.

If this can already be acheived with Polar, then a short answer on how to do this would also be sufficient.

jamaljsr commented 3 years ago

Hey @michaelWuensch, this is a good idea. However, "locking" of the LND node isn't possible as there isn't an RPC available to lock the node (see WalletUnlocker.proto). Unlocking the wallet would be possible but I think it may make sense to handle that in the app you're building, no?

michaelWuensch commented 3 years ago

@jamaljsr Unlocking the wallet is indeed handled by the app I am building. And that is exactly what I want to test. I want to see, if the unlocking handling is still working in my app. But for now wallets in polar are never locked, therefore I cannot test it with polar. It is true, that there is no RPC to lock a wallet. But is it maybe possible to start a node in polar in a locked way?

jamaljsr commented 3 years ago

Ah yes, it is possible to startup the nodes in a locked state. Before starting the network, right-click on the v0.13 node, go to Advanced Options, click on the Pre-fill Default Command icon, then remove --noseedbackup from the command. Now when the node starts, it will remain locked.

The only drawback to this is if the node isn't unlocked within 2 minutes, Polar will mark it as failed to startup. You can still continue using the node from your app but you wont be able to interact with it from the Polar UI.

michaelWuensch commented 3 years ago

Okay thanks, that should work if I can setup that node. How can I run the terminal on that node though? When I remove --noseedbackup I cannot hit the Launch Terminal Button, as the node never went online. If I can run the terminal, I should be able to do the rest. My app does not support setting up the node, thats why I have to do that within polar/terminal.

jamaljsr commented 3 years ago

Oh right. Polar won't show you the option to open a Terminal if it thinks the node hasn't started properly. You could bypass Polar in this instance and connect directly to the docker container using a command such as:

docker-compose -f ~/.polar/networks/1/docker-compose.yml exec alice bash

The path of the compose file assumes you only have one network defined in Polar. If you have multiple, you'll need to change the 1 to a 2 or 3 based on the order that they were created. Also change alice to the name of node you want to connect to.