0

I want to develop Exchange where people would use my service to make payments using lightning network

I configured the LND node and created a wallet.

To implement this I would like to allow users to create addresses, and then to send money from one address to another (under same wallet) Moreover, If they wanted to withdraw money to random simple-bitcoin address (like 1BzVLSNcwznjoynyuFgMXwaGeevycLgDEN)

Therefore the very general question is: Is it possible?

The questions are:

  1. Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?

  2. Is it possible to send funds from address in lightning network to simple bitcoin address?

  3. Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

  • generally it makes more sense on this site to ask separate questions ins separate threats and have the question itself as the title and the text as elaboration. – Rene Pickhardt Aug 14 at 13:00
2
  1. Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?

You seem to confuse bitcoin addresses and lightning network ids. If you have a lightning node you have a node pubkey (called the node_id). Of course there is a corresponding private key / secret. From this you can derive bitcoin addresses in your bitcoin wallet that is attached to the lightning node. Those addresses are used to fund your node or to claim funds from channels that for some reason hit the chain.

  1. Is it possible to send funds from address in lightning network to simple bitcoin address?

As from the first part of the answer. once the channels hit the chain they are in the bitcon network and can be send to any other bitcoin address. There are exchange-services that allow and atomic on/off-chain swap. means you pay in invoice on lightning so that onchain bitcoin arrive at some address and vice versa.

  1. Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

If I understand your question correctly I would say it is possible. In the current setting people who offer a custodial wallet service seem to sign all invoices with the node ID of the lightningnode that is powering the custodial wallet. There speaks nothing against giving every user their own secrete and their own node id / bitcoin keys. You could even have virtual payment channels between the exchanges lightning network node that you maintain an run and between the "virtual" nodes of your customers which are basically private and suggest in the routing hints of the invoice to use the lightning node of your service. In order to do these kinds of tricks you might want to switch to c-lightning as with their plugin infrastructure have an API that allow easier customization for such features.

  • I still dont get it: if I want to users allow to make payments (each with their own bitcoin address) to each other, I need many LND instances running? Because if there are only lightning nodes, connected by payment channel (= 2 users in blockchain "connected" by having a 2-of-2 multisig address), then I need as many nodes as many users(=unique addresses) I have? – newbie Aug 15 at 10:22
  • 1
    When using lightning the users don't have to have a Bitcoin address lightning nodes have a different address space / scheme. You can do all of this on top of one lightning network node but then it is custodial. The power of lightning is that every user should run their own node anyway but I guess this goes against the service you might want to offer – Rene Pickhardt Aug 16 at 10:02
  • Big thanks, your answer helped me a lot! Can you clarify a bit what you meant when said "do this on top of one lightning node"? – newbie Aug 16 at 13:31
1
  1. Bitcoin has addresses but there is no such thing as a Lightning "address" where you send the Lightning funds. A Lightning channel is opened by sending funds to a 2-of-2 multisignature Bitcoin address. From that point onwards invoices are sent back and forth using the Lightning protocol with balances updated as users agree to pay the invoices.

  2. To receive your Bitcoin onchain and effectively leave the Lightning Network you close the channel and send Bitcoin from the 2-of-2 multisignature Bitcoin address to a Bitcoin address that is solely controlled by you.

  3. You can run multiple Lightning nodes and send funds from any of those nodes that can afford to transfer the funds. When the receiver requests a Lightning payment they send an invoice that can be paid by any Lightning node. There is no restriction on where those funds should come from.

  • question #3. So that, the only way to transfer funds between addresses is to have many nodes (and each node will have own wallet)? I probably don't understand it good enough, but for now, it seems like waste of resources just to pay to someone once – newbie Aug 14 at 14:23
  • 1
    There are no Lightning addresses. Lightning nodes transfer funds to other Lightning nodes. There is also no global record of all Lightning transactions so there is no concern of "address reuse" or the same concerns on privacy leaks. If you want to do multiple Lightning payments you can do them from the same Lightning node without needing to spin up a new Lightning node each time. – Michael Folkson Aug 14 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.