Building a Lightning App (Lapp) - Discussion

Hi Filip, can you post the link for the Complete BTCPay Setup Tutorial as the official tutorial isn’t working for me?

What do you mean by complete? The guide in the readme is what I followed. They also link to a medium blog post where they set it up on a VPS. Which guide did you follow and what problems do you have? Maybe I can help you out.

Where did you find the documentation?

Here you can find a lot of info, including how to deploy a node yourself: https://docs.btcpayserver.org/

Thank you for the information

1 Like

Hi Filip,

I would like to run my own BTC Pay server. Could you provide the documentation to do so?

Thanks in advance.

Regards,
Andy

Here you can find a lot of info, including how to deploy a node yourself: https://docs.btcpayserver.org/

1 Like

Hi Filip,

Again apologise for the noob questions but I have my own lightning node connected to my own BTCpay page but can’t seem to get a connecting string like yours (Connection string: type=charge;server=https://api-token:6ba722c01e01846c671fed7a6909bbda8ebedf0b842fd75c9a82220132b34e60@lightning.filipmartinsson.com:443/lightning-charge/btc/).

How do I come by it?

Thanks in advance.

Did you set up a charge server in the server settings in BTC pay?

Log in in btcpay as admin -> Server Settings -> Services -> C-Lightning(Charge server). There you should find your connection string. What do you see?

Got it. It actually works now. Thanks again.

1 Like

I came to the conclusion that when you are on linux (ubuntu) you probably have to run some code lines as sudo.
For example the line:
node -p “require(‘btcpay’).crypto.generate_keypair()”
do:
sudo node -p “require(‘btcpay’).crypto.generate_keypair()”

1 Like

Hi,
maybe someone could help here. Try to generate the priv key with:
node -p “require(‘btcpay’).crypto.generate_keypair()”

But instead to get this form -> Key priv: XXXXXXX pub: null
There is:
priv: BN {
negative: 0,
words: [
12345678, 7608572,
1259989, 56237410,
27560116, 50195639,
62051757, 4919701,
50162600, 218754,
0
],
length: 10,
red: null
},
pub: null

Is there maybe also a different command for windows?

Thx in advance!

1 Like

It seems that it is outputting the key as a BigNumber type. It’s a javascript type that makes it easy to work with large numbers. In order to get it into a more readable format, you can use this command instead.

node -p "require('btcpay').crypto.generate_keypair().getPrivate().toString(16)"

This will first get the private key from the Keypair, then convert it into a string with the base 16 (hexadecimal).

2 Likes

Hi @filip unfortunately the next command to create the merchant key doesn’t work for me either.
Command:
node -e “const btcpay=require(‘btcpay’); new btcpay.BTCPayClient(‘https://lightning.filipmartinsson.com/’, btcpay.crypto.load_keypair(Buffer.from(’<BTCPAY_KEY>’, ‘hex’))).pair_client(’<BTCPAY_PAIRCODE>’).then(console.log).catch(console.error)”

Error:
C:\Users…\lightning-app-boilerplate\node_modules\elliptic\lib\elliptic\curve\short.js:416
return this.x.fromRed();
^
TypeError: Cannot read property ‘fromRed’ of null
at Point.getX (C:\Users…\lightning-app-boilerplate\node_modules\←[4melliptic←[24m\lib\elliptic\curve\short.js:416:17)

Thx for your support!

Try to update btcpay. Go into package.json and replace the version nr of btcpay from 0.2.2 to 0.2.4. Then run npm install again. Try that and let me know :slight_smile:

I had the same problem wit hthe Big Number format and adding .getPrivate().toString(16) worked, thanks!

Knut looks like you’re using the “backup” command from the video page, but try first with the one that is in the github page

 BTCPAY_URL=https://mydomain.com/ BTCPAY_KEY=... BTCPAY_PAIRCODE=... node -e "const btcpay=require('btcpay'); new btcpay.BTCPayClient(process.env.BTCPAY_URL, btcpay.crypto.load_keypair(Buffer.from(process.env.BTCPAY_KEY, 'hex'))).pair_client(process.env.BTCPAY_PAIRCODE).then(console.log).catch(console.error)"

don’t forget to replace the values for BTCPAY_URL, BTCPAY_KEY and BTCPAY_PAIRCODE. This one worked for me fine.

Hi @filip, updating btcpay has not worked yet.
SyntaxError: Invalid or unexpected token
←[90m at new Script (vm.js:84:7)←[39m
←[90m at createScript (vm.js:258:10)←[39m
←[90m at Object.runInThisContext (vm.js:306:10)←[39m
at Object. ([eval]-wrapper:9:26)
←[90m at Module._compile (internal/modules/cjs/loader.js:959:30)←[39m
←[90m at evalScript (internal/process/execution.js:80:25)←[39m
←[90m at internal/main/eval_string.js:23:3←[39m

Hi @samgamgee321, thx but already tried all kinds of commands. I’ll let you know when I find figure it out :smiley:

When do you get this error? That’s not the same error as last time.