Starting the Prism Plugin on Your Node
Lightning Prisms have been implemented as a CLN plugin.
We are going to jump right into how you can run ROYGBIV on your own CLN node (assuming that you already have a node up and running). This post will be geared towards the Bolt 12 Prism Plugin, but can be used generally for other plugins as well.
Dependencies
ROYGBIV is written in Python with the pyln-client library, so your node will need to have Python installed as well as the pyln-client library. You'll also need the plugin itself.
Plugin
The plugin can be found here. You just need `prism-plugin.py`, but feel free to clone the whole repo as well.
Python
Python just needs to be installed in the same environment as your node. This means that if you are running CLN on a server, simply install Python onto the server. Or, for example, if you are running CLN in a Docker container, make sure Python is installed there.
apt install python3
pyln-client
Once Python is installed, installing the library is as simple as:
apt install pip && pip install pyln-client
Okay, now that we've got the dependencies taken care of lets jump into actually running the plugin on your node.
Starting the Plugin
There are two options to start the plugin.
- Generally, you will want the plugin to start whenever your node starts
- Often for development, it's handy to manually stop and start the plugin
Auto Start
To make the plugin start when your node starts, it's as simple as adding the path to the plugin in your config file.
Config
Add to your node's config file:
plugin=/path/to/prism-plugin.py
experimental-offers
You can also add the plugin and enable offers in your startup command
Start Up Command
From the command line, when you start your node add the --plugin
flag. It would look something like this:
lightningd --plugin=/path/to/bolt12-prism.py --experimental-offers
Awesome, now your node is running and has exposed the RPC methods made available by the plugin.
But what if you are developing on the plugin? Well, if you make any changes to the plugin file, then those changes will not be reflected until you stop and start (aka restart) the plugin.
Manual Start
In order to stop and start the plugin you will need access to lightning-cli
. If you've followed the install instructions for CLN you should be all good to go!
lightning-cli getinfo
. This should return a JSON object (not an error 😁).Sometimes (if not specified in your config file), you will need to specify which directory your node is running from using the --lightning-dir
flag.
This would look something like this:
lightning-cli --lightning-dir=/path/to/lightning
Start Plugin
lightning-cli plugin start --plugin=/path/to/bolt12-prism.py
Stop Plugin
lightning-cli plugin stop bolt12-prism.py
lightning-cli plugin list
Again, this method of manually stopping and starting is generally for development purposes because the plugin needs to be restarted before any changes made are seen by the node.
ls | enter -s '
restart.sh
'
to auto restart whenever changes are made to your plugin file. See here.Development
Refer to plugin docs, especially the README in the testing directory.