Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with starting with CLN v23.02.2 on RPi #6

Open
openoms opened this issue May 5, 2023 · 9 comments
Open

Help with starting with CLN v23.02.2 on RPi #6

openoms opened this issue May 5, 2023 · 9 comments

Comments

@openoms
Copy link

openoms commented May 5, 2023

Hi Joelklabo, great project!

Tried to run on a Raspiblitz with CLN v23.02.2

Steps taken:

sudo su - bitcoin
cd /home/bitcoin/cl-plugins-available/
git clone https://github.com/joelklabo/nostr-control
# filled in the config.json
chmod +x /home/bitcoin/cl-plugins-available/nostr-control/nostr-control.js
lightning-cli plugin start /home/bitcoin/cl-plugins-available/nostr-control/nostr-control.js

# same when using in the config file:
plugin=/home/bitcoin/cl-plugins-available/nostr-control/nostr-control.js

Results in:

{
   "code": -3,
   "message": "/home/bitcoin/cl-plugins-available/nostr-control/nostr-control.js: exited before replying to getmanifest"
}

and in sudo journalctl -fu lightning

May 05 16:13:40 raspberrypi systemd[1]: Started c-lightning daemon on mainnet.
May 05 16:13:48 raspberrypi sh[2021513]: <--- Last few GCs --->
May 05 16:13:48 raspberrypi sh[2021513]: <--- JS stacktrace --->
May 05 16:13:48 raspberrypi sh[2021513]: #
May 05 16:13:48 raspberrypi sh[2021513]: # Fatal javascript OOM in MemoryChunk allocation failed during deserialization.
May 05 16:13:48 raspberrypi sh[2021513]: #

Are there steps I am missing?
I presume dependencies would need to be installed, but npm install does not work as noted in the readme.

@joelklabo
Copy link
Owner

Hey @openoms! Let me go through the process again and see what I'm missing.

@joelklabo
Copy link
Owner

@openoms do you have node installed? I just ran into the same thing on a new VM but realized node wasn't installed. Could that be it?

@openoms
Copy link
Author

openoms commented May 8, 2023

@openoms do you have node installed? I just ran into the same thing on a new VM but realized node wasn't installed. Could that be it?

Checked that one first. Node and npm are installed system-wide:

bitcoin@raspberrypi:~/cl-plugins-available/nostr-control $ node --version
v18.12.0
$ which node
/usr/bin/node
$ npm --version
8.19.2
$ which npm
/usr/bin/npm

How about the cl conf settings?
Mine are:

alias=xxxx
base=0
fee-per-satoshi=xx
min-capacity-sat=500000

network=bitcoin
log-file=cl.log
log-level=info
plugin-dir=/home/bitcoin/cl-plugins-enabled

# Tor settings
proxy=127.0.0.1:9050
bind-addr=127.0.0.1:9736
addr=statictor:127.0.0.1:9051/torport=9736

always-use-proxy=true
bind-addr=0.0.0.0:9735

rpc-file-mode=0660

feeadjuster-imbalance=xx
feeadjuster-threshold=xx
feeadjuster-threshold-abs=xx
feeadjuster-enough-liquidity=xxxx
feeadjuster-adjustment-method=hard

grpc-port=4772

@joelklabo
Copy link
Owner

Yeah, that all seems correct. The plugin actually gets it's settings from config.json in it's directory so I can updated them while the plugin in running. But you mentioned that you had filled that in. Mind sharing what that looks like? (with redacted keys)

Also, if it made any progress in launching there should be a debug.log in that directory that might have some information in it.

Could you confirm what commit your working from also just to make sure?

I need to add some versioning and some more logging it sounds like. I should probably also redirect the logging to the main cln log as well. It was helpful to have my own for development but probably not for your situation.

@joelklabo
Copy link
Owner

@openoms let me know if I can help debug this anymore. I'd be really excited to see it available on raspiblitz!

@openoms
Copy link
Author

openoms commented May 12, 2023

Had played around trying different config settings eg tried eith and without wss:// in the relay address, but coming to the same.
My redacted config:

{
  relay: "nostr.zebedee.cloud",
  bot_secret: "hex-priv-key",
  your_pubkey: "hex-pub-key",
  verbosity: "verbose",
  show_failed_forwards: true
}

@joelklabo
Copy link
Owner

I've recently added a bunch more logging, might find some clues if you update to master. All the dependencies are checked in in node_modules/. Could you have run npm install I think you said not but just double checking.

@frbitten
Copy link

frbitten commented Aug 27, 2023

I'm having exactly the same problem. I didn't run "npm install" and I have the latest master version. The debug.log file was not generated.

Aug 27 00:52:43 freedom-server systemd[1]: Starting C-Lightning daemon... Aug 27 00:52:43 freedom-server lightningd[2833861]: <--- Last few GCs ---> Aug 27 00:52:43 freedom-server lightningd[2833861]: <--- JS stacktrace ---> Aug 27 00:52:43 freedom-server lightningd[2833861]: # Aug 27 00:52:43 freedom-server lightningd[2833861]: # Fatal javascript OOM in MemoryChunk allocation failed during deserialization. Aug 27 00:52:43 freedom-server lightningd[2833861]: # Aug 27 00:53:56 freedom-server systemd[1]: Started C-Lightning daemon.

If I try to run it manually I get this error:

            throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
                  ^
Error: private key must be 32 bytes, hex or bigint, not string
    at Object.normPrivateKeyToScalar (file:///hdd/cln/.lightning/plugins/nostr-control/node_modules/@noble/curves/esm/abstract/weierstrass.js:158:19)
    at schnorrGetExtPubKey (file:///hdd/cln/.lightning/plugins/nostr-control/node_modules/@noble/curves/esm/secp256k1.js:110:30)
    at Object.schnorrGetPublicKey [as getPublicKey] (file:///hdd/cln/.lightning/plugins/nostr-control/node_modules/@noble/curves/esm/secp256k1.js:141:12)
    at getPublicKey (file:///hdd/cln/.lightning/plugins/nostr-control/node_modules/nostr-tools/lib/esm/nostr.mjs:14:29)
    at new NostrDMBot (file:///hdd/cln/.lightning/plugins/nostr-control/node_modules/nostr-dm-bot/nostr-dm-bot.js:11:21)
    at file:///hdd/cln/.lightning/plugins/nostr-control/nostr-control.js:53:13
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:541:24)
    at async loadESM (node:internal/process/esm_loader:91:5)

Node.js v18.7.0

use key in standard nostr format starting with nsec

@frbitten
Copy link

frbitten commented Aug 27, 2023

I used https://nostrtool.com/ to convert to HEX format and it worked when calling nostr-control from the command line.
But when starting the CLN it continues with the first reported error.

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

No branches or pull requests

3 participants