polar
polar copied to clipboard
Bug: Update instructions to create CLN custom node
Describe the bug
I am trying to create a custom CLN node with version 24.02.1 to try dual-funded channels.
The instructions here - https://github.com/jamaljsr/polar/blob/master/docs/custom-nodes.md#c-lightning - seem to be out of date.
I would like to help update those.
To Reproduce
Following the above instructions with the Dockerfile listed gives us an error, where it appears to fail fetching some packages:
#13 1.543 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-arm64/Packages 404 Not Found [IP: 151.101.66.132 80] ... etc
So, I modified the Dockerfile, using the file on the main CLN repo, and modifying the end of the file.
I used this Docker file - https://github.com/toneloc/stable-channels/blob/main/Dockerfile - I annotate the end of it (see "Polar Modification"). I used the same docker-entrypoint.sh file as in the above instructions.
This image appeared to build okay.
I then created a custom image on the Polar UI. I added the flag --developer to startup commands. Note: the new Dockerfile from CLN team did not have the ARG DEVELOPER=0 parameter in there. This is why I added the flag here instead.
Then, I tried to start up a 1 BTC core / 1 custom CLN network.
I got this error:
Unable to connect to c-lightning node
ENOENT: no such file or directory, open '/Users/t/.polar/networks/6/volumes/c-lightning/alice/rest-api/access.macaroon'
Where do these get created and copied?
Expected behavior
I would expect the custom node to start okay.
Screenshots
Desktop (please complete the following information):
- I am on Mac Ventura 13.5.
- Polar version 2.1.0.
- Docker Desktop version 4.18.0
- Docker Engine version 20.10.24
Additional context
I would like to use dual-funded channels, which is on this version.
I would also like to include a custom plugin to try out. This is the plugin I want to try - https://github.com/toneloc/stable-channels
Thanks.
Hey @toneloc, thanks for all of the details.
The instructions here - https://github.com/jamaljsr/polar/blob/master/docs/custom-nodes.md#c-lightning - seem to be out of date.
Yes, the exact Dockerfile is outdated. There's a note at the top of the doc that states "Note: The Dockerfiles for each implementation will likely change in the future. Please be mindful to make updates as needed when necessary." It would be too much work to keep this doc update to date with all of the implementation's releases. It's meant just to be a guide to point you in the right direction. You can check the Dockerfiles in the docker/c-lightning dir to see the exact files we use to build the images for Polar. Unfortunately, the c-lightning file is also a bit outdated due to some trouble I ran into in recent releases. See https://github.com/jamaljsr/polar/pull/774.
I got this error:
Unable to connect to c-lightning node ENOENT: no such file or directory, open '/Users/t/.polar/networks/6/volumes/c-lightning/alice/rest-api/access.macaroon'
This seems like the access.macaroon file isn't being created by the c-lightning-REST plugin. Can you check the node's logs to see if the plugin is starting up correctly?
A few observations:
- I think that CLN Rest is using the term / concept of "runes" instead of "macaroons" for authentication now. https://docs.corelightning.org/docs/rest#configuration
- Still with that same access.macaroon error for now.
Here are Docker startup commands I am using:
lightningd
--alias={{name}}
--addr={{name}}
--addr=0.0.0.0:9735
--network=regtest
--bitcoin-rpcuser={{rpcUser}}
--bitcoin-rpcpassword={{rpcPass}}
--bitcoin-rpcconnect={{backendName}}
--bitcoin-rpcport=18443
--log-level=debug
--dev-bitcoind-poll=2
--dev-fast-gossip
--grpc-port=11001
--log-file=-
--log-file=/home/clightning/.lightning/debug.log
--clnrest-port=8080
--clnrest-protocol=http
--developer
Polar doesn't currently support the new REST APi included in CLN. It still requires the c-lightning-REST plugin. You would need to install this plugin in your Docker like Polar does here. Also, you'd have to keep these flags in your startup command.
Got it. For this line: --plugin=/opt/c-lightning-rest/plugin.js looks like plugin.js is renamed clrest.js in updated library.
So I put --plugin=/opt/c-lightning-rest/clrest.js
Also had to add --developer flag.
Then got this message as well bitcoin-cli exited with code 255: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
I am building docker image on Mac M2. I saw something about needing to specify the Linux build platform and tried that, but no luck anyway. Hope this helps.
Got it. For this line:
--plugin=/opt/c-lightning-rest/plugin.jslooks like plugin.js is renamedclrest.jsin updated library.So I put
--plugin=/opt/c-lightning-rest/clrest.js
Yes, I ran into that issue also. We chose to rename the file after installing the plugin to avoid breaking backwards compatibility with older nodes in Polar.
Then got this message as well
bitcoin-cli exited with code 255: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
In Polar we use separate Dockerfiles for x64 and arm64 builds. You can find them in the c-lightning dir. The commands we use to build them and the the docker/README.md file if you want to use them as a reference.