ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
644 stars 97 forks source link

Add support for splices #356

Closed dpad85 closed 1 year ago

dpad85 commented 1 year ago

This PR is a major update to the app. It adds support for splices in Phoenix. Splicing lets Phoenix and it peer edit channels on the fly cooperatively, which significantly improves liquidity management (for example the app only needs 1 single channel).

Upgrade to kotlin 1.8

Kotlin has been upgraded from 1.6.21 to 1.8.21. No major changes since we were already using the new memory model, but many dependencies have been also upgraded.

Channel management

A screen has been added to manage the wallet's liquidity needs. When additional liquidity is required to receive a payment, the wallet will use user-provided settings to automatically accept or reject the payment (and the on-chain fee). Notifications are displayed to inform the user when a payment has been rejected.

Displaying the fee before paying

The trampoline fee is now fixed and thus the fee for LN payments can now be displayed before sending the payment. Note that for now the wallet is not able to surcharge the fee to improve the payment success rate.

Paying on-chain with splice-out

On-chain payments do not use the trusted swap-out process anymore. Instead, Phoenix uses the splice-out methods exposed by lightning-kmp that will directly take funds from a channel to pay on-chain, which makes the payment trustless. Additionally, the user is able to pick the feerate for this splice-out. Moreover, using splice-out, the user can CPFP any unconfirmed transactions.

Receiving on-chain with swap-in potentiam

The wallet's on-chain address is a swap-in potentiam multisig address, managed in cooperation with the peer. Funds on this wallet are swapped (0-conf & trustless) to Lightning if they adhere to the channel's management policy mentioned above, or remain on-chain otherwise.

A "Wallet info" screen has been added in the settings to monitor transactions to the swap-in wallet, as well as the final wallet (the default wallet for closing channels).

Notification screen

A new screen showing important messages (for example, a reminder to backup the wallet's seed) and payment rejection messages has been added.

Improved channel details

The channel's details screen has been reworked to be more readable. The json data is still visible, but behind a button. Active and inactive commitments are now displayed (along with the payment that triggered them) to help debugging the various splices that occur in a channel lifecycle.

Database changes

With splices, the payments db objects have been overhauled and new tables have been added:

A table storing notifications has been added to AppDb.