Skip to content

kulpreet/lightning-network-graph-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightning Network Graph Analysis

Analyse the lightning network graph to find articulation points.

This repo builds a binary that can take a GraphML representation of lightning network graph to generate data points about node centrality, number of articulation points and LN nodes sorted by centrality. These data points are then accessed by a front end to plot various charts. The front end is source code is at https://github.com/kulpreet/ln-metrics

The binary generated here accepts LN graph represented as GraphML. https://github.com/lightningnetwork/lnd has a cli called lncli, that can dump the current LN graph as a json file using lncli describegraph.

The json from describegraph is piped through lightning-network-graphxml before being processed by the binary generated by this repo. lightning-network-graphxml converts the json from describegraph into GraphML syntax that can be then imported into Boost Graph Library.

Metrics

For now, we compute centrality, number of biconnected components and the number of articulation points. We also output a list of all LN nodes ordered by node centrality.

Results are meant to be published on a daily metrics page. This page used to be up on lnmetric.opdup.com.

Requirements

Boost Graph Library, version 1.62.0 or higher

Running

make

./readgraph --help

./readgraph --input [inputfile.xml] --outdir [dirname]

The repo includes some dumps from lncli describe graph in the data directory. So you can try it out by:

./readgraph --input data/20180824_120001.xml --outdir /tmp/

This will generate a bunch of csv files:

File CSV Header Notes
/tmp/20180824_120001.all_ap.csv alias,degree,pub_key List all nodes by degree
/tmp/20180824_120001.centrality.csv alias,centrality,pub_key Lists all nodes in decreasing order of node centrality
/tmp/20180824_120001.key_ap.csv alias,num components,degree,pub_key Lists top nodes that are the articulation points in the graph. Also shows how many components each articulation point connects
/tmp/all_ap_stats.csv -- Lists number of components and the number of articulation points in the graph by timestamp
/tmp/cpd.csv -- Lists the LN graph's Central Point Dominance by timestamp
/tmp/key_ap_stats.csv -- Filters all_ap_stats by including only those nodes that connect two or more components with at least 1 node in each

Releases

No releases published

Packages

No packages published