5

I'm looking at the docs, and I see they have lightning-notifications, but it looks like you can't configure where they go, and you can't trigger a shell script with them. Does this mean I have to have all notifications sent to a shell script and filter them, or is there a method/configuration I'm overlooking?

4

You can trigger a shell script with them, and more.
This is related to the plugin functionalities provided by lightningd and not bitcoind.

lightningd allows you to run plugins to deeply modify its behaviour, or extend its possibilities. It idiomatically (small and robust core, customizable functionalities) relies a lot on them and therefore directed the event mechanisms toward them as well.
This is the reason why you don't see [*]notify= startup options for lightningd.

To use lightningd's notifications you have to write a plugin, but it can be a pretty simple script. For example, here is the handler of the invoice_payment notification in the HelloWorld showcase plugin:

@plugin.subscribe("invoice_payment")
def on_payment(plugin, invoice_payment, **kwargs):
    plugin.log("Received invoice_payment event for label {label}, preimage {preimage},"
               " and amount of {msat}".format(**invoice_payment))

The previous example used the Python library, but the communication is pretty straightforward (JSONRPC 2.0) so you can technically use a shell script :-).

For reference, there is an available and curated list of community plugins.

1
  • Ah, I understand now. It's not there because the ability to add new functionality through plugins is instead.
    – Fibericon
    Nov 4 '20 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.