Building a Lightning App (Lapp) - Discussion

You have a syntax error in your code somewhere in invoice.js.

Hello Alko, I tried to find the syntax error in the invoice.js file by going trough the videos and comparing Filips code with mine, but I couldn’t find the bug. Could you help my and take a look on my code ? Thank you in advance for your help.
!

You’re missing a { for if block.

Hello Alko89, thank you for your response.
I compared my lines of code in the If block with Filips and there I could’t find a missing {.
Then I completely rewrote the code part in invoice.js by following Filips instructions step by step with the same end result like before (same error message).
Could it be possible that the error is some where else,
because the first time I tried it out (ca. a month ago) the Lightning invoice window appeared but since then it is always showing an error message?

Thank you in advance for your help.

You’re missing a { on line 18.

Thank you so much Alko89,
shame of me :blush: so embarrassing.

Hi guys,
Anyone knows why I got this error?

I’ve type in the code as is from github. I’ve also tried the code:
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)”

with the space before BTCPAY and have the URL correct and replace 
 with private key and 
 with paircode generated from filip’s sever both gave me the same error saying the BTCPAY_URL part is no good.

also if I run the following code:
node -e “const btcpay=require(‘btcpay’); new btcpay.BTCPayClient(’<BTCPAY_URL>’, btcpay.crypto.load_keypair(Buffer.from(’<BTCPAY_KEY>’, ‘hex’))).pair_client(’<BTCPAY_PAIRCODE>’).then(console.log).catch(console.error)”

i got the following error message:

I’m running the code on Powershell via administration access.

Hello,

I am getting the same confusing error about channel reserve and dust when trying to create a channel from the Zap wallet.

“you gave bad parameters, our dust limit 546sat would be above their reserve 500sat”

when I try to open a channel of 50000 sat to

035be98895c4d4e3b91fbb88d27af0fa68de6023e3a6eae675cc8332d29f299af4@18.209.171.172:9735

with a medium fee.

Apparently you can only open a channel of a 500sat limit, at least for that channel.

Carlos Z

Morning Carlos
If I try and open a channel of 500sat, I get an error saying that the minimum funding is 20000sat. :woozy_face:

1 Like

Try to open the channel with 25000 sats to 30000 sats, apparently the error shows if you are running a lightning node, which is not required for the course.

Carlos Z

1 Like

Problem solved!

As a separate exercise I was setting up my own Lightning node with Umbrel.

From the Lnd app in Umbrel, I tried opening a channel of 20000sats to Filip’s node and got the same error as above.

Then I tried opening a channel of 200,000sats and this time it was accepted.

Bluewallet on the iPhone is configured to go through my home Lightning node.

Now the payment works :smiley:

Hi, when I try this
node -e "const btcpay=require('btcpay'); new btcpay.BTCPayClient('https://lightning.filipmartinsson.com/', btcpay.crypto.load_keypair(Buffer.from('c8bf8ea63d75c97dab73132a8337f0a8a5e57d8d388174fb59e6b804d45ac6ee', 'hex'))).pair_client('mQN8cSt').then(console.log).catch(console.error)"

I got this error:


RequestError: Error: certificate has expired
    at new RequestError (C:\Users\lane\Desktop\practice\MORALIS\Lightning programming\lightning-app-boilerplate\node_modules\request-promise-core\lib\errors.js:14:15)
    at plumbing.callback (C:\Users\lane\Desktop\practice\MORALIS\Lightning programming\lightning-app-boilerplate\node_modules\request-promise-core\lib\plumbing.js:87:29)
    at Request.RP$callback [as _callback] (C:\Users\lane\Desktop\practice\MORALIS\Lightning programming\lightning-app-boilerplate\node_modules\request-promise-core\lib\plumbing.js:46:31)
    at self.callback (C:\Users\lane\Desktop\practice\MORALIS\Lightning programming\lightning-app-boilerplate\node_modules\request\request.js:185:22)
    at Request.emit (node:events:513:28)
    at Request.onRequestError (C:\Users\lane\Desktop\practice\MORALIS\Lightning programming\lightning-app-boilerplate\node_modules\request\request.js:881:8)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  cause: Error: certificate has expired
      at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
      at TLSSocket.emit (node:events:513:28)
      at TLSSocket._finishInit (node:_tls_wrap:959:8)
      at ssl.onhandshakedone (node:_tls_wrap:743:12) {
    code: 'CERT_HAS_EXPIRED'
  },
  error: Error: certificate has expired
      at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
      at TLSSocket.emit (node:events:513:28)
      at TLSSocket._finishInit (node:_tls_wrap:959:8)
      at ssl.onhandshakedone (node:_tls_wrap:743:12) {
    code: 'CERT_HAS_EXPIRED'
  },
  options: {
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
      'User-Agent': 'node-btcpay',
      'X-Accept-Version': '2.0.0'
    },
    json: true,
    method: 'POST',
    uri: 'https://lightning.filipmartinsson.com/tokens',
    body: {
      id: 'TexGHFVzPaMMAesAYiTiKwSjon12Rya6EXp',
      pairingCode: 'mQN8cSt'
    },
    callback: [Function: RP$callback],
    transform: undefined,
    simple: true,
    resolveWithFullResponse: false,
    transform2xxOnly: false
  },
  response: undefined
}

@Alko89 @thecil

Is this course dead or out to date?

Yes I get the same error, unfortunately the course was prepared so long ago and it seems the SSL certificate of the domain is not active anymore. I’ll try to go on without the practice.