https://github.com/kulpreet/lightning-network-graph-analysis
Analyse the lightning network graph
https://github.com/kulpreet/lightning-network-graph-analysis
analysis boost-graph-library lightning-network
Last synced: 19 days ago
JSON representation
Analyse the lightning network graph
- Host: GitHub
- URL: https://github.com/kulpreet/lightning-network-graph-analysis
- Owner: kulpreet
- License: mit
- Created: 2018-08-13T20:50:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T17:31:07.000Z (over 5 years ago)
- Last Synced: 2025-03-27T22:42:40.455Z (about 1 month ago)
- Topics: analysis, boost-graph-library, lightning-network
- Language: C++
- Size: 3.99 MB
- Stars: 19
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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-metricsThe 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](https://github.com/kulpreet/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 |