podcast-namespace/value/value.md

426 wiersze
17 KiB
Markdown

2021-02-27 18:35:29 +00:00
# The "podcast:value" Specification
2021-02-25 21:20:23 +00:00
2021-10-05 20:21:47 +00:00
<small>Version 1.4 by [Dave Jones](https://github.com/daveajones) - with [Gigi](https://github.com/dergigi), [Evan Feenstra](https://github.com/evanfeenstra) & [Paul Itoi](https://github.com/pitoi)</small><br>
2021-09-02 16:14:27 +00:00
<small>September 1st, 2021</small>
2021-02-25 21:20:23 +00:00
<br>
## Purpose
Here we describe an additional "block" of XML that gives podcasters (and other media creators) a way to receive direct
payments from their audience in response to the action of viewing or listening to a created work. Utilizing so called "Layer 2"
cryptocurrency networks like Lightning, and possibly other digital currency mechanisms, near real-time micropayments can
2021-02-25 21:20:23 +00:00
be directly sent from listener or viewer to the creator without the need for a payment processor or other "middle men".
The value block designates single or multiple destinations for these micro-payments. The idea is that the creator of the media
describes (within the feed) where and how they would like payments to be sent back to them during consumption
of that media. The format is designed to be flexible enough to handle many scenarios of direct payment streaming. Even
the use of fiat currency, if there is an API that is capable of interfacing as a receiver within this format.
<br>
## Play to Pay
This system can be thought of as Play-to-pay, rather than the traditional Pay-to-play paywall approach. When a
media listener (such as within a podcast app) presses the play button on an episode who's feed contains a value
block, a compatible app will be expected to begin streaming micro-payments to the designated recipients on a time
interval that makes sense for the app. The amount of each payment can be any amount the listener chooses, including
zero. If the listener chooses not to pay to listen to this media, then the app can ignore the value block of that feed.
<br>
## Payment Intervals
The "time interval" for calculating payments is **always 1 minute**. However, the actual interval between when payments
are sent can be longer. The interval should be chosen with a few factors in mind such as connectivity (is the app
currently on-line?), transaction fees (batch payments together to reduce fee percentage), cryptocurrency network load
(can the given crypto network or API support this payment rate?).
No matter what the chosen time interval for the actual transaction, the calculation should be done on a once-per-minute
basis. So, if the micro-payment is sent every 15 minutes, it should be calculated as 15 payments batched together
in a single transaction. Likewise, some apps with limited connectivity may need to only send payments once per
hour. In that scenario, there would be 60 payments added up into a single, larger payment. Batching transactions
like this also helps to minimize the impact of transaction fees on the underlying cryptocurrency network.
2021-07-19 14:31:26 +00:00
Note that playback speed is not a factor in this calculation. The "one minute payment interval" refers to the minutes that make up the total runtime of the content, thus all payment calculations are independent of playback speed.
2021-02-25 21:20:23 +00:00
<div class="page"/>
<br><br>
## Elements
There are two elements that make up what we refer to as the "value block". They are a parent element that specifies the
currency to use, and one or more child elements that specify who to pay using the currency and protocol described by the
parent.
<br>
### Value Element
The `<podcast:value>` tag designates the cryptocurrency or payment layer that will be used, the transport method for transacting
the payments, and a suggested amount denominated in the given cryptocurrency.
This element can exist at either the `<channel>` or `<item>` level.
Currently, there can be only a single copy of this element at each level.
<br>
#### Structure:
2021-04-19 03:35:20 +00:00
```xml
2021-02-25 21:20:23 +00:00
<podcast:value
type="[cryptocurrency or layer(string)]"
method="[payment transport(string)]"
suggested="[payment amount(float)]"
>
[one or more "podcast:valueRecipient" elements]
</podcast:value>
```
<br>
#### Attributes:
- `type` (required) This is the service slug of the cryptocurrency or protocol layer.
- `method` (required) This is the transport mechanism that will be used.
- `suggested` (optional) This is an optional suggestion on how much cryptocurrency to send with each payment.
<br>
#### Explanation:
2021-02-25 22:10:28 +00:00
Using Lightning as an example, the `type` would be "lightning". Various possible `type` values will be kept
2021-02-25 21:20:23 +00:00
in a slug list [here](valueslugs.txt). This is the only type currently in active use. Others are under development
and will be added to the list as they see some measure of adoption, or at least a working example to prove viability.
The `method` attribute is used to indicate a sub-protocol to use within the given `type`. Again, returning to
2021-02-25 22:10:28 +00:00
Lightning as an example, the `method` would be "keysend". Normally, a Lightning payment requires an invoice
2021-02-25 21:20:23 +00:00
to be generated by the payee in order to fulfill a transaction. The "keysend" protocol of Lightning allows payments
to be streamed to what is, essentially, an open invoice. Other cryptocurrencies may have a similar protocol that
would be used here. If not, a value of "default" should be given.
The "suggested" amount is just that. It's a suggestion, and must be changeable by the user to another value, or
to zero. The suggested amount depends on the payment protocol being used. For instance, with Lightning on the Bitcoin network, the amount can be as low as one millisatoshi, expressed as `0.00000000001` BTC.
2021-02-25 21:20:23 +00:00
A single value tag can contain many `<podcast:valueRecipient>` tags as children. All of these given recipients are
sent individual payments when the payment interval triggers.
The value tag, when it exists at the `<channel>` level, designates the payment scheme for the entire podcast. When it
exists at the `<item>` level, it is intended to override the channel level tag for that episode only.
#### Example:
2021-07-19 18:08:06 +00:00
The following example uses the `keysend` method of the `lightning` network and
2021-07-19 18:09:19 +00:00
sets the suggested value to 5 sats. A sat, short for satoshi, is a
one-hundred-millionth of a single bitcoin (0.00000001 BTC). The smallest unit on
the Lightning Network is a millisat, which is a thousandth of a sat.
2021-04-19 03:35:20 +00:00
```xml
2021-02-25 21:20:23 +00:00
<podcast:value
type="lightning"
method="keysend"
suggested="0.00000005000"
></podcast:value>
```
<br><br>
<div class="page"/>
### Value Recipient Element
The `valueRecipient` tag designates various destinations for payments to be sent to during consumption of the enclosed
media. Each recipient is considered to receive a "split" of the total payment according to the number of shares given
in the `split` attribute.
This element may only exist within a parent `<podcast:value>` element.
There is no limit on how many `valueRecipient` elements can be present in a given `<podcast:value>` element.
<br>
#### Structure:
2021-04-19 03:35:20 +00:00
```xml
2021-02-25 21:20:23 +00:00
<podcast:valueRecipient
name="[name of recipient(string)]"
type="[address type(string)]"
address="[the receiving address(string)]"
customKey="[optional key to pass(mixed)]"
customValue="[optional value to pass(mixed)]"
split="[share count(int)]"
2021-03-30 20:40:36 +00:00
fee=[true|false]
2021-02-25 21:20:23 +00:00
/>
```
<br>
#### Attributes:
- `name` (recommended) A free-form string that designates who or what this recipient is.
- `customKey` (optional) The name of a custom record key to send along with the payment.
- `customValue` (optional) A custom value to pass along with the payment. This is considered the value that belongs to the `customKey`.
- `type` (required) A slug that represents the type of receiving address that will receive the payment.
- `address` (required) This denotes the receiving address of the payee.
- `split` (required) The number of shares of the payment this recipient will receive.
2021-03-30 20:40:36 +00:00
- `fee` (optional) If this attribute is not specified, it is assumed to be false.
2021-02-25 21:20:23 +00:00
<br>
#### Explanation:
The `name` is just a human readable description of who or what this payment destination is. This could be something simple like
"Podcaster", "Co-host" or "Producer". It could also be more descriptive like "Ronald McDonald House Charity", if a podcaster
chooses to donate a percentage of their incoming funds to a charity.
The `type` denotes what type of receiving entity this is. For instance, with lightning this would typically be "node". This would
indicate that the `address` attribute for this recipient is a Lightning node that is capable of directly receiving incoming keysend payments. Valid values for
the `type` attribute are kept in the accompanying file [here](valueslugs.txt). Another option is given in examples below.
Payments must be sent to a valid destination which is given in the `address` attribute. This address format will vary depending on
the underlying currency being used.
The `split` attribute denotes an amount of "shares" of the total payment that the recipient will receive when each timed payment is made.
When a single `<podcast:valueRecipient>` is present, it should be assumed that the `split` for that recipient is 100%, and the "split" should
be ignored. When multiple recipients are present, a share calculation (see below) should be made to determine how much to send to each recipient's address.
2021-03-30 20:40:36 +00:00
The `fee` attribute tells apps whether this split should be treated as a "fee", or a normal split. If this attribute is true, then this split should be calculated
as a fee, meaning its percentage (as calculated from the shares) should be taken off the top of the entire transaction amount. This is the preferred way for service
2021-03-30 20:40:36 +00:00
providers such as apps, hosting companies, API's and third-party value add providers to add their fee to a value block.
2021-02-25 21:20:23 +00:00
<br><br>
<div class="page"/>
### Payment calculation
The interval payment calculation is:
(Number of shares / Share total) * Interval payout * Interval count
To calculate payouts, let's take the following value block as an example:
2021-04-19 03:35:20 +00:00
```xml
2021-02-25 21:20:23 +00:00
<podcast:value type="lightning" method="keysend" suggested="0.00000015000">
<podcast:valueRecipient
name="Host"
type="node"
address="02d5c1bf8b940dc9cadca86d1b0a3c37fbe39cee4c7e839e33bef9174531d27f52"
split="50"
/>
<podcast:valueRecipient
name="Co-Host"
type="node"
address="032f4ffbbafffbe51726ad3c164a3d0d37ec27bc67b29a159b0f49ae8ac21b8508"
split="40"
/>
<podcast:valueRecipient
name="Producer"
type="node"
address="03ae9f91a0cb8ff43840e3c322c4c61f019d8c1c3cea15a25cfc425ac605e61a4a"
split="10"
/>
</podcast:value>
```
This block designates three payment recipients. On each timed payment interval, the total payment will be split into 3 smaller
2021-07-19 17:50:21 +00:00
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.
2021-02-25 21:20:23 +00:00
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
2021-07-19 17:50:21 +00:00
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.
2021-02-25 21:20:23 +00:00
On a 190/152/38 split, each minute the payment calculation would be:
2021-07-19 17:50:21 +00:00
- Interval payout: 100 sats
2021-02-25 21:20:23 +00:00
- Share total: 380
- 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)
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:
2021-07-19 17:50:21 +00:00
- Interval payout: 3000 sats (100 * 30)
2021-02-25 21:20:23 +00:00
- Shares total: 380
- 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)
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.
<br><br>
<div class="page"/>
### Supported Currencies and Protocols
The value block is designed to be flexible enough to handle most any cryptocurrency, and even fiat currencies with a given
API that exposes a compatible process.
2021-07-29 13:17:32 +00:00
Currently, development is centered mostly on [Lightning](https://github.com/lightningnetwork) using the "keysend" method. Keysend allows for push
2021-02-25 21:20:23 +00:00
based payments without the recipient needing to generate an invoice to receive them.
2021-07-29 13:16:33 +00:00
Another method to send spontaneous payments via Lightning is AMP, atomic
[multipath payments][AMP]. AMP supersedes keysend in many ways and allows for
more robust and larger payments. However, it is still in beta and thus not
2021-07-29 13:17:32 +00:00
widely implemented as of now.
2021-02-25 21:20:23 +00:00
2021-07-29 13:16:33 +00:00
[AMP]: https://bitcoinops.org/en/topics/multipath-payments/
2021-07-29 13:02:02 +00:00
2021-02-25 21:20:23 +00:00
<br>
#### Lightning
For the `<podcast:value>` tag, the following attributes MUST be used:
- `type` (required): "lightning"
2021-07-29 13:07:29 +00:00
- `method` (required): "keysend" or "amp"
2021-04-14 05:42:35 +00:00
- `suggested` (optional): A float representing a BTC amount.
e.g. 0.00000005000 is 5 Sats.
2021-02-25 21:20:23 +00:00
For the `<podcast:valueRecipient>` tag, the following attributes MUST be used:
- `type`: "node"
- `address`: \<the destination node's pubkey\>
- `split`: \<the number of shares\>
If the receiving Lightning node, or service, requires a custom record or meta-data of some sort to be passed along with the payment
2021-02-26 22:07:35 +00:00
the `customKey` and `customValue` can be utilized as follows:
2021-02-25 21:20:23 +00:00
- `type`: "node"
2021-07-29 13:07:29 +00:00
- `method`: "keysend" or "amp"
2021-02-26 22:07:35 +00:00
- `customKey`: \<key name\>
- `customValue`: \<value\>
2021-02-25 21:20:23 +00:00
- `address`: \<the destination node's pubkey\>
- `split`: \<the number of shares\>
<br>
##### Example
This is a live, working example of a Lightning keysend value block in production. It designates four recipients for payment - two
podcast hosts at 49 and 46 shares respectively, a producer working on per episode chapter creation who gets a 5 share, and
2021-03-30 20:40:36 +00:00
a single share (effectively 1%) fee to the Podcastindex.org API.
Since the value block is defined at the `<channel>` level, it applies to every podcast episode.
2021-02-25 21:20:23 +00:00
2021-04-19 03:35:20 +00:00
```xml
...
<channel>
<podcast:value type="lightning" method="keysend" suggested="0.00000015000">
<podcast:valueRecipient
name="Adam Curry (Podcaster)"
type="node"
address="02d5c1bf8b940dc9cadca86d1b0a3c37fbe39cee4c7e839e33bef9174531d27f52"
split="49"
/>
<podcast:valueRecipient
name="Dave Jones (Podcaster)"
type="node"
address="032f4ffbbafffbe51726ad3c164a3d0d37ec27bc67b29a159b0f49ae8ac21b8508"
split="46"
/>
<podcast:valueRecipient
name="Dreb Scott (Chapter Creation)"
type="node"
address="02dd306e68c46681aa21d88a436fb35355a8579dd30201581cefa17cb179fc4c15"
split="5"
/>
<podcast:valueRecipient
name="Podcastindex.org (Donation)"
type="node"
address="03ae9f91a0cb8ff43840e3c322c4c61f019d8c1c3cea15a25cfc425ac605e61a4a"
split="1"
fee="true"
/>
</podcast:value>
...
<item>...</item>
<item>...</item>
...
</channel>
2021-02-25 21:20:23 +00:00
```
2021-07-23 17:32:26 +00:00
2021-07-29 13:05:58 +00:00
To use Atomic Multipath Payments (AMP) instead of `keysend`, simply set the
payment `method` to `amp`:
```xml
...
<channel>
<podcast:value type="lightning" method="amp" suggested="0.00000015000">
...
</podcast:value>
</channel>
```
2021-07-23 17:32:26 +00:00
##### Example: `<Item>` Override
2021-07-23 17:43:23 +00:00
To set up different payment splits for individual episodes, a value block has to
be defined on the `<item>` level. This will override the value settings set on
the `<channel>` level.
The following example defines different value blocks for each episode in order
to include the guests as value recipients. Payments are split 50/50 between host
and guest.
2021-07-23 17:32:26 +00:00
```xml
...
<channel>
<podcast:value type="lightning" method="keysend" suggested="0.00000021000">
<podcast:valueRecipient
name="John Vallis (Host)"
type="node"
address="02a9cd2bca29dd7e29bdfdf485a8e78b8ccf9327517afa03a59be8f62a58792e1b"
2021-07-23 17:43:33 +00:00
split="100"
2021-07-23 17:32:26 +00:00
/>
</podcast:value>
...
<item>
2021-07-23 17:43:33 +00:00
<title>#00 - John's Solo Episode</title>
...
</item>
<item>
<title>#01 - John and Gigi</title>
2021-07-23 17:32:26 +00:00
<podcast:value type="lightning" method="keysend" suggested="0.00000021000">
<podcast:valueRecipient
name="John Vallis (Host)"
type="node"
address="02a9cd2bca29dd7e29bdfdf485a8e78b8ccf9327517afa03a59be8f62a58792e1b"
split="50"
/>
<podcast:valueRecipient
name="Gigi (Guest)"
type="node"
address="02e12fea95f576a680ec1938b7ed98ef0855eadeced493566877d404e404bfbf52"
split="50"
/>
</podcast:value>
...
</item>
<item>
2021-07-23 17:43:33 +00:00
<title>#02 - John and Paul</title>
2021-07-23 17:32:26 +00:00
<podcast:value type="lightning" method="keysend" suggested="0.00000021000">
<podcast:valueRecipient
name="John Vallis (Host)"
type="node"
2021-07-23 17:46:53 +00:00
address="02a9cd2bca29dd7e29bdfdf485a8e78b8ccf9327517afa03a59be8f62a58792e1b"
2021-07-23 17:32:26 +00:00
split="50"
/>
<podcast:valueRecipient
name="Paul Itoi (Guest)"
type="node"
address="03a9a8d953fe747d0dd94dd3c567ddc58451101e987e2d2bf7a4d1e10a2c89ff38"
split="50"
/>
</podcast:value>
...
</item>
...
</channel>
```