Building a Lightning App (Lapp) - Discussion

but I would still need to wait ~30 mins for the channel to open the very first time right ? or is there some faster way of joining an existing channel for the first time?

No you have to wait for the transaction on chain to settle before you can start using the channel.

but that first transaction (before channel can be used) still takes ~30 mins. Isn’t this still going to lead to bottlenecks in terms of lightning usage ? or is there a faster way? for instance how would this work for buying a coffee at starbucks ?

No because you just have to open the channel once and then you can use it indefinitely. There is no faster way because you have to wait for the tx on chain to finish.

so basically the lightning network at a maximum reduces multiple on chain transactions down to a minimum of one at any point of sale?

Once you have a channel open you can make unlimited amount of txs.

there is still the bottleneck of the initial funding though

You can’t get around that because you have to move the funds from the main chain first.

Hi Team,

I’m trying to configure the connection to the BTC Pay Server with the following string (as specified in the notes of the lecture) type=clightning;server=unix://etc/clightning_bitcoin/lightning-rpc
And I’m getting the following error:
image
Any ideas why this error is and how to fix it?

Thanks!

Hey @Mariano_Collarte , have you tried using the internal node? The connection is basically a socket to the internal node so it should work as well. Not sure why BtcPay has to break this with every minor update. :smile:

Hi Ales!

Thanks for the quick response!
Yes I believe internal node should work but I wasn’t sure about continuing that route given the course said otherwise.
I’ll reach out if I have any other problems!

Thanks!

I am trying to clone the lightning app boilerplate using Windows Shell Window. However I cant as I get the following error when using the git command. Does anyone know why?

image

Anyone else having a problem with NPM install? I get the following error:
image

Nevermind. I got it. The files were still zipped and not accessible.

Hey, glad you made it work :raised_hands: in the first issue it seems you don’t have git installed.

I am having issues installing using Windows Shell. NPM install fails

image

Does anyone know what errno -4048 is? It happens every time I try to npm install Lightning App Boiler Plate

Resolved - Need to run Windows Shell as Administrator

1 Like

You should create your project in a user folder instead of Program files.

I’m trying with Windows 10 PS, but the server seems down?
When running this command:

PS C:\Users\enrique\Documents\lightning-app-boilerplate> node -e "const btcpay=require('btcpay'); new btcpay.BTCPayClient('https://lightning.filipmartinsson.com/', btcpay.crypto.load_keypair(Buffer.from('411126bb07768a3052b411962718295789ee88b227f38b7f0f43b2ad0d13010d', 'hex'))).pair_client('gGpUaXk').then(console.log).catch(console.error)"

I get this huge output below. Someone posted this half way through the thread but didn’t receive any replies on his screenshots. Any ideas what is going wrong?

This is the output I’m getting:

StatusCodeError: 400 - {"error":"Error while pairing (Expired)"}
    at new StatusCodeError (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request-promise-core\lib\errors.js:32:15)
    at Request.plumbing.callback (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request-promise-core\lib\plumbing.js:104:33)
    at Request.RP$callback [as _callback] (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request-promise-core\lib\plumbing.js:46:31)
    at Request.self.callback (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request\request.js:185:22)
    at Request.emit (events.js:375:28)
    at Request.<anonymous> (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:375:28)
    at IncomingMessage.<anonymous> (C:\Users\enrique\Documents\lightning-app-boilerplate\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:481:28)
    at IncomingMessage.emit (events.js:387:35)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  statusCode: 400,
  error: { error: 'Error while pairing (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: 'TfJCUhpYaEgkgCNQcvrStdJrbZgWzkSHaHd',
      pairingCode: 'gGpUaXk'
    },
    callback: [Function: RP$callback],
    transform: undefined,
    simple: true,
    resolveWithFullResponse: false,
    transform2xxOnly: false
  },
  response: <ref *1> IncomingMessage {
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: [],
      flowing: true,
      ended: true,
      endEmitted: true,
      reading: false,
      sync: false,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: false,
      destroyed: false,
      errored: null,
      closed: false,
      closeEmitted: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: false
    },
    _events: [Object: null prototype] {
      end: [Array],
      close: [Array],
      data: [Function (anonymous)],
      error: [Function (anonymous)]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'lightning.filipmartinsson.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'lightning.filipmartinsson.com',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 6,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object],
      [Symbol(RequestTimeout)]: undefined
    },
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    headers: {
      server: 'nginx',
      date: 'Mon, 28 Jun 2021 15:33:10 GMT',
      'content-type': 'application/json',
      'transfer-encoding': 'chunked',
      connection: 'close',
      'access-control-allow-origin': '*',
      'referrer-policy': 'same-origin',
      'x-xss-protection': '1; mode=block',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'DENY',
      'strict-transport-security': 'max-age=31536000'
    },
    rawHeaders: [
      'Server',
      'nginx',
      'Date',
      'Mon, 28 Jun 2021 15:33:10 GMT',
      'Content-Type',
      'application/json',
      'Transfer-Encoding',
      'chunked',
      'Connection',
      'close',
      'Access-Control-Allow-Origin',
      '*',
      'Referrer-Policy',
      'same-origin',
      'X-XSS-Protection',
      '1; mode=block',
      'X-Content-Type-Options',
      'nosniff',
      'X-Frame-Options',
      'DENY',
      'Strict-Transport-Security',
      'max-age=31536000'
    ],
    trailers: {},
    rawTrailers: [],
    aborted: false,
    upgrade: false,
    url: '',
    method: null,
    statusCode: 400,
    statusMessage: 'Bad Request',
    client: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'lightning.filipmartinsson.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'lightning.filipmartinsson.com',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 6,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object],
      [Symbol(RequestTimeout)]: undefined
    },
    _consuming: true,
    _dumped: false,
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: null,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'POST /tokens HTTP/1.1\r\n' +
        'Content-Type: application/json\r\n' +
        'Accept: application/json\r\n' +
        'User-Agent: node-btcpay\r\n' +
        'X-Accept-Version: 2.0.0\r\n' +
        'host: lightning.filipmartinsson.com\r\n' +
        'content-length: 68\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/tokens',
      _ended: true,
      res: [Circular *1],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'lightning.filipmartinsson.com',
      protocol: 'https:',
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    request: Request {
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      headers: [Object],
      method: 'POST',
      uri: [Url],
      body: '{"id":"TfJCUhpYaEgkgCNQcvrStdJrbZgWzkSHaHd","pairingCode":"gGpUaXk"}',
      readable: true,
      writable: true,
      explicitMethod: true,
      _qs: [Querystring],
      _auth: [Auth],
      _oauth: [OAuth],
      _multipart: [Multipart],
      _redirect: [Redirect],
      _tunnel: [Tunnel],
      _rp_resolve: [Function (anonymous)],
      _rp_reject: [Function (anonymous)],
      _rp_promise: [Promise [Object]],
      _rp_callbackOrig: undefined,
      callback: [Function (anonymous)],
      _rp_options: [Object],
      setHeader: [Function (anonymous)],
      hasHeader: [Function (anonymous)],
      getHeader: [Function (anonymous)],
      removeHeader: [Function (anonymous)],
      localAddress: undefined,
      pool: {},
      dests: [],
      __isRequestRequest: true,
      _callback: [Function: RP$callback],
      proxy: null,
      tunnel: true,
      setHost: true,
      originalCookieHeader: undefined,
      _disableCookies: true,
      _jar: undefined,
      port: 443,
      host: 'lightning.filipmartinsson.com',
      path: '/tokens',
      _json: true,
      httpModule: [Object],
      agentClass: [Function: Agent],
      agent: [Agent],
      _started: true,
      href: 'https://lightning.filipmartinsson.com/tokens',
      req: [ClientRequest],
      ntick: true,
      response: [Circular *1],
      originalHost: 'lightning.filipmartinsson.com',
      originalHostHeaderName: 'host',
      responseContent: [Circular *1],
      _destdata: true,
      _ended: true,
      _callbackCalled: true,
      [Symbol(kCapture)]: false
    },
    toJSON: [Function: responseToJSON],
    caseless: Caseless { dict: [Object] },
    body: { error: 'Error while pairing (Expired)' },
    [Symbol(kCapture)]: false,
    [Symbol(RequestTimeout)]: undefined
  }
}
1 Like