Bitcoin Forum
April 27, 2024, 01:53:38 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: lightning point-of-sale  (Read 109 times)
Pecheur (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
January 06, 2023, 05:38:55 PM
Merited by NeuroticFish (1)
 #1

Hello,

I would like to build a mobile point-of-sale which supports lightning payments.
Still a bitcoin/lightning newbie so I'm reading and experimenting to try and figure out the best architecture.

Bitcoin allows to access its api through json-rpc natively.
I don't really understand why this isn't true for Lightning.

Here are a few questions I have related to lightning:

-Why isn't there a BOLT standard requiring the same API interfacing for both c-lightning and LND?
-For C-lightning there are plugins like cln-grpc and the rest API which can be configured to allow programmatic API access but... 
Those plugins aren't installed and configured by default which means we loose the benefit of decentralisation.  If I want my app to use one of those plugins I will be limited to nodes which have the plugin installed?!

What are my best options If I would use e.g Swift and would like to process payments from the app to the lightning network?

Thanks,
Martin
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
1714226018
Hero Member
*
Offline Offline

Posts: 1714226018

View Profile Personal Message (Offline)

Ignore
1714226018
Reply with quote  #2

1714226018
Report to moderator
BlackHatCoiner
Legendary
*
Online Online

Activity: 1498
Merit: 7292


Farewell, Leo


View Profile
January 06, 2023, 09:07:11 PM
Merited by ABCbits (1)
 #2

Bitcoin allows to access its api through json-rpc natively.
I don't really understand why this isn't true for Lightning.
There is c-lightning-REST, if you haven't noticed, but I'm not sure if that's what you're asking for: https://github.com/Ride-The-Lightning/c-lightning-REST

-Why isn't there a BOLT standard requiring the same API interfacing for both c-lightning and LND?
Because developers can choose to code their software however they wish, I suppose. BOLT stands for "Basics of Lightning Technology", and devs do follow that specification, but there shouldn't be specification to the manner they build their ecosystem.

Those plugins aren't installed and configured by default which means we loose the benefit of decentralisation.
Lost you here. What prevents each user from installing plugins individually, that would harm decentralization?

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5814


not your keys, not your coins!


View Profile WWW
January 07, 2023, 12:34:17 AM
 #3

Those plugins aren't installed and configured by default which means we loose the benefit of decentralisation.  If I want my app to use one of those plugins I will be limited to nodes which have the plugin installed?!
How's that? Would this mean that you believe decentralization relies on what's 'configured by default'? I.e. Bitcoin as a network is not decentralized because it's not preinstalled on Windows 10? This seems absurd.

Every LN node can connect to any other LN node; no matter which plugins they have installed. Unless I guess they build a plugin that rejects connections from certain nodes or something like that, of course. But that's a constructed example.

To answer your question: mobile open-source Lightning-based point-of-sale apps exists; it's built into Breez for instance.
It is not written in Swift, though. But you can still read the code and get a feeling for what you need to replicate.

In short, the only 'point of sale' specific stuff you will need to add to a mobile self-custodial LN node is a fiat-BTC currency conversion (one API call), then send the BTC amount to Core Lightning with the invoice RPC command to get back an invoice. Lastly, render it nicely (probably as a QR code) however you wish, with whatever graphical framework you're comfortable with, to display it to customers.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pecheur (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
January 07, 2023, 02:16:18 AM
Last edit: January 08, 2023, 05:09:42 PM by mprep
 #4

Hello!

Thank you for your answers.

Why would I need an LN node running on the mobile device with the app?  Or did I misunderstand your answer? 
Why can't the mobile app make json-rpc calls remotely to any LN node available?  Preferably to a node which is closest to the mobile user's location or route?

I don't talk about LN to LN communication but rather about a client (app) / server (LN node) setup.

When you tell to use the invoice RPC command, this is exactly the part I want to do through an API remotely, not by using the lightning-cli command on an LN node.


If I configure 1 LN node with a grpc plugin, then I'm only sure that that specific LN node is running that plugin.  This kind of forces me to only use that node or a cluster of nodes which I configured.  Although a cluster would help it still would reduce the decentralisation aspect by a lot.

I thought the BOLTs were meant to keep standards for alternative lightning implementations such as c-lightning and LND, my bad.

I will look into Breez, I didn't know about this.





Those plugins aren't installed and configured by default which means we loose the benefit of decentralisation.  If I want my app to use one of those plugins I will be limited to nodes which have the plugin installed?!
How's that? Would this mean that you believe decentralization relies on what's 'configured by default'? I.e. Bitcoin as a network is not decentralized because it's not preinstalled on Windows 10? This seems absurd.

I do believe Bitcoin and Lightning are decentralised.  But if only a part of the nodes support grpc calls through a plugin which needs to be installed by its admin, then the remaining part of the nodes become useless to apps requiring grpc.

[moderator's note: consecutive posts merged]
BlackHatCoiner
Legendary
*
Online Online

Activity: 1498
Merit: 7292


Farewell, Leo


View Profile
January 07, 2023, 06:10:39 PM
 #5

Why can't the mobile app make json-rpc calls remotely to any LN node available?  Preferably to a node which is closest to the mobile user's location or route?
To any LN node, kinda not. You make RPC calls on computers you control. If you're searching for a mobile lightning wallet app that includes REST requests, check out Zap.

When you tell to use the invoice RPC command, this is exactly the part I want to do through an API remotely, not by using the lightning-cli command on an LN node.
This precise command can be executed remotely by the github repository I linked you above in my other post.

If I configure 1 LN node with a grpc plugin, then I'm only sure that that specific LN node is running that plugin.  This kind of forces me to only use that node or a cluster of nodes which I configured.
Again, you can use commands such as invoice, pay, getinfo etc., on nodes you control of. You can't just force someone do this for you, you do it individually on your node(s). Just as you enable server in Bitcoin Core and use credentials to execute commands remotely.

I do believe Bitcoin and Lightning are decentralised.  But if only a part of the nodes support grpc calls through a plugin which needs to be installed by its admin, then the remaining part of the nodes become useless to apps requiring grpc.
Such as... which apps? Routing transactions and accomplishing payments does not require the installation of a plugin.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5814


not your keys, not your coins!


View Profile WWW
January 07, 2023, 07:24:34 PM
 #6

Why can't the mobile app make json-rpc calls remotely to any LN node available?  Preferably to a node which is closest to the mobile user's location or route?
Because the node holds the funds. No node => no channels => no funds.

I don't talk about LN to LN communication but rather about a client (app) / server (LN node) setup.
A client-server setup works if users have their own servers (full LN nodes). They can't share an LN node without sharing a balance. If it makes sense?

I do believe Bitcoin and Lightning are decentralised.  But if only a part of the nodes support grpc calls through a plugin which needs to be installed by its admin, then the remaining part of the nodes become useless to apps requiring grpc.
That's not how they work though, as explained above. If you yourself run an app on your own node that requires GRPC, you install / configure GRPC, if you don't, you don't. Others can't use your node, anyway, so it doesn't matter to them what you do or do not install.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pecheur (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 1


View Profile
January 08, 2023, 12:39:09 AM
 #7

thanks for your help!
makes sense now.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!