Skip to content

Podcasting 2.0 features for Core Lightning

License

Notifications You must be signed in to change notification settings

cnixbtc/cln-podcast-payments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡️🎙 cln-podcast-payments

A Core Lightning plugin to work with streaming payments, boosts, and boostagrams for Podcasting 2.0.


This is a simple plugin for Core Lightning that enables you to extract podcast payment metadata received from podcasting apps such as Breez or Fountain.

💡 Why

Core Lightning currently doesn't persist arbitrary TLVs such as the ones sent by Podcasting 2.0 apps. This plugin is intended to provide a workaround until Core Lightning adds native support for this. Keep an eye on ElementsProject/lightning#4470 for more information

🏎 TL;DR

This plugin extends lightning-cli with a podcastpayments command that fetches past streams, boosts, and boostagrams received from Podcasting 2.0 apps.

$ lightning-cli podcastpayments
{
   "count": 1,
   "payments": [
        {
            "label": "keysend-1664891872.800196000",
            "amount": "21000msat",
            "info": {
                "podcast": "Closing the Loop",
                "episode": "#01 - Gigi: Introduction to Closing the Loop",
                "action": "boost",
                "time": "00:00:31",
                "feedID": "4058673",
                "app_name": "Breez",
                "value_msat_total": "21000",
                "message": "yo!"
            }
        }
    ]
}

🔧 Installation

To run, the plugin needs Python 3 with pyln-client and SQLAlchemy installed.

pip install pyln-client
pip install SQLAlchemy

Make sure those are installed in your Python environment. Use a virtual environment to not bloat your global Python installation.

Then, to activate the plugin:

1️⃣ Clone this repo:

git clone https://github.com/cnixbtc/cln-podcast-payments.git

2️⃣ Run lightningd with the --plugin option and specify the path to podcast_payments.py:

lightningd --plugin=/path/to/cln-podcast-payments/podcast_payments.py

More information on lightningd plugins can be found in the docs.

💻 Usage

Once installed, the plugin will run in the background and persist all podcast payment information to a local sqlite3 database. More specifically, it will persist all TLV values with type 7629169 according to bLIP 10. The location of this database can be controlled using the optional --podcastpayments-dir option on lightningd:

lightningd --plugin=/path/to/cln-podcast-payments/podcast_payments.py --podcastpayments-dir=/path/to/desired/db/location

By default, the database will be in: $HOME/.lightning/bitcoin/podcast-payments.

⚠️ Because TLVs are not persisted by Core Lightning, the plugin will only be able to persist payment information from payments that arrived after it was installed. At the moment, there's no way to access payment information associated with historical payments. This might change in the future, though. For more information see ElementsProject/lightning#4470.

Extract Payment Information: podcastpayments

This command fetches all podcast payment information that was persisted in the database since running the plugin. The value of the info property may change depending on what the value of the corresponding TLV that was sent by the Podcasting 2.0 app.

$ lightning-cli podcastpayments
{
   "count": 1,
   "payments": [
        {
            "label": "keysend-1664891872.800196000",
            "amount": "21000msat",
            "info": {
                "podcast": "Closing the Loop",
                "episode": "#01 - Gigi: Introduction to Closing the Loop",
                "action": "boost",
                "time": "00:00:31",
                "feedID": "4058673",
                "app_name": "Breez",
                "value_msat_total": "21000",
                "message": "yo!"
            }
        }
    ]
}