From 0d4898c8a25656ec2a493ed82a933546f40d9732 Mon Sep 17 00:00:00 2001 From: Dovydas Joksas Date: Sat, 27 Jan 2024 11:54:47 +0000 Subject: [PATCH] improve example #1 for payment calculation --- value/value.md | 63 +++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/value/value.md b/value/value.md index b5e0e9a..d3290f1 100644 --- a/value/value.md +++ b/value/value.md @@ -237,26 +237,25 @@ For `fee=false` recipients $X_1, X_2, \ldots, X_m$ with splits $x_1, x_2, \ldots 1. Firstly, `fee=true` recipients $Y_1, Y_2, \ldots, Y_n$ will receive $y_1\\%$, $y_2\\%$, $\ldots$, $y_n\\%$ of the transaction. 2. Then, the remaining amount will be distributed among `fee=false` recipients $X_1, X_2, \ldots, X_m$ in the ratio $x_1 : x_2 : \ldots : x_m$. - -To calculate payouts, let's take the following value block as an example: +#### Example 1: no fees, splits add up to 100 ```xml ``` -This block designates three payment recipients. On each timed payment interval, the total payment will be split into 3 -smaller -payments according to the shares listed in the split for each recipient. So, in this case, if the listener decided to -pay 100 sats per minute for listening -to this podcast, then once per minute the "Host" would be sent 50 sats, the "Co-Host" would be sent 40 sats and the -"Producer" would be sent 10 sats - all to their respective lightning node addresses using the "keysend" protocol. - -If, instead of a 50/40/10 (total of 100) split, the splits were given as 190/152/38 (total of 380), the respective -payment amounts each minute would still -be 50 sats, 40 sats and 10 sats because the listener chose to pay 100 sats per minute, and the respective shares (as a -percentage of the total) would remain the same. - -On a 190/152/38 split, each minute the payment calculation would be: - -- Interval payout: 100 sats +This block designates three payment recipients. +On each timed payment interval, the total payment will be split into 3 smaller payments according to the `split` of each recipient. +Because there are no `fee=true` recipients, step 1 of the calculation can be skipped—the splits represent the ratios in which the payment should be divided. +I.e., for recipients `A`, `B`, and `C`, the payment should be divided in the ratio $50:40:10$: +- `A` will receive $\dfrac{50}{50 + 40 + 10} = 0.5 = 50\\%$ of the payment +- `B` will receive $\dfrac{40}{50 + 40 + 10} = 0.4 = 40\\%$ of the payment +- `C` will receive $\dfrac{10}{50 + 40 + 10} = 0.1 = 10\\%$ of the payment -- Share total: 380 +In this case, because splits add up to 100 (that is, $50 + 40 + 10 = 100$), the splits happen to correspond to the percentage values that each recipient will receive. +However, in general, it should never be assumed or expected that splits add up to 100. - - Recipient #1 gets a payment of: 50 sats (190 / 380 * 100) - - Recipient #2 gets a payment of: 40 sats (152 / 380 * 100) - - Recipient #3 gets a payment of: 10 sats (38 / 380 * 100) +Suppose that the listener chose to pay 300 sats per minute. Each minute, the payment calculation would be: -If an app chooses to only make a payout once every 30 minutes of listening/watching, the calculation would be the same -after multiplying -the per-minute payment by 30: +Interval payout: **300 sats** + +- Recipient `A` gets a payment of 150 sats (calculated using $300 \cdot \dfrac{50}{50 + 40 + 10} = 150$) +- Recipient `B` gets a payment of 120 sats (calculated using $300 \cdot \dfrac{40}{50 + 40 + 10} = 120$) +- Recipient `C` gets a payment of 30 sats (calculated using $300 \cdot \dfrac{10}{50 + 40 + 10} = 30$) -- Interval payout: 3000 sats (100 * 30) +If an app chooses to only make a payout once every 5 minutes of listening/watching, the calculation would be the same after multiplying the per-minute payment by 5: -- Shares total: 380 +Interval payout: **1500 sats** (calculated using $5 \cdot 300 = 1500$) - - Recipient #1 gets a payment of: 1500 sats (190 / 380 * 3000) - - Recipient #2 gets a payment of: 1200 sats (152 / 380 * 3000) - - Recipient #3 gets a payment of: 300 sats (38 / 380 * 3000) +- Recipient `A` gets a payment of 750 sats (calculated using $1500 \cdot \dfrac{50}{50 + 40 + 10} = 750$) +- Recipient `B` gets a payment of 600 sats (calculated using $1500 \cdot \dfrac{40}{50 + 40 + 10} = 600$) +- Recipient `C` gets a payment of 150 sats (calculated using $1500 \cdot \dfrac{10}{50 + 40 + 10} = 150$) -As shown above, the once per minute calculation does not have to actually be sent every minute. A longer payout period -can be chosen. But, -the once-per-minute nature of the payout still remains in order for listeners and creators to have an easy way to -measure and calculate how much -they will spend and charge. +As shown above, the once per minute calculation does not have to actually be sent every minute. +A longer payout period can be chosen. But, the once-per-minute nature of the payout still remains in order for listeners and creators to have an easy way to measure and calculate how much they will spend and charge.