getAlby / lndhub.go

Accounting wrapper for the Lightning Network. It provides separate accounts for end-users. (LndHub compatible API written in Go)
GNU General Public License v3.0
86 stars 23 forks source link

FEATURE: Seed initial balance #114

Open jblachly opened 2 years ago

jblachly commented 2 years ago

Given a local node N with a balance of X million sats, a user may wish to create LNDHub.go / Alby / BlueWallet accounts for themself (daily spending) and for friends or family members constructed from some portion of the existing balance, rather than accepting in additional funds from outside sources (Strike, Cash App, Boltz, etc.).

A very useful feature would be to seed an initial balance at wallet (account) creation time. I haven't yet quite internalized the data model, but this looks like it may require a simulated invoice?

raucao commented 2 years ago

It seems to me like this could also be a useful feature for a migration path from LndHub to lndhub.go.

bumi commented 2 years ago

Good idea. thanks for raising this topic and indeed this would making it easier to write a migration script.

Right now every transaction entry in the DB assumes it is associated with an invoice but I think this does not need to be a hard requirement. Then such an initial balance would simply be a transaction from the incoming account to the current account. Open question is when/how to create such a funding transaction?

raucao commented 2 years ago

Right now every transaction entry in the DB assumes it is associated with an invoice

How does that work when sending between accounts on the same node? Shouldn't that already have a different association?

jblachly commented 2 years ago

Open question is when/how to create such a funding transaction?

From an admin dashboard perhaps

jblachly commented 2 years ago

Right now every transaction entry in the DB assumes it is associated with an invoice

How does that work when sending between accounts on the same node? Shouldn't that already have a different association?

Indeed; Bluewallet can send transactions between accounts on the same host without creating invoice -- LNDHub intercepts them and just updates internal (well, Redis) state

bumi commented 2 years ago

you can do that here, too. If it is an internal transaction from one lndhub account to another one there is still an invoice involved. lndhub then sees that the invoice is internal and does a simple transaction entry.