c-lightning Plugins 01: The Summary Plugin
Your Lightning node at a glance
Lightning Network

c-lightning Plugins 01: The Summary Plugin

Rusty Russell

This is the first part of our c-lightning plugins series, where we showcase individual plugins built by Blockstream and the Lightning community. For an up-to-date list of all the articles available in the series, head to our beginner’s introduction to c-lightning plugins.


The Summary Plugin

I run three main Lightning nodes, and when I log into my node I want to see at a glance: how many satoshis does it have available onchain (in case I want to open a new channel), how many channels does it have, and how balanced are they? c-lightning has plenty of commands which flood you with all the information on a particular topic, but I wanted a simple summary!

So my first real plugin in Python was called “summary”. It provides a single command, “summary”; I run it on all my nodes, and lightning-cli summary is the first command I run when I log in.

The top of the output is the cut & paste-able address, if you want to tell people to connect to you. It tells you about your onchain funds, and uses the API provided by bitcoinaverage.com to convert your node balances to fiat: in my case, three unspent outputs worth about $60:

The next lines are a summary of your channels and peers: I try to connect my test node to many nodes for reliability testing. 33 channels, 27 currently connected, and two nodes just gossiping, with a total capacity of around 0.06BTC:

But the most useful part of the summary is the ASCII-based graph of your channel balances (too wide for Medium, so here’s an image):

This is especially useful if you use other plugins to rebalance, or just want to see how many others have created channels to your node recently!

Technical Details

The plugin itself is 253 lines of python, including some shims for backwards compatibility with now-obsolete versions of c-lightning. It uses the python-requests module to get the price every six hours in a thread, but otherwise just uses existing low-level c-lightning APIs and collates the results every time it is called.

It’s a great plugin to read if you want to know where to start to produce your own “my node status” plugin: contributions are more than welcome!

Get Started

Here’s the quick-start install for c-lightning 0.7.2 and above, which downloads from our plugins GitHub repo, links it into the plugins subdirectory, then tells c-lightning to look for it:

And for a primer on developing on c-lighting, check out a recording of my latest webinar on Youtube.

This was the first showcase in a series on c-lightning plugins. For a regularly updated list of available articles, head to our introduction to c-lightning plugins.

Note: This blog was originally posted at https://medium.com/blockstream/c-lightning-plugins-01-the-summary-plugin-64db922ef7fa