Skip to content

Instantly share code, notes, and snippets.

@tyzbit tyzbit/README.md
Last active Jun 6, 2018

Embed
What would you like to do?
The Lightning Network (Mainnet)

Forked from vasturiano, with dataset and minor other changes.

The Lightning Network as seen from my node at about 00:30 UTC on June 7 2018. This data is updated manually, not automatically.

Nodes are colored according to settings set by the node operators. Nodes are sized according to the total amount of BTC in channels they have open. Lines are channels between nodes. Nodes that fly off into the background don't have any channels my node knows about. Line colors are representative of the channel capacity, but is colored dynamically.

Click on a node to see its address info and capacity.

function getGraphDataSets() {
const loadBlocks = function(Graph) {
qwest.get('graph.json').then((_, data) => {
//data.nodes.forEach(node => { node.name = `${node.alias?node.alias+': ':''}${node.pub_key || node.id}` });
data.nodes.forEach(node => {
node.name = `${node.alias}`
var capacity = 0;
var links = 0;
// check each link, and if it connects to the node, up the node's capacity.
node.size = data.links.forEach(link => {
if ( (node.id == link.source) || (node.id == link.target) ) {
links = links + 1;
capacity = capacity + link.capacity;
}
});
// capacity is in BTC
node.capacity = capacity/100000000;
node.averagechansize = (node.capacity/links);
node.links = links;
// size indicative of average channel size
node.size = node.capacity*100
});
Graph
.cooldownTicks(300)
.cooldownTime(20000)
.nodeColor('color')
.nodeVal('size')
.onNodeClick(function(node) {
document.getElementById('graph-data-description').innerHTML = `Total value of this node's channels: ${node.capacity} BTC. Average channel size: ${node.averagechansize} BTC. Total number of channels: ${node.links}.`
node.addresses.forEach(function(address) {
document.getElementById('graph-data-description').innerHTML += "<font color=\"green\" size=\"4em\"><br><b>" + node.alias + "</b>: " + node.id + "@" + address.addr + "</font>"
})
if ( node.addresses.length < 1 ) {
document.getElementById('graph-data-description').innerHTML += "<font color=\"red\" size=\"4em\"><br><b>" + node.alias + "</b> (" + node.id + ") is not advertising any addresses</font>"
}
})
.linkAutoColorBy('capacity')
.linkLabel('capacity')
.linkOpacity(0.4)
.forceEngine('ngraph')
.graphData(data);
});
};
loadBlocks.description = "<em>Lightning Mainnet</em> data (<a href='https://gist.github.com/tyzbit/93bb73fde487210974977ba29e04b2ed'>https://gist.github.com/tyzbit/93bb73fde487210974977ba29e04b2ed</a>)";
return [loadBlocks];
}
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.