Skip to content

joelklabo/nostr-control

Repository files navigation

nostr-control

Formatter Tests

Planned Features:

  • Disable events
  • Only settled forwards
  • Channel summary
  • Routing summary
  • NWC (NIP-47, Nostr Wallet Connect)

Description

nostr-control is a Core Lightning plugin that allows you talk to your node over Nostr DM. It also will send you events from your node over Nostr DMs.

Requirements

Tested with Core Lightning v23.02.2 and Node 18. nostr-control uses the sql lightning-cli method so any version that supports that should work.

Screenshots

Info Channel Summary Create Invoice Pay Invoice Get Address See Forwards New Blocks (etc.)
IMG_2262 IMG_2348 IMG_2258 IMG_2352 IMG_2261 IMG_9AF1D5254260-1 IMG_2258

What can I do with it?

When you first set up nostr-control you will start recieving DMs from your node about events that are happening. By default you will receive all events, but you can change this in the config file.

The events you can receive are:

  • channel_opened
  • channel_open_failed
  • channel_state_changed
  • connect
  • disconnect
  • invoice_payment
  • invoice_creation
  • forward_event
  • sendpay_success
  • sendpay_failure
  • coin_movement
  • balance_snapshot
  • block_added
  • openchannel_peer_sigs
  • shutdown

The most interesting thing about nostr-control is that you can communicate with your node. You can respond to it in your DMs and get information about your node. /help will give you a list of commands you can use.

Available Commands:

  • /help - Get a list of commands
  • /info - Get information about your node
  • /channels - Get information about your channels
  • /funds - Get information about your funds
  • /invoice - Create an invoice (pass amount_sats, label, and description)
  • /pay - Pay an invoice (pass bolt11)
  • /address - Get a new address (Bech32)
  • /donate - See how you can donate to the project
  • /issues - Open a GitHub issue
  • /verbose - show everything (including failed forwards)
  • /quiet - show only successful forwards (and payment related events)
  • /silent - show no notifications
  • /version - see the version of nostr-control you are running

How do I set it up?

nostr-control uses Node.js and npm. You can install them from here.

  1. Clone the repo into your plugins directory (DO NOT RUN npm install packages are checked in and there is a modification needed for this to run.)
  2. Set up a config file (config.json) in this project's directory (see below)
  3. Register the plugin with lightningd (https://docs.corelightning.org/docs/a-day-in-the-life-of-a-plugin)

Config File

nostr-control needs some Nostr information to work. Specifically these items:

Required

  • relay - The relays you want to send events to
  • bot_secret - The account that will be sending you DMs
  • your_pubkey - Your pubkey so you will receive the events

Optional

  • verbosity - How much information you want to receive (see above)
  • show_failed_forwards - Whether or not to show failed forwards (see above)

There is an example config in the root directory example-config.json it looks like this. Input your information there and nostr-control will pick it up.

{
  relay: "some_relay",
  bot_secret: "some_secret_key_hex",
  your_pubkey: "your_pub_key_hex",
  verbosity: "verbose",
  show_failed_forwards: true
}

nostr-control also keeps track of it's own settings so you can update things on the fly. Create your config.json in the root directory and it will be picked up.

You probably won't need to change that but that's where things you set while running will be stored.

How do I get my bot secret?

Just create an account on any Nostr app and use the secret key (hex). You can also update the profile picture etc. this way.

Contribute ( please do )

PRs and Issues are welcome. Follow me on Nostr npub19a86gzxctwtz68l8zld2u9y2fjvyyj4juyx8m5geylssrmfj27eqs22ckt or leave me a tip at my lightning address: joel@klabo.blog. Can also leave a tip on my site: Klabo.blog

About

A CLN Plugin you can interact with over Nostr DM

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published