Plugins for c-lightning
Community curated plugins for c-lightning.
Available plugins
| Name | Short description |
|---|---|
| autopilot | An autopilot that suggests channels that should be established |
| autoreload | A developer plugin that reloads a plugin under development when it changes |
| donations | A simple donations page to accept donations from the web |
| graphql | Exposes the c-lightning API over graphql |
| lightning-qt | A bitcoin-qt-like GUI for lightningd |
| monitor | helps you analyze the health of your peers and channels |
| persistent-channels | Maintains a number of channels to peers |
| probe | Regularly probes the network for stability |
| prometheus | Lightning node exporter for the prometheus timeseries server |
| rebalance | Keeps your channels balanced |
| reckless | An experimental plugin manager (search/install plugins) |
| sendinvoiceless | Sends some money without an invoice from the receiving node. |
| sitzprobe | A Lightning Network payment rehearsal utility |
| summary | Print a nice summary of the node status |
| zmq | Publishes notifications via ZeroMQ to configured endpoints |
Installation
To install and activate a plugin you need to stop your lightningd and restart it
with the plugin argument like this:
lightningd --plugin=/path/to/plugin/directory/plugin_file_name.py
Notes:
- The
plugin_file_name.pymust have executable permissions:chmod a+x plugin_file_name.py - A plugin can be written in any programming language, as it interacts with
lightningdpurely using stdin/stdout pipes.
Automatic plugin initialization
Alternatively, especially when you use multiple plugins, you can copy or symlink
all plugin directories into your ~/.lightning/plugins directory. The daemon
will load each executeable it finds in sub-directories as a plugin. In this case
you don't need to manage all the --plugin=... parameters.
pyln
To simplify plugin development you can rely on pyln-client for the plugin
implementation, pyln-proto if you need to parse or write lightning protocol
messages, and pyln-testing in order to write tests. These libraries can be
retrieved in a number of different ways:
- Using
piptools:pip3 install pyln-client pyln-testing - Using the
PYTHONPATHenvironment variable to include your clightning's shippedpyln-*libraries:
export PYTHONPATH=/path/to/lightnind/contrib/pyln-client:/path/to/lightnind/contrib/pyln-testing:$PYTHONGPATH
Writing tests
The pyln-testing library provides a number of helpers and fixtures to write
tests. While not strictly necessary, writing a test will ensure that your
plugin is working correctly against a number of configurations (both with and
without DEVELOPER, COMPAT and EXPERIMENTAL_FEATURES), and more
importantly that they will continue to work with newly release versions of
c-lightning.
Writing a test is as simple as this:
from pyln.testing.fixtures import *
def test_summary_start(node_factory):
l1 = node_factory.get_node(options=pluginopt)
s = l1.rpc.summary()
assert(s['network'] == 'REGTEST') # or whatever you want to test
Tests are run against pull requests, all commits on master, as well as once
ever 24 hours to test against the latest master branch of the c-lightning
development tree.
Additional dependencies
Additionally, some Python plugins come with a requirements.txt which can be
used to install the plugin's dependencies using the pip tools:
pip3 install -r requirements.txt
Note: You might need to also specify the --user command line flag depending on
your environment.
More Plugins from the Community
Plugin Builder Resources
- Description of the plugin API
- C Plugin API by @rustyrussell
- Python Plugin API & RPC Client (PyPI) by @cdecker and a video tutorial by @renepickhardt
- Go Plugin API & RPC Client by @niftynei
- C++ Plugin API & RPC Client by @darosior
- Javascript Plugin API & RPC Client by @darosior