electronwall v0.4
⚡️🛡 Scripts and node explorer APIs
Programmable rules
electronwall has a Javascript engine called goja that allows you to set custom rules. Note that you can only use pure Javascript (ECMAScript), you can't import a ton of other dependcies like with web applications.
Rules are saved in the rules/
directory. There are two files, one for channel open requests ChannelAccept.js
and one for HTLC forwards HtlcForward.js
.
electronwall passes contextual information to the Javascript engine that you can use to create rich rules. See below for a list of objects that are currently supported.
Contextual information
electronwall now fetches data from 1ML.com and Amboss.space and provides this information to the rule script.
Here is one rather complex rule for channel accept decisions in ChannelAccept.js
for demonstration purposes:
// only channels > 0.75 Msat
ChannelAccept.Event.FundingAmt >= 750000 &&
// nodes with high 1ML availability score
ChannelAccept.OneMl.Noderank.Availability > 100 &&
// nodes with a low enough 1ML age rank
ChannelAccept.OneMl.Noderank.Age < 10000 &&
(
// only nodes with Amboss contact data
ChannelAccept.Amboss.Socials.Info.Email ||
ChannelAccept.Amboss.Socials.Info.Twitter ||
ChannelAccept.Amboss.Socials.Info.Telegram
) &&
(
// elitist: either nodes with amboss prime
ChannelAccept.Amboss.Amboss.IsPrime ||
// or nodes with high-ranking capacity
ChannelAccept.Amboss.GraphInfo.Metrics.CapacityRank < 1000 ||
// or nodes with high-ranking channel count
ChannelAccept.Amboss.GraphInfo.Metrics.ChannelsRank < 1000
)