Skip to content

Multi-node receive [PoC]#6175

Closed
joostjager wants to merge 3 commits intolightningnetwork:masterfrom
bottlepay:invoice-coordinator
Closed

Multi-node receive [PoC]#6175
joostjager wants to merge 3 commits intolightningnetwork:masterfrom
bottlepay:invoice-coordinator

Conversation

@joostjager
Copy link
Copy Markdown
Contributor

@joostjager joostjager commented Jan 18, 2022

This PR is an exploration of the design space for multi-node receive.

The idea is to run a standalone process (working title: invoice coordinator) that connects to a cluster of lnd nodes via the htlc interceptor API. The coordinator is backed by a replicated database that contains all invoices. It has its own node key and every invoice is generated by the coordinator. Invoices contain a hop hint for each node in the cluster with a dummy scid.

When an htlc comes in on one of the cluster nodes, it is intercepted by the coordinator. The coordinator matches the hash with the invoice database and if there is one, it signals the lnd node to settle the htlc.

This allows invoices to be paid through any of the cluster nodes. When one node goes down, senders will retry with one of the other nodes listed in the route hints. Also shards of a multi-part payment may use multiple nodes.

Current implementation is an adaptation to LND. It allows LND to be run in a mode where it acts as the coordinator. To do that, the gateway node needs to be specified (only one supported atm):

lnd --gateway.pubkey=0314aaf9b2547682b81977b3ac0c5585c3521a0a5430fb410cb572d5c72364edf3 --gateway.tls=~/.lnd/tls.cert --gateway.mac=~/.lnd-bob/data/chain/bitcoin/regtest/admin.macaroon --gateway.host=localhost:10002

What you can do with this is set up Alice and Bob with a channel between them and then connect the coordinator to Bob. This allows Alice to pay invoices created by the coordinator.

For production, it seems unlikely that we want to run a customized lnd as the coordinator. Instead the coordinator code can live in a fresh stand-alone repo. This also allows the database backend (channeldb/invoices.go) to be re-implemented using structured sql.

Dependencies:

@joostjager
Copy link
Copy Markdown
Contributor Author

Closing as this is now implemented externally in https://github.com/bottlepay/lnmux

@joostjager joostjager closed this Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants