c-lightning Plugins 01: The Summary Plugin

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

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.

Overview

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

Core Lightning (previously c-lightning) is a lightweight, highly customizable and standard compliant implementation of the Lightning Network protocol.

© 2023 Core Lightning
All rights reserved.

Discussion Forum

The official Core Lightning forum is coming soon!

BuildonL2 Community

The official BuildOnL2 community lives at community.corelightning.org. Join us and build the future of bitcoin on lightning.

Mailing List

For general discussions about CLN implementation, use c-lightning@lists.ozlabs.org. For the Lightning Network, use lightning-dev@lists.linuxfoundation.org

Telegram

Community-driven telegram group where most of the node operators hang out. Go to https://t.me/lightningd to join.

Discord

Community-driven discord server where the devs flock together. Go to https://discord.gg/w27fMFESMN to join.

Internet Relay Chat

Don't hesitate to reach out to us on IRC at #lightning-dev @ libera.chat, #c-lightning @ libera.chat.