Miles DeWitt

Web Monetization in PeerTube (Grant for the Web)

I've started a project to add Web Monetization to PeerTube with funding from the Grant for the Web. This is a short introduction to the project, which will be followed by more posts as progress is made. The project is planned to take three months. It was asked as part of the grant to make blog posts about the project; this is my first time writing blog posts and their quality is not guaranteed, but I'll try my best :).

What Web Monetization is, and how it benefits PeerTube🔗

Adding Web Monetization support to PeerTube allows viewers to seamlessly support the creators they watch in an efficient manner. If you are not familiar with Web Monetization, it is a draft standard for essentially streaming money over the internet. Many minuscule transactions are sent at intervals on the scale of seconds. It has become evident that many people want to support creators, and that many dislike ads. Web Monetization provides an viable alternative to ads as a funding model, and a way to directly support creators without the overhead of large transaction fees, minimum payment amounts, or manually managing such payments.


We could just choose a set cost-per-time and any viewers and creators that opt-in will transfer that amount as a video is viewed. And indeed, that simple case should be an option for viewers so they do not need to think about it. Coil, who is funding the grant, provides a service which currently does just this. The implementation in PeerTube is agnostic to the user agent and the account used to receive the funds. We of course want to support more complex use cases to fully leverage the protocol, and then can cut out those that don't show utility.

The most obvious parameter is to set a different rate per-creator. A user can opt to pay more for certain creators, or a creator could set a minimum price (note that full DRM is not in the scope of this project). A user could also set a default payment amount above or below a globally set default. For content that is pay-walled, the interface needs to be as seamless as possible. For prices below the user's default, there is no need for differentiation. If the price is higher, there is an icon indicating the cost, and the user must confirm the higher price which can be done per-video or per-uploader. A user can choose whether or not to pay again for repeated views of a video. An interesting extension to this is different tiers of payment.

If a creator has a sponsored video, they could choose to specify a pay-tier above which the user will skip the sponsor segments. For example, the video could be free to view, but paying about a certain cost-per-time will cause playback to skip the portions of the video where the sponsor occurs. This necessitates implementing a table of contents feature, which can also be used for skipping around a video, or automatically skipping intros and outros a la SponsorBlock.

Note that the protocol currently does not support the website requesting a level of payment, however it seems like a reasonable feature for it to support in the future.


PeerTube has a plugin system powerful enough to support Web Monetization. Instance admins are able to install the plugin through a button in the settings interface. Once the plugins is installed, each creator adds their payment pointer to their account or individiual videos.

Next steps🔗

This week I created a proof of concept which simply sends money to a hard-coded address when a video is viewed. Next week I'll implement the basic creator settings to be able to set a payment pointer and enable or disable monetization. There will be a set of account-wide settings which can then be overidden on a per-video basis, or per group of videos.

I will also make another post going into detail about the current implementation. The goal is to describe how one would create a basic Web Monetization implementation in general, as well as how to make a PeerTube plugin. After that I will post updates once every two weeks.