Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: enable funding of accounts from an external wallet #183

Open
jalavosus opened this issue Nov 30, 2020 · 4 comments
Open

Comments

@jalavosus
Copy link

Whether creating new accounts or depositing into existing ones, there should be an option to fund accounts via an external deposit mechanism -- read: not directly from the connected LND node. This is useful for a few reasons:

  1. It eliminates a source of double-fee deposits; if I want to deposit more BTC into my pool account but my LND node doesn't have enough free balance, I have to first deposit BTC into my LND wallet (and thus, pay a fee for that transaction) and then run DepositAccount() to transfer that BTC from LND to pool (thus, paying a second transaction fee).
  2. This would enable rapid, "on-the-go" deposits; as above, instead of needing to wait for two transactions to confirm, I could simply deposit BTC straight into my Pool account and be ready to go within the allotted confirmation target.
  3. It eliminates a source of headaches with regard to using LND; currently, LND will tie up its entire wallet balance as unusable for every single withdrawal until said withdrawal transaction confirms. Allowing for external deposits will remove this factor, allowing for simultaneous use of LND as well as Pool.

Pool already has a mechanism for creating a deposit address and for awaiting the confirmation of a transaction before fully opening the account. Given this, it should be possible for poold to be funded via an external wallet.

My thought process is to have the account creation function create an address which can be deposited to, and then watch for deposits to that address, rather than expecting a specific Outpoint from LND.

I can spend a little time implementing some of this via a PR, as well.

@Roasbeef
Copy link
Member

This is likely a bit more involved than you anticipate. We originally examined this type of deposit, but then went with the current model as it's: simpler and also ends up saving on chain fees in a batch given each participant has only a single output. Using a single deposit address would also mean address re-use for each user of pool that used the feature. Generating new addresses each time is possible, but would then require some interaction from the server so it can properly increment the "account nonce" on its end each time.

LND will tie up its entire wallet balance as unusable for every single withdrawal until said withdrawal transaction confirms

It's possible to spend these outputs in an unconfirmed manner using the existing lnd APIs. It's also relatively straight forward to allow poold to spend lnd's unconfirmed change to service a deposit or new account creation as well.

@Roasbeef
Copy link
Member

One other complication here is that it would then be possible to have partial account expiry (so some of your account UTXOs expire while others are still valid), which complicates the account management state machine. This would be alleviated somewhat by having auto-renew implemented (so renew an account each time it's part of a batch), which is planned as well.

@jalavosus
Copy link
Author

It's also relatively straight forward to allow poold to spend lnd's unconfirmed change to service a deposit or new account creation as well.

Can you point me to where I'd find documentation on that? It would be hella useful for my use case.

@wpaulino
Copy link
Contributor

The code doesn't allow it at the moment, but the relevant section would be:

For new accounts, we'll want to perform manual coin selection as done with deposits instead of using SendOutputs, which does not allow specific inputs to be used.

positiveblue pushed a commit to positiveblue/pool that referenced this issue Oct 11, 2022
itest: test abandon channel of replaced batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants