arnaucube
arnaucube/goBlockchainDataAnalysisPublic Self-hosted repository
fixed address tree concurrent generation algorithm
arnaucode idoctnef@openmailbox.org
Tue, 15 Aug 2017 09:36:17 +0200
commit

ff774543e827888b89feedbe09ea3f39c172d296

parent

42bfe7cda1e0d8b36fcd572fb26218e4eab718ae

M README.md → README.md

@@ -1,6 +1,13 @@

# goBlockchainDataAnalysis blockchain data analysis, written in Go +#### Not finished - ToDo list +- Backend + - Network Address generation avoiding infinite relation loops + - Sankey Address generation without loops +- Frontend + - After Sankey visualization, go to Network Address visualization and render without Sankey dots + ### Install 1. Nodejs & NPM https://nodejs.org/ --> to serve the web, not necessary if the web files are in a webserver

@@ -74,6 +81,9 @@

### Some screenshots +![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/goBlockchainDataAnalysis00.png "goBlockchainDataAnalysis") + +![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/goBlockchainDataAnalysis06.png "goBlockchainDataAnalysis") ![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/goBlockchainDataAnalysis05.png "goBlockchainDataAnalysis")
M addressTree.go → addressTree.go

@@ -6,6 +6,8 @@

"gopkg.in/mgo.v2/bson" ) +var upLevelEdge EdgeModel + func upTree(address string, network NetworkModel) NetworkModel { var upNetwork NetworkModel

@@ -31,9 +33,16 @@ nodes := []NodeModel{}

err := nodeCollection.Find(bson.M{"id": }).All(&edges) check(err) */ + edgeUpCheck := EdgeModel{} + err := edgeCollection.Find(bson.M{"to": e.From}).One(&edgeUpCheck) + check(err) + //need to be fixed when there is a bucle between the addresses (A-->B, B-->C, C-->A) fmt.Println(e.From + " - " + e.To) - if e.From != e.To { + //if e.From != e.To && e.From != upLevelEdge.To && e.To != upLevelEdge.From { + //if e.From != e.To { + if edgeInEdges(network.Edges, edgeUpCheck) == false { + upLevelEdge = e upNetwork = upTree(e.From, network) for _, upN := range upNetwork.Nodes { if nodeInNodes(network.Nodes, upN) == false {
M exploreBlockchain.go → exploreBlockchain.go

@@ -26,7 +26,7 @@ check(err)

block, err := client.GetBlockVerbose(bh) check(err) - if block.Height > 0 { + if block.Height > config.StartFromBlock { for k, txHash := range block.Tx { if k > 0 { realBlocks++
M mongoOperations.go → mongoOperations.go

@@ -120,7 +120,7 @@ return false

} func edgeInEdges(edges []EdgeModel, edge EdgeModel) bool { for _, e := range edges { - if e.From == edge.From && e.To == edge.To { + if e.From == edge.From && e.To == edge.To && e.Label == edge.Label && e.BlockHeight == edge.BlockHeight { return true } }
M readConfig.go → readConfig.go

@@ -6,12 +6,13 @@ "io/ioutil"

) type Config struct { - User string `json:"user"` - Pass string `json:"pass"` - Host string `json:"host"` - Port string `json:"port"` - GenesisTx string `json:"genesisTx"` - GenesisBlock string `json:"genesisBlock"` + User string `json:"user"` + Pass string `json:"pass"` + Host string `json:"host"` + Port string `json:"port"` + GenesisTx string `json:"genesisTx"` + GenesisBlock string `json:"genesisBlock"` + StartFromBlock int64 `json:"startFromBlock"` } var config Config
M serverRoutes.go → serverRoutes.go

@@ -90,7 +90,7 @@ func AllAddresses(w http.ResponseWriter, r *http.Request) {

ipFilter(w, r) nodes := []NodeModel{} - iter := nodeCollection.Find(bson.M{}).Limit(10000).Iter() + iter := nodeCollection.Find(bson.M{"type": "address"}).Limit(10000).Iter() err := iter.All(&nodes) //convert []resp struct to json
M web/views/main/main.html → web/views/main/main.html

@@ -2,7 +2,7 @@ <div class="row">

<div class="col-sm-4"> <div class="panel"> <div class="panel-heading c_blueGrey300"> - <h3 class="panel-title">Last addresses</h3> + <h3 class="panel-title">Last addresses used</h3> </div> <div class="panel-body" style="max-height: 300px;overflow-y: scroll;"> <div class="list-group-item" ng-repeat="node in addresses">

@@ -26,7 +26,7 @@ </div>

<div class="col-sm-4"> <div class="panel"> <div class="panel-heading c_blueGrey300"> - <h3 class="panel-title">Other</h3> + <h3 class="panel-title">Hours</h3> </div> <div class="panel-body"> <canvas id="doughnut" class="chart chart-doughnut" chart-data="data" chart-labels="labels">

@@ -43,14 +43,14 @@ <h3 class="panel-title">Last Tx with amount</h3>

</div> <div class="panel-body" style="max-height: 350px;overflow-y: scroll;"> <table class="table table-striped table-hover"> - <colgroup> + <!--<colgroup> <col class="col-md-2"> <col class="col-md-2"> <col class="col-md-2"> <col class="col-md-2"> <col class="col-md-2"> <col class="col-md-2"> - </colgroup> + </colgroup>--> <thead> <tr> <th>BlockHeight</th>

@@ -63,8 +63,8 @@ </thead>

<tbody> <tr ng-repeat="tx in txs"> <td>{{tx.blockheight}}</td> - <td style="max-width:100px;overflow-x:hidden;">{{tx.from}}</td> - <td style="max-width:100px;overflow-x:hidden;">{{tx.to}}</td> + <td>{{tx.from}}</td> + <td>{{tx.to}}</td> <td>{{tx.label}}</td> <td><a ng-href="#!/tx/{{tx.id}}">View</a></td> </tr>
M web/views/navbar.html → web/views/navbar.html

@@ -10,13 +10,13 @@ </button>

<a class="navbar-brand" href="/">goBlockchainDataAnalysis</a> </div> <div class="navbar-collapse collapse navbar-responsive-collapse"> - <ul class="nav navbar-nav"> + <!--<ul class="nav navbar-nav"> <li><a href="#!/network">Network</a></li> <li><a href="#!/addressNetwork">Address Network</a></li> <li><a href="#!/sankey">Sankey diagram</a></li> <li><a href="#!/dateAnalysis">Date Analysis</a></li> <li><a href="javascript:void(0)">Timeline</a></li> - </ul> + </ul>--> <form class="navbar-form navbar-left"> <div class="form-group"> <input class="form-control col-md-8" placeholder="Search" type="text">
M web/views/sankey/sankey.html → web/views/sankey/sankey.html

@@ -16,7 +16,7 @@ </div>

</div> </div> </div> - <div class="col-sm-8"> + <div class="col-sm-10"> <div class="panel-heading c_blueGrey300"> <h3 class="panel-title">Sankey - address {{selectedAddress}}</h3> </div>
M web/views/sankey/sankey.js → web/views/sankey/sankey.js

@@ -13,7 +13,7 @@ .controller('SankeyCtrl', function($scope, $http, $routeParams) {

$scope.selectedAddress = ""; $scope.options = { chart: '#sankeyChart', - width: 960, + width: 800, height: 500, margin: {top: 1, right: 1, bottom: 6, left: 1}, node: {width: 15, padding :10, showValue: false},