Browse Source

fixed bug on getting Vin array inside a tx

master^2
arnaucode 7 years ago
parent
commit
3397fc43ad
15 changed files with 63 additions and 75 deletions
  1. +0
    -3
      DevelopmentNotes.md
  2. +1
    -10
      README.md
  3. +60
    -60
      exploreBlockchain.go
  4. BIN
      screenshots/goBlockchainDataAnalysis00.png
  5. BIN
      screenshots/goBlockchainDataAnalysis00_new.png
  6. BIN
      screenshots/goBlockchainDataAnalysis01.png
  7. BIN
      screenshots/goBlockchainDataAnalysis02.png
  8. BIN
      screenshots/goBlockchainDataAnalysis03.gif
  9. BIN
      screenshots/goBlockchainDataAnalysis04.png
  10. BIN
      screenshots/goBlockchainDataAnalysis05.png
  11. BIN
      screenshots/goBlockchainDataAnalysis06.gif
  12. BIN
      screenshots/new/goBlockchainDataAnalysis00.png
  13. BIN
      screenshots/new/goBlockchainDataAnalysis01png
  14. BIN
      screenshots/new/goBlockchainDataAnalysis02.png
  15. +2
    -2
      web/views/addressNetwork/addressNetwork.html

+ 0
- 3
DevelopmentNotes.md

@ -31,9 +31,6 @@ other
- num address evolution throught time
- fix error in exploreBlockchain.go, when getting the tx.Vin
tx 8f04960da36beaa928b9693f7dca4afae5a6122bb6874d409a1156e4c6c55024 has 4 vin, but exploreBlockchain is only getting the first
- pagination in address network generation
- stop rendering dots of sankey, when view change

+ 1
- 10
README.md

@ -102,19 +102,10 @@ Webapp will run on 127.0.0.1:8080
### Some screenshots
Some screenshots can be old, and can contain errors.
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis00_new.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis00.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis06.gif "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis05.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis01.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis02.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis04.png "goBlockchainDataAnalysis")
![goBlockchainDataAnalysis](https://raw.githubusercontent.com/arnaucode/goBlockchainDataAnalysis/master/screenshots/goBlockchainDataAnalysis03.gif "goBlockchainDataAnalysis")

+ 60
- 60
exploreBlockchain.go

@ -125,70 +125,70 @@ func explore(client *rpcclient.Client, blockHash string) {
txVi, err := client.GetRawTransactionVerbose(th)
check(err)
if len(txVi.Vout[Vi.Vout].ScriptPubKey.Addresses) > 0 {
//add tx to newBlock
newBlock.Tx = append(newBlock.Tx, blockTx.Txid)
//Tx save
for _, originAddr := range txVi.Vout[Vi.Vout].ScriptPubKey.Addresses {
originAddresses = append(originAddresses, originAddr)
var newVin Vin
newVin.Txid = blockTx.Txid
newVin.Amount = txVi.Vout[Vi.Vout].Value
newVin.Address = originAddr
newTx.Vin = append(newTx.Vin, newVin)
var n1 NodeModel
n1.Id = originAddr
n1.Label = originAddr
n1.Title = originAddr
n1.Group = strconv.FormatInt(block.Height, 10)
n1.Value = 1
n1.Shape = "dot"
n1.Type = "address"
saveNode(nodeCollection, n1)
//Address
var addr AddressModel
addr.Hash = originAddr
addr.InBittrex = false
saveAddress(addr)
for k, outputAddr := range outputAddresses {
var eIn EdgeModel
eIn.From = originAddr
eIn.To = txHash
eIn.Label = txVi.Vout[Vi.Vout].Value
eIn.Txid = blockTx.Txid
eIn.Arrows = "to"
eIn.BlockHeight = block.Height
saveEdge(edgeCollection, eIn)
var eOut EdgeModel
eOut.From = txHash
eOut.To = outputAddr
eOut.Label = outputAmount[k]
eOut.Txid = blockTx.Txid
eOut.Arrows = "to"
eOut.BlockHeight = block.Height
saveEdge(edgeCollection, eOut)
//date analysis
//dateAnalysis(e, tx.Time)
//hour analysis
hourAnalysis(eIn, blockTx.Time)
//newTx.To = outputAddr
}
//if len(txVi.Vout[Vi.Vout].ScriptPubKey.Addresses) > 0 {
//add tx to newBlock
newBlock.Tx = append(newBlock.Tx, blockTx.Txid)
//Tx save
for _, originAddr := range txVi.Vout[Vi.Vout].ScriptPubKey.Addresses {
originAddresses = append(originAddresses, originAddr)
var newVin Vin
newVin.Txid = blockTx.Txid
newVin.Amount = txVi.Vout[Vi.Vout].Value
newVin.Address = originAddr
newTx.Vin = append(newTx.Vin, newVin)
var n1 NodeModel
n1.Id = originAddr
n1.Label = originAddr
n1.Title = originAddr
n1.Group = strconv.FormatInt(block.Height, 10)
n1.Value = 1
n1.Shape = "dot"
n1.Type = "address"
saveNode(nodeCollection, n1)
//Address
var addr AddressModel
addr.Hash = originAddr
addr.InBittrex = false
saveAddress(addr)
for k, outputAddr := range outputAddresses {
var eIn EdgeModel
eIn.From = originAddr
eIn.To = txHash
eIn.Label = txVi.Vout[Vi.Vout].Value
eIn.Txid = blockTx.Txid
eIn.Arrows = "to"
eIn.BlockHeight = block.Height
saveEdge(edgeCollection, eIn)
var eOut EdgeModel
eOut.From = txHash
eOut.To = outputAddr
eOut.Label = outputAmount[k]
eOut.Txid = blockTx.Txid
eOut.Arrows = "to"
eOut.BlockHeight = block.Height
saveEdge(edgeCollection, eOut)
//date analysis
//dateAnalysis(e, tx.Time)
//hour analysis
hourAnalysis(eIn, blockTx.Time)
//newTx.To = outputAddr
}
saveTx(newTx)
} else {
originAddresses = append(originAddresses, "origin")
}
/*} else {
originAddresses = append(originAddresses, "origin")
}*/
}
saveTx(newTx)
fmt.Print("originAddresses: ")
fmt.Println(len(originAddresses))
fmt.Print("outputAddresses: ")

BIN
screenshots/goBlockchainDataAnalysis00.png

Before After
Width: 1258  |  Height: 851  |  Size: 186 KiB Width: 1344  |  Height: 615  |  Size: 166 KiB

BIN
screenshots/goBlockchainDataAnalysis00_new.png

Before After
Width: 1362  |  Height: 647  |  Size: 180 KiB

BIN
screenshots/goBlockchainDataAnalysis01.png

Before After
Width: 858  |  Height: 861  |  Size: 298 KiB Width: 1345  |  Height: 643  |  Size: 262 KiB

BIN
screenshots/goBlockchainDataAnalysis02.png

Before After
Width: 847  |  Height: 869  |  Size: 298 KiB Width: 1344  |  Height: 646  |  Size: 192 KiB

BIN
screenshots/goBlockchainDataAnalysis03.gif

Before After
Width: 600  |  Height: 325  |  Size: 3.2 MiB

BIN
screenshots/goBlockchainDataAnalysis04.png

Before After
Width: 1264  |  Height: 910  |  Size: 146 KiB

BIN
screenshots/goBlockchainDataAnalysis05.png

Before After
Width: 1179  |  Height: 557  |  Size: 127 KiB

BIN
screenshots/goBlockchainDataAnalysis06.gif

Before After
Width: 600  |  Height: 338  |  Size: 2.5 MiB

BIN
screenshots/new/goBlockchainDataAnalysis00.png

Before After
Width: 1344  |  Height: 615  |  Size: 166 KiB

BIN
screenshots/new/goBlockchainDataAnalysis01png

Before After
Width: 1344  |  Height: 646  |  Size: 192 KiB

BIN
screenshots/new/goBlockchainDataAnalysis02.png

Before After
Width: 1345  |  Height: 643  |  Size: 262 KiB

+ 2
- 2
web/views/addressNetwork/addressNetwork.html

@ -1,6 +1,6 @@
<div class="row">
<div class="col-sm-3">
<div class="panel-heading c_blueGrey300">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">All addresses ({{addresses.length}})</h3>
</div>
<div class="panel-body" style="max-height: 500px;overflow-y: scroll;">
@ -17,7 +17,7 @@
</div>
</div>
<div class="col-sm-9">
<div class="panel-heading c_blueGrey300">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Address history Network Map {{selectedAddress.id}}, BlockHeight: {{selectedAddress.group}}</h3>
</div>
<div class="panel-body">

Loading…
Cancel
Save