To run the ln-history platform in real-time you need to have one (or multiple) Core Lightning nodes - with the gossip-publisher-zmq Core Lightning Plugin setup - running.
The gossip-publisher-zmq plugin monitors the gossip_store file every Core Lightning node manages by itself to store the collected gossip messages.
The plugin is able to find a valid offset in the gossip_store by itself and starts to publish collected gossip messages via a ZeroMQ PUB socket.
Any service can connect to this pub socket which will be in this case the gossip-syncer.
Every gossip message will get parsed by utilizing the lnhistoryclient package.
Every message of the gossip-publisher-zmq pub socket will have the format of the PluginEventMetadata:
Clone the plugin repository into your /plugins directory of your node using the following command:
Go inside the directory and install the necessary dependencies in your virtual environment
First create the virtual environment using the following command
This creates a new folder called .venv which will contain the dependencies for the gossip-publisher-zmq plugin
Next we activate this environment by executing the following command
Lastly we install the dependencies as defined in the requirements.txt using pip from our virtual environment.
To use the virtual environment we need to edit the first line of the main.py file to match the newly created virtual environment.
Substitute the <your-user> with your user and update the first line with the following shebang.
Add this line to your lightning.conf
The plugin can be configured with the following parameters
| ENV_NAME | Default Value | Type | Comment |
|---|---|---|---|
| DEFAULT_ZMQ_HOST | 127.0.0.1 | str | Your local machine |
| DEFAULT_ZMQ_PORT | 5675 | int | Port used for ZMQ connection |
| DEFAULT_SENDER_NODE_ID | - | str | Any string possible; if empty, the plugin identifies the node_id itself |
| POLL_INTERVAL | 1.0 | float | Time in seconds the plugin waits before retrying (e.g. checking new gossip) |
| START_AT_BYTE | 1 | int | Offset (in bytes) in the gossip_store file |
The cloned repository contains a .env.example which can be copied and renamed to .env
In this file update the environment variable however you like.
🔐 Important: Never commit .env files containing credentials to version control.
START_AT_BYTE valueThe plugin goes from the start to the end through the gossip_store file. If you only want to publish newly collected messages and not every collected message, please set this value to something close to the end.
You could take a look at the file size of the gossip_store file in bytes, subtract 5000 from that and set the START_AT_BYTE to that value.
The plugin will continue from that point until it finds a valid gossip message and starts to publish all following gossip messages.
Just restart the Core Lightning node and your plugin should be running
The plugin provides two methods that can be called at any time to verify if the plugin is running correctly.
You can check at any time the current status of the plugin by executing the following command.
Additionally you can have a look at the last 100 processed messages using this command