I am interested in what the wealth distribution is of one specific cryptocurrency. To find that out, I first used an open source block parsing tool (https://github.com/znort987/blockparser) and edited it so that the parameters would work for the Neblio blockcahin. More details on Neblio here: https://nebl.io/.
After some trials in getting to the working block parser, I was able to export a .csv file of all balances from all public addresses on the blockchain.
This chart shows a histogram of a the balances of all accounts. Originally, I had the scale from 0 to 1,000,000. It turns out that 85% Of addresses have <500 tokens, therefore I moved the bins in to only show the folks with 500 to 10,000 tokens to show the distribution of those that have a significant amount.
The resulting view shows that more people have fewer coins, but once you reach 5000 or so coins, the amount of holders of each amount begins to level out. The distribution of holders declines exponentially as the amount of coins increases.
Note: This was built using blockbuilder and forked as follows: forked from d3noob's block: Simple histogram using v4 forked from jwang1616's block: Simple histogram using v4
xxxxxxxxxx
<meta charset="utf-8">
<style> /* set the CSS */
rect.bar { fill: steelblue; }
</style>
<body>
<!-- load the d3.js library -->
<script src="//d3js.org/d3.v4.min.js"></script>
<script>
// set the dimensions and margins of the graph
var margin = {top: 30, right: 30, bottom: 60, left: 70},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
// set the ranges
var x = d3.scaleLinear()
.domain([500,10000])
.rangeRound([0, width]);
var y = d3.scaleLinear()
.range([height, 0]);
// set the parameters for the histogram
var histogram = d3.histogram()
.value(function(d) { return d.bal; })
.domain(x.domain())
.thresholds(x.ticks(20));
// append the svg object to the body of the page
// append a 'group' element to 'svg'
// moves the 'group' element to the top left margin
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
// Get and plot the data
d3.csv("balances_blk_143802.csv", function(error, data) {
if (error) throw error;
// format the data
data.forEach(function(d) {
d.bal = +d.Balance;
});
// group the data for the bars
var bins = histogram(data);
// Scale the range of the data in the y domain
y.domain([0, d3.max(bins, function(d) { return d.length; })]);
// append the bar rectangles to the svg element
svg.selectAll("rect")
.data(bins)
.enter().append("rect")
.attr("class", "bar")
.attr("x", 1)
.attr("transform", function(d) {
return "translate(" + x(d.x0) + "," + y(d.length) + ")"; })
.attr("width", function(d) { return x(d.x1) - x(d.x0) -1 ; })
.attr("height", function(d) { return height - y(d.length); });
// add the x Axis
svg.append("g")
.attr("transform", "translate(0," + height + ")")
.call(d3.axisBottom(x))
//x axis test
svg.append("text")
.attr("transform",
"translate(" + (width/2) + " ," +
(height + margin.top + 20) + ")")
.style("text-anchor", "middle")
.text("Number of Coins");
// add the y Axis
svg.append("g")
.call(d3.axisLeft(y))
//y axis text
svg.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 0 - margin.left)
.attr("x",0 - (height / 2))
.attr("dy", "1em")
.style("text-anchor", "middle")
.text("Number of Holders");
// title text
svg.append("text")
.attr("x", (width / 2))
.attr("y", 0 - (margin.top / 2))
.attr("text-anchor", "middle")
.style("font-size", "16px")
.style("text-decoration", "underline")
.text("Neblio Token Hodler Distribution");
});
</script>
</body>
https://d3js.org/d3.v4.min.js