lightningd / clightningjs Goto Github PK
View Code? Open in Web Editor NEWC-lightning plugins in Javascript
License: MIT License
C-lightning plugins in Javascript
License: MIT License
Hey --
I am trying to write a plugin for my C-Lightning node in Javascript and came across this library.
I tried to get the Hello World example up and running but I am struggling a bit.
My first question (and this might be stupid) is do I need node and npm installed on the device that my node is running on? I assume yes, but want to make sure.
Once that's cleared, I assume I can clone my repo, npm install, and then run lightningd --plugin=/data/lightning/plugins/clightning-plugin-sandbox
, correct?
Thank you!
Hi
I have noticed the following error in c-lightning log, when I am running my js api server as a plugin. Not able to replicate the scenario, which caused this, but thought to report, in case you want to take a look.
Please note, once this error is encountered, c-lightning aborts.
My project: https://github.com/saubyk/c-lightning-REST
events.js:186
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:150:25)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:768:11)
at Socket._write (net.js:780:8)
at doWrite (_stream_writable.js:428:12)
at writeOrBuffer (_stream_writable.js:412:5)
at Socket.Writable.write (_stream_writable.js:302:11)
at Plugin.writeJsonrpcNotification (/REDACTED/node_modules/clightningjs/src/plugin.js:115:8)
at /REDACTED/node_modules/clightningjs/src/plugin.js:101:12
at Array.forEach (<anonymous>)
Emitted 'error' event on Socket instance at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:443:5)
at onwrite (_stream_writable.js:470:5)
at internal/streams/destroy.js:49:7
at Socket.dummyDestroy [as _destroy] (internal/process/stdio.js:7:3)
at Socket.destroy (internal/streams/destroy.js:37:8)
at afterWriteDispatched (internal/stream_base_commons.js:150:17)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:768:11)
at Socket._write (net.js:780:8) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
Abort trap: 6
When adding a plugin option of integer type with a default value of 0, the plugin evaluates this as false and the plugin is killed. The following line is where the error arises: https://github.com/lightningd/clightningjs/blob/master/src/plugin.js#L131. This seems to arise since the clightning v0.9.3 release.
Probably it's better to check explicitly for null values?
Hi,
I build a plugin using clightningjs
package that subscribe to forward_event
notifications, but the plugin is notify only about the first payment routed through the node that runs the plugin. After the first routed payment the script is not running.
This is the plugin code:
listenPlugin.subscribe('forward_event');
listenPlugin.notifications.forward_event.on('forward_event', (params) => {
if ( params.forward_event.status == "settled" ) {
fs.writeFile('log', JSON.stringify(params.forward_event), () => {});
}
});
listenPlugin.start();
And I'm running my c-lightning (v0.8.0) node like this: lightningd --plugin="/home/ln/forward-notify.js"
Any idea way?
Thanks.
We definitely need to add a test suite, people are using this and I still shamefully test new updates by-hand with a regtest and the plugins in test/.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.