mirror of
https://github.com/arnaucube/goBlockchainDataAnalysis.git
synced 2026-02-07 03:36:44 +01:00
fixed address tree concurrent generation algorithm
This commit is contained in:
10
README.md
10
README.md
@@ -1,6 +1,13 @@
|
|||||||
# goBlockchainDataAnalysis
|
# goBlockchainDataAnalysis
|
||||||
blockchain data analysis, written in Go
|
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
|
### Install
|
||||||
1. Nodejs & NPM https://nodejs.org/ --> to serve the web, not necessary if the web files are in a webserver
|
1. Nodejs & NPM https://nodejs.org/ --> to serve the web, not necessary if the web files are in a webserver
|
||||||
@@ -74,6 +81,9 @@ Webapp will run on 127.0.0.1:8080
|
|||||||
|
|
||||||
### Some screenshots
|
### Some screenshots
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import (
|
|||||||
"gopkg.in/mgo.v2/bson"
|
"gopkg.in/mgo.v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var upLevelEdge EdgeModel
|
||||||
|
|
||||||
func upTree(address string, network NetworkModel) NetworkModel {
|
func upTree(address string, network NetworkModel) NetworkModel {
|
||||||
var upNetwork NetworkModel
|
var upNetwork NetworkModel
|
||||||
|
|
||||||
@@ -31,9 +33,16 @@ func upTree(address string, network NetworkModel) NetworkModel {
|
|||||||
err := nodeCollection.Find(bson.M{"id": }).All(&edges)
|
err := nodeCollection.Find(bson.M{"id": }).All(&edges)
|
||||||
check(err)
|
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)
|
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)
|
upNetwork = upTree(e.From, network)
|
||||||
for _, upN := range upNetwork.Nodes {
|
for _, upN := range upNetwork.Nodes {
|
||||||
if nodeInNodes(network.Nodes, upN) == false {
|
if nodeInNodes(network.Nodes, upN) == false {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ func explore(client *btcrpcclient.Client, blockHash string) {
|
|||||||
block, err := client.GetBlockVerbose(bh)
|
block, err := client.GetBlockVerbose(bh)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
if block.Height > 0 {
|
if block.Height > config.StartFromBlock {
|
||||||
for k, txHash := range block.Tx {
|
for k, txHash := range block.Tx {
|
||||||
if k > 0 {
|
if k > 0 {
|
||||||
realBlocks++
|
realBlocks++
|
||||||
|
|||||||
BIN
goBlockchainDataAnalysis00.png
Normal file
BIN
goBlockchainDataAnalysis00.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 KiB |
BIN
goBlockchainDataAnalysis06.gif
Normal file
BIN
goBlockchainDataAnalysis06.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@@ -120,7 +120,7 @@ func nodeInNodes(nodes []NodeModel, node NodeModel) bool {
|
|||||||
}
|
}
|
||||||
func edgeInEdges(edges []EdgeModel, edge EdgeModel) bool {
|
func edgeInEdges(edges []EdgeModel, edge EdgeModel) bool {
|
||||||
for _, e := range edges {
|
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
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type Config struct {
|
|||||||
Port string `json:"port"`
|
Port string `json:"port"`
|
||||||
GenesisTx string `json:"genesisTx"`
|
GenesisTx string `json:"genesisTx"`
|
||||||
GenesisBlock string `json:"genesisBlock"`
|
GenesisBlock string `json:"genesisBlock"`
|
||||||
|
StartFromBlock int64 `json:"startFromBlock"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ func AllAddresses(w http.ResponseWriter, r *http.Request) {
|
|||||||
ipFilter(w, r)
|
ipFilter(w, r)
|
||||||
|
|
||||||
nodes := []NodeModel{}
|
nodes := []NodeModel{}
|
||||||
iter := nodeCollection.Find(bson.M{}).Limit(10000).Iter()
|
iter := nodeCollection.Find(bson.M{"type": "address"}).Limit(10000).Iter()
|
||||||
err := iter.All(&nodes)
|
err := iter.All(&nodes)
|
||||||
|
|
||||||
//convert []resp struct to json
|
//convert []resp struct to json
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_blueGrey300">
|
<div class="panel-heading c_blueGrey300">
|
||||||
<h3 class="panel-title">Last addresses</h3>
|
<h3 class="panel-title">Last addresses used</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body" style="max-height: 300px;overflow-y: scroll;">
|
<div class="panel-body" style="max-height: 300px;overflow-y: scroll;">
|
||||||
<div class="list-group-item" ng-repeat="node in addresses">
|
<div class="list-group-item" ng-repeat="node in addresses">
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading c_blueGrey300">
|
<div class="panel-heading c_blueGrey300">
|
||||||
<h3 class="panel-title">Other</h3>
|
<h3 class="panel-title">Hours</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<canvas id="doughnut" class="chart chart-doughnut" chart-data="data" chart-labels="labels">
|
<canvas id="doughnut" class="chart chart-doughnut" chart-data="data" chart-labels="labels">
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body" style="max-height: 350px;overflow-y: scroll;">
|
<div class="panel-body" style="max-height: 350px;overflow-y: scroll;">
|
||||||
<table class="table table-striped table-hover">
|
<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">
|
||||||
<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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>BlockHeight</th>
|
<th>BlockHeight</th>
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="tx in txs">
|
<tr ng-repeat="tx in txs">
|
||||||
<td>{{tx.blockheight}}</td>
|
<td>{{tx.blockheight}}</td>
|
||||||
<td style="max-width:100px;overflow-x:hidden;">{{tx.from}}</td>
|
<td>{{tx.from}}</td>
|
||||||
<td style="max-width:100px;overflow-x:hidden;">{{tx.to}}</td>
|
<td>{{tx.to}}</td>
|
||||||
<td>{{tx.label}}</td>
|
<td>{{tx.label}}</td>
|
||||||
<td><a ng-href="#!/tx/{{tx.id}}">View</a></td>
|
<td><a ng-href="#!/tx/{{tx.id}}">View</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
<a class="navbar-brand" href="/">goBlockchainDataAnalysis</a>
|
<a class="navbar-brand" href="/">goBlockchainDataAnalysis</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
<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="#!/network">Network</a></li>
|
||||||
<li><a href="#!/addressNetwork">Address Network</a></li>
|
<li><a href="#!/addressNetwork">Address Network</a></li>
|
||||||
<li><a href="#!/sankey">Sankey diagram</a></li>
|
<li><a href="#!/sankey">Sankey diagram</a></li>
|
||||||
<li><a href="#!/dateAnalysis">Date Analysis</a></li>
|
<li><a href="#!/dateAnalysis">Date Analysis</a></li>
|
||||||
<li><a href="javascript:void(0)">Timeline</a></li>
|
<li><a href="javascript:void(0)">Timeline</a></li>
|
||||||
</ul>
|
</ul>-->
|
||||||
<form class="navbar-form navbar-left">
|
<form class="navbar-form navbar-left">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="form-control col-md-8" placeholder="Search" type="text">
|
<input class="form-control col-md-8" placeholder="Search" type="text">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-10">
|
||||||
<div class="panel-heading c_blueGrey300">
|
<div class="panel-heading c_blueGrey300">
|
||||||
<h3 class="panel-title">Sankey - address {{selectedAddress}}</h3>
|
<h3 class="panel-title">Sankey - address {{selectedAddress}}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ angular.module('app.sankey', ['ngRoute', 'ngSankey'])
|
|||||||
$scope.selectedAddress = "";
|
$scope.selectedAddress = "";
|
||||||
$scope.options = {
|
$scope.options = {
|
||||||
chart: '#sankeyChart',
|
chart: '#sankeyChart',
|
||||||
width: 960,
|
width: 800,
|
||||||
height: 500,
|
height: 500,
|
||||||
margin: {top: 1, right: 1, bottom: 6, left: 1},
|
margin: {top: 1, right: 1, bottom: 6, left: 1},
|
||||||
node: {width: 15, padding :10, showValue: false},
|
node: {width: 15, padding :10, showValue: false},
|
||||||
|
|||||||
Reference in New Issue
Block a user