gudnuf / bolt12-prism

CLN plugin for lightning prisms using BOLT 12
15 stars 5 forks source link

Feature Request: Implicit and Explicit Pay-to-Self #85

Open farscapian opened 2 months ago

farscapian commented 2 months ago

User Story

Say you're the Leader of a band and each member runs a BOLT12-capable lightning node. You might want to issue a BOLT12 offer so fans can tip the band during and after a concert. Fortunately, you run a well-managed Lightning node and issue a BOLT12 Offer for people to tip. You consider creating a BOLT12 Prism on your node to split the proceeds among band members.

In this scenario, it is common for the receiver to split the funds downstream to the remaining prism members. But being the leader of the Band, you are entitled to a share of the funds.

There are two ways to implement this interaction: Implicit and Explicit Pay-to-Self.

Implicit Pay-to-Self

In this model, the amount_msat of an income event is multiplied by an outlay_factor, which by default is 1. If the outlay_factor is 0.8, total outlays will be 80% of total income. Thus, there is an implicit 20% pay-to-self.

Explicit Pay-to-Self

In this model, we create an explicit payment to a BOLT12 offer that was issued by the SAME node as the Prism host. This offer is specified as a member of the Prism payout. Prism execution creates an explicit debit+credit in the transaction list showing a movement of funds. This feature enables local composability of prisms.

farscapian commented 1 month ago

Status: Implicit pay-to-self is working. Explicit Pay-to-self requires upstream changes from CLN.