clplug: Create Core Lightning Plugins

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Library to create plugins to extend the functionality of Core Lightning daemon.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.2.0, 0.3.3.0, 0.4.0.0, 1.0.0.0
Change log CHANGELOG.md
Dependencies aeson (<2.1), attoparsec (<0.15), base (>=4.7 && <5), bytestring (<0.12), clplug, conduit (<1.4), containers (<0.7), directory (<1.4), fgl (<5.8), fmt (<0.7), format-numbers (<0.2), lens (<5.2), lens-aeson (<1.3), mtl (<2.3), network (<3.2), text (<1.3), time (<1.12) [details]
License BSD-3-Clause
Copyright 2023
Author Taylor Singleton-Fookes
Maintainer taylorsingletonfookes@live.com
Category bitcoin, lightning, plugin
Home page https://github.com/AutonomousOrganization/clplug#readme
Bug tracker https://github.com/AutonomousOrganization/clplug/issues
Source repo head: git clone https://github.com/AutonomousOrganization/clplug
Uploaded by autonomousorganization at 2023-02-22T20:17:46Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for clplug-0.1.0.0

[back to package description]

Core Lightning Plug

Core lightning is a daemon (lightningd) that operates payment channels that allow you to send and receive bitcoin nearly instantly, with nearly zero fees with a high level of privacy. It does not compromise on any of the strengths of layer 1 bitcoin: no censorship, free speech, individual sovereignty, and impossible debasement. In fact it strengthens bitcoin because it encourages the operation of fully validating nodes, lightningd requires bitcoind. Clplug is a Haskell library that allows you to easily create extensions (called plugins) that extend or augment its functionality.

To create a plugin you only need to define three arguments:

The transformer stack contains:

Several examples are included that are intended to be useful for (d)evelopers and node (o)perators

Operators: the examples require option allow-deprecated-apis=false. To install a plugin you must: - clone this repository - stack build - move or symlink the created executable file into the lightning directory (by default: .lightning/plugins)

The main exports from the Library are Control.Plugin, Control.Client, and Data.Lightning. An upload and link to hackage is pending. This is a basic usage example:

{-# LANGUAGE 
      OverloadedStrings 
    , FlexibleContexts 
    , ViewPatterns
    , RecordWildCards
#-} 

module Main (main) where

-- from clplug
import Data.Lightning 
import Control.Plugin  
import Control.Conduit
--

import Data.Conduit 
import Data.Aeson
import Data.Text

main = plugin manifest appState app

manifest :: Value 
manifest = object [
      "dynamic" .= True
    , "subscriptions" .= (["channel_opened"] :: [Text] ) 
    , "options" .= ([]::[Option])
    , "rpcmethods" .= ([]) 
    , "hooks" .= ([]::[Hook])
    , "featurebits" .= object [ ]
    , "notifications" .= ([]::[Notification])
    ] 

app :: PluginApp () 
app (Nothing, "channel_opened", fromJSON -> Success (ChannelOpened {..})) = do
    doublespend funding_txid 
    where doublespend _ = pure ()

appState = pure () 

Useful areas of exploration and research are:

Donation bitcoin addr: bc1q5xx9mathvsl0unfwa3jlph379n46vu9cletshr

lightning only scales bitcoin if people run nodes