Skip to main content

A decorator library for Flask endpoints, to create CLN invoices

Project description

Charge Sats

A very simple Python library to add Pay-Per-View technology to a Flask endpoint.

Here's a quick example of how to use it. Note that it assumes the CLN node is running on/within reach of the Flask server.

from flask import Flask
from chargesats import Charger


app = Flask(__name__)


# Init the charger!
lnrpc = '/home/runner/.lightning/regtest/lightning-rpc'
Charger.init(lnrpc, 'secret do not share')


@app.route('/')
# Use the charger to charge some sats for an endpoint!
@Charger.charge(amount="100sat")
def index():
    return 'This cost you 100 sats\\n'


app.run(host='0.0.0.0', port=81)

Pending Tasks

  • Uses runes as tokens for repeat calls
  • Add ability to use commando

Authors

@niftynei (niftynei@gmail.com) is the responsible party.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chargesats-0.1.1.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

chargesats-0.1.1-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page