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

Openchannels: new command for batched/coin-controlled channel opening #91

Merged
merged 1 commit into from
Jun 19, 2021

Conversation

bitromortac
Copy link
Owner

@bitromortac bitromortac commented May 2, 2021

Introduces a new command openchannels with the intent of batching channel opens and implementing coin control, meaning one can select the UTXOs to spend from. Batching is implemented using LNDs support for PSBTs, so there is no external wallet required. The command expects a comma-separated list of public node ids as a minimal input. UTXOs and amounts can be specified as a comma-separated outpoint string.
The command will perform connection checks automatically in the setup phase. Once the setup phase is passed, channel opening is initiated. When everything goes well, before final signing and broadcasting, the user is asked to confirm the channel opening. Anchor reserve outputs are created/respected automatically.

The command has several modes of operation for specifying amounts and utxos:

  • Specifying UTXOs defines a budget
  • No amount is given: spend all UTXOs and distribute them equally to the channels - no change created
  • Specify a total amount and no UTXOs: all UTXOs will be spent - no change created
  • Specify amounts for channels and no UTXOs: all UTXOs will be spent:
    • (relative amounts) amounts are smaller than 100: relative amounts are rescaled to fit all UTXOs - no change created
    • (absolute amounts) amounts are larger than 100: if sum of amounts is smaller than the UTXO budget, change is created, if sum of amounts is larger than UTXO budget, the amount is rescaled such that no change is created

The user can decide if the opening should be private (unannounced) or public (announced).

TODO:

  • Insert a timer to track the elapsed time
  • Handle anchor reserves
  • Decode PSBT for crosscheck
  • Handle nested P2WKH inputs
  • Reproduce LND fee estimation bug
  • Report bug to LND repo
  • final testing and code cleanup
  • Implement a new command for UTXO locking/listing (in another PR)

@bitromortac bitromortac force-pushed the 2104-batchopen branch 6 times, most recently from da2ddf0 to 0562185 Compare May 22, 2021 06:36
@bitromortac bitromortac force-pushed the 2104-batchopen branch 3 times, most recently from 1c094fe to da77408 Compare May 23, 2021 08:06
@bitromortac bitromortac force-pushed the 2104-batchopen branch 3 times, most recently from 29dbb9f to 3b37cc8 Compare June 12, 2021 07:29
@bitromortac
Copy link
Owner Author

bitromortac commented Jun 17, 2021

Instead of maintaining an internal way of batching channels we could maybe use lightningnetwork/lnd#5356 .

@bitromortac bitromortac merged commit 39b9db5 into master Jun 19, 2021
@bitromortac bitromortac deleted the 2104-batchopen branch October 20, 2021 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant