Browse Source

chukandzica

master
marcetin 4 months ago
parent
commit
871ea8f709
54 changed files with 2789 additions and 1011 deletions
  1. 120
    23
      exp/addr.go
  2. 97
    0
      exp/charts.1.go0
  3. 44
    0
      exp/form.go
  4. 0
    237
      exp/hnd.go
  5. 223
    0
      exp/hndNodes.go
  6. 112
    0
      exp/hndVega.go
  7. 12
    68
      exp/hndl.go
  8. 0
    101
      exp/mod.go
  9. 47
    0
      exp/modChain.go
  10. 21
    0
      exp/modNode.go
  11. 47
    0
      exp/modSystem.go
  12. 92
    0
      exp/modVega.go
  13. 208
    0
      exp/rpcBlock.go
  14. 85
    0
      exp/rpcInfo.go
  15. 106
    0
      exp/src.go
  16. 117
    0
      exp/txs.go
  17. 2
    77
      rts/hnd.go
  18. 0
    61
      rts/node.go
  19. 26
    22
      rts/rts.go
  20. 244
    88
      tpl/fls/css/style.css
  21. 46
    0
      tpl/fls/gohtml/78explorer.gohtml
  22. 11
    1
      tpl/fls/gohtml/addr.gohtml
  23. 1
    1
      tpl/fls/gohtml/app.gohtml
  24. 5
    10
      tpl/fls/gohtml/base.gohtml
  25. 47
    21
      tpl/fls/gohtml/block.gohtml
  26. 1
    1
      tpl/fls/gohtml/body.gohtml
  27. 463
    0
      tpl/fls/gohtml/c_globe.gohtml
  28. 43
    0
      tpl/fls/gohtml/c_google.gohtml
  29. 154
    0
      tpl/fls/gohtml/c_transactions.gohtml
  30. 38
    0
      tpl/fls/gohtml/c_vega.gohtml
  31. 56
    0
      tpl/fls/gohtml/explorer.1.gohtml
  32. 25
    23
      tpl/fls/gohtml/explorer.gohtml
  33. 14
    4
      tpl/fls/gohtml/header.gohtml
  34. 4
    2
      tpl/fls/gohtml/home.gohtml
  35. 4
    1
      tpl/fls/gohtml/pages.gohtml
  36. 9
    0
      tpl/fls/gohtml/pagesOLD.gohtml
  37. 57
    18
      tpl/fls/gohtml/rich.gohtml
  38. 27
    12
      tpl/fls/gohtml/sidebar.gohtml
  39. 64
    35
      tpl/fls/gohtml/tx.gohtml
  40. 4
    3
      tpl/fls/html/addcoin.html
  41. 0
    16
      tpl/fls/html/addnode.html
  42. 1
    1
      tpl/fls/html/addr.html
  43. 16
    0
      tpl/fls/html/addrpcsource.html
  44. 3
    0
      tpl/fls/html/globe.html
  45. 0
    54
      tpl/fls/html/rich_full.html
  46. 0
    54
      tpl/fls/html/rich_grouped.html
  47. 0
    54
      tpl/fls/html/rich_singles.html
  48. 3
    0
      tpl/fls/html/transactions.html
  49. 1
    0
      tpl/fls/html/txid.html
  50. 8
    0
      tpl/static/d3.min.js
  51. 1
    0
      tpl/static/topojson.min.js
  52. 79
    0
      tpl/static/versor.js
  53. BIN
      utl/IP2LOCATION-LITE-DB11.BIN
  54. 1
    23
      utl/req.go

+ 120
- 23
exp/addr.go View File

@@ -2,39 +2,136 @@ package exp
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+	"hash/fnv"
5 6
 
6 7
 	"git.parallelcoin.io/marcetin/explorer/jdb"
7 8
 )
8 9
 
9
-func (n *Node) GetAddrs() {
10
-	var AVS = make(map[string]float64)
11
-	last := SrcNode(n.Coin).GetBlockCount()
10
+func hash(s string) uint32 {
11
+	h := fnv.New32a()
12
+	h.Write([]byte(s))
13
+	return h.Sum32()
14
+}
15
+
16
+func CreateAddrsList(coin string) map[uint32]Addr {
17
+	a := make(map[uint32]Addr)
18
+	last := RPCSRC(coin).GetBlockCount()
19
+	// last := 1111
12 20
 	for block := 0; block <= last; {
13
-		b := (SrcNode(n.Coin).GetBlockByHeight(block)).(map[string]interface{})
14
-		txs := (b["tx"]).([]interface{})
15
-		for _, tx := range txs {
16
-			t := tx.(string)
17
-			xt := SrcNode(n.Coin).GetTx(string(t))
18
-			if xt != nil {
19
-				txm := xt.(map[string]interface{})
20
-				vout := txm["vout"].([]interface{})
21
-				for _, v := range vout {
22
-					spk := v.(map[string]interface{})
23
-					spkmap := spk["scriptPubKey"].(map[string]interface{})
24
-					if spkmap["addresses"] != nil {
25
-						addrs := spkmap["addresses"].([]interface{})
26
-						for _, addr := range addrs {
27
-							AVS[addr.(string)] += spk["value"].(float64)
28
-							fmt.Println("Address:", addr)
29
-							fmt.Println("Value Sum:", AVS[addr.(string)])
30
-							fmt.Println("Block:", block)
21
+		b := (RPCSRC(coin).GetBlockByHeight(block))
22
+		txs := b["tx"].([]string)
23
+		for _, t := range txs {
24
+			if block > 0 {
25
+				txm := RPCSRC(coin).GetTx(string(t))
26
+				if txm != nil {
27
+					vout := txm["vout"].([]interface{})
28
+					for _, v := range vout {
29
+						spk := v.(map[string]interface{})
30
+						spkmap := spk["scriptPubKey"].(map[string]interface{})
31
+						if spkmap["addresses"] != nil {
32
+							addrs := spkmap["addresses"].([]interface{})
33
+							var addr Addr
34
+							for _, ad := range addrs {
35
+								id := hash(ad.(string))
36
+								a[id] = Addr{
37
+									Addr:  ad.(string),
38
+									Value: (a[id].Value + spk["value"].(float64)),
39
+									Txs:   append(addr.Txs, t),
40
+								}
41
+								fmt.Println("Address:", a[id])
42
+								fmt.Println("Value Sum:", a[id].Value)
43
+								fmt.Println("Block:", block)
44
+							}
31 45
 						}
32 46
 					}
33
-
34 47
 				}
35 48
 			}
36 49
 		}
37 50
 		block++
38 51
 	}
39
-	jdb.JDB.Write("data/"+n.Coin+"/addrs", "addrs", AVS)
52
+	jdb.JDB.Write("data/"+coin+"/addrs", "full", a)
53
+	return a
54
+}
55
+
56
+// func CreateRichlist(a []Addr) map[uint32]Addr {
57
+// 	var rich = make(map[string]Addr)
58
+// 	for _, m := range a {
59
+// 		switch {
60
+// 		case m.Value <= 10:
61
+// 			rich["Less than 10"] = Addr{
62
+// 				Value: rich["Less than 10"].Value + m.Value,
63
+// 			}
64
+// 		case m.Value <= 100:
65
+// 			rich["Less than 100"] = Addr{
66
+// 				Value: rich["Less than 100"].Value + m.Value,
67
+// 			}
68
+// 		case m.Value <= 1000:
69
+// 			rich["Less than 1000"] = Addr{
70
+// 				Value: rich["Less than 1000"].Value + m.Value,
71
+// 			}
72
+// 		case m.Value <= 3000:
73
+// 			rich["Less than 3000"] = Addr{
74
+// 				Value: rich["Less than 3000"].Value + m.Value,
75
+// 			}
76
+// 		case m.Value <= 5000:
77
+// 			rich["Less than 5000"] = Addr{
78
+// 				Value: rich["Less than 5000"].Value + m.Value,
79
+// 			}
80
+// 		case m.Value <= 10000:
81
+// 			rich["Less than 10000"] = Addr{
82
+// 				Value: rich["Less than 10000"].Value + m.Value,
83
+// 			}
84
+// 		case m.Value >= 10000:
85
+// 			rich[m.Addr] = Addr{
86
+// 				Addr:  m.Addr,
87
+// 				Value: m.Value,
88
+// 				Txs:   m.Txs,
89
+// 			}
90
+// 		}
91
+// 	}
92
+// 	richListToSort := []Addr{}
93
+// 	i := 1
94
+// 	for k, r := range rich {
95
+// 		richListToSort = append(richListToSort, Addr{k, r.Value, r.Txs})
96
+// 		i++
97
+// 	}
98
+// 	sort.Sort(sort.Reverse(ByValue(richListToSort)))
99
+// 	richListSort := []Addr{}
100
+// 	ii := 1
101
+// 	for _, r := range richListToSort {
102
+// 		richListSort = append(richListSort, Addr{r.Addr, r.Value, ii, r.Txs})
103
+// 		ii++
104
+// 	}
105
+// 	// jdb.JDB.Write("data/"+coin+"/richlist", "full", richListSort)
106
+// 	// jdb.JDB.Write("data/"+coin+"/richlist", "singles", richListSingles(richListToSort))
107
+// 	// jdb.JDB.Write("data/"+coin+"/richlist", "grouped", richListGrouped(richListToSort))
108
+// 	return a
109
+// }
110
+
111
+type ByValue []Addr
112
+
113
+func (a ByValue) Len() int           { return len(a) }
114
+func (a ByValue) Less(i, j int) bool { return a[i].Value < a[j].Value }
115
+func (a ByValue) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
116
+
117
+func richListSingles(l []Addr) (f []Addr) {
118
+	i := 1
119
+	for _, r := range l {
120
+		if len(r.Addr) > 20 {
121
+			f = append(f, Addr{r.Addr, r.Value, r.Txs})
122
+		}
123
+		i++
124
+	}
125
+	return f
126
+}
127
+
128
+func richListGrouped(l []Addr) (f []Addr) {
129
+	i := 1
130
+	for _, r := range l {
131
+		if len(r.Addr) < 20 {
132
+			f = append(f, Addr{r.Addr, r.Value, r.Txs})
133
+		}
134
+		i++
135
+	}
136
+	return f
40 137
 }

+ 97
- 0
exp/charts.1.go0 View File

@@ -0,0 +1,97 @@
1
+package exp
2
+
3
+import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"net/http"
7
+
8
+	"git.parallelcoin.io/marcetin/explorer/jdb"
9
+	"git.parallelcoin.io/marcetin/explorer/tpl"
10
+	"github.com/gorilla/mux"
11
+)
12
+
13
+func GetChart(w http.ResponseWriter, r *http.Request) {
14
+	v := mux.Vars(r)
15
+	var rich []Addr
16
+	jdb.JDB.Read("data/"+v["coin"]+"/richlist", "full", &rich)
17
+
18
+	data := Chart{
19
+		Coin: v["coin"],
20
+		// Blocks:   []exp.Block{},
21
+		// AMP:   amp.AMPS(),
22
+		Data: rich,
23
+		// Template: tpl.TPLHandler().Templates,
24
+	}
25
+	tpl.TPLHandler().ExecuteTemplate(w, "chart_gohtml", data)
26
+}
27
+
28
+func GetChartData(w http.ResponseWriter, r *http.Request) {
29
+	v := mux.Vars(r)
30
+	var chartData []Addr
31
+	jdb.JDB.Read("data/"+v["coin"]+"/richlist", "full", &chartData)
32
+
33
+	type ChartValues struct {
34
+		X int `json:"x"`
35
+		Y int `json:"y"`
36
+	}
37
+	var cV []ChartValues
38
+	for _, c := range chartData {
39
+		cV = append(cV, ChartValues{
40
+			Y: int(c.Value),
41
+		})
42
+	}
43
+	type strInt map[string]interface{}
44
+	chartJSON := strInt{
45
+		"width":   240,
46
+		"height":  120,
47
+		"padding": map[string]int{"top": 10, "left": 60, "bottom": 30, "right": 10},
48
+		"data": strInt{
49
+			"name":   "table",
50
+			"values": cV,
51
+		},
52
+		"scales": []strInt{
53
+			{
54
+				"name":   "x",
55
+				"type":   "ordinal",
56
+				"range":  "width",
57
+				"domain": strInt{"data": "table", "field": "x"},
58
+			},
59
+			{
60
+				"name":   "y",
61
+				"type":   "linear",
62
+				"range":  "height",
63
+				"domain": strInt{"data": "table", "field": "y"},
64
+				"nice":   true,
65
+			},
66
+		},
67
+		"axes": []strInt{
68
+			{"type": "x", "scale": "x"},
69
+			{"type": "y", "scale": "y"},
70
+		},
71
+		"marks": strInt{
72
+			"type": "rect",
73
+			"from": strInt{"data": "table"},
74
+			"properties": strInt{
75
+				"enter": strInt{
76
+					"x":     strInt{"scale": "x", "field": "x"},
77
+					"width": strInt{"scale": "x", "band": true, "offset": -1},
78
+					"y":     strInt{"scale": "y", "field": "y"},
79
+					"y2":    strInt{"scale": "y", "value": 0},
80
+				},
81
+				"update": strInt{
82
+					"fill": strInt{"value": "steelblue"},
83
+				},
84
+				"hover": strInt{
85
+					"fill": strInt{"value": "red"},
86
+				},
87
+			},
88
+		},
89
+	}
90
+
91
+	out, err := json.Marshal(chartJSON)
92
+	if err != nil {
93
+		fmt.Println("Error encoding JSON")
94
+		return
95
+	}
96
+	w.Write([]byte(out))
97
+}

+ 44
- 0
exp/form.go View File

@@ -0,0 +1,44 @@
1
+package exp
2
+
3
+import (
4
+	"fmt"
5
+	"net/http"
6
+	"strconv"
7
+
8
+	"git.parallelcoin.io/marcetin/explorer/jdb"
9
+	"git.parallelcoin.io/marcetin/explorer/utl"
10
+)
11
+
12
+func AddCoin(w http.ResponseWriter, r *http.Request) {
13
+	c := coinAdd(r)
14
+	w.Header().Set("AMP-Redirect-To", "http://localhost:4000/")
15
+	w.Header().Set("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To")
16
+	utl.SendJsonResponse(w, c)
17
+}
18
+func coinAdd(r *http.Request) (c Coin) {
19
+	c.Name = r.FormValue("name")
20
+	c.Slug = utl.MakeSlug(c.Name)
21
+	c.Abbr = r.FormValue("abbr")
22
+	c.X, _ = strconv.ParseInt(r.FormValue("x"), 10, 64)
23
+	jdb.JDB.Write("coins/", c.Slug, c)
24
+	return c
25
+}
26
+func rpcSourceAdd(r *http.Request) (rpc RPCSource) {
27
+	rpc.Coin = r.FormValue("coin")
28
+	fmt.Println("asassaaaablockCountblockCountaaaa", rpc.Coin)
29
+	rpc.RPCSourceID = r.FormValue("rpcsrcid")
30
+	rpc.Slug = utl.MakeSlug(rpc.RPCSourceID)
31
+	rpc.RPCUser = r.FormValue("rpcuser")
32
+	rpc.RPCPassword = r.FormValue("rpcpassword")
33
+	rpc.IP = r.FormValue("ip")
34
+	rpc.Port, _ = strconv.ParseInt(r.FormValue("port"), 10, 64)
35
+	jdb.JDB.Write("data/"+rpc.Coin+"/rpcsrc", rpc.Slug, rpc)
36
+	return rpc
37
+}
38
+
39
+func AddRPCSource(w http.ResponseWriter, r *http.Request) {
40
+	n := rpcSourceAdd(r)
41
+	w.Header().Set("AMP-Redirect-To", "http://localhost:4000/")
42
+	w.Header().Set("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To")
43
+	utl.SendJsonResponse(w, n)
44
+}

+ 0
- 237
exp/hnd.go View File

@@ -1,237 +0,0 @@
1
-package exp
2
-
3
-import (
4
-	"fmt"
5
-	"strconv"
6
-
7
-	"git.parallelcoin.io/marcetin/explorer/utl"
8
-)
9
-
10
-// var _ JormNode = &Node{}
11
-
12
-// type JormNode interface {
13
-// 	GetBlockCount() int
14
-// 	// GetBlockByHash(blockhash string) interface{}
15
-// 	GetBlock(blockhash string) interface{}
16
-// 	GetBlockTxAddr(blockheight int) interface{}
17
-// 	GetBlockByHeight(blockheight int) interface{}
18
-// 	GetTx(txid string) interface{}
19
-// 	GetAddr(cs *CSystem, addr string) interface{}
20
-// 	GetRawMemPool() interface{}
21
-// 	GetMiningInfo() interface{}
22
-// 	GetInfo() interface{}
23
-// }
24
-// type ByValue []map[string]interface{}
25
-
26
-// func (a ByValue) Len() int           { return len(a) }
27
-// func (a ByValue) Less(i, j int) bool { return a[i] < a[j] }
28
-// func (a ByValue) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
29
-
30
-func (n *Node) GetBlockCount() (b int) {
31
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
32
-	if jrc == nil {
33
-		fmt.Println("Error n status write")
34
-	}
35
-	bparams := []int{}
36
-	gbc, err := jrc.MakeRequest("getblockcount", bparams)
37
-	if err != nil {
38
-		fmt.Println("Error n call: ", err)
39
-
40
-	}
41
-	switch gbc.(type) {
42
-	case float64:
43
-		return int(gbc.(float64))
44
-	case string:
45
-		b, _ := strconv.Atoi(gbc.(string))
46
-		return b
47
-	default:
48
-		b, _ := strconv.Atoi(gbc.(string))
49
-		return b
50
-	}
51
-	return
52
-}
53
-
54
-func (n *Node) GetBlocks(per, page int) []map[string]interface{} {
55
-	var lb []map[string]interface{}
56
-	fmt.Println("asassaaaablockCountblockCountaaaa", n)
57
-	blockCount := n.GetBlockCount()
58
-
59
-	startBlock := blockCount - per*page
60
-	minusBlockStart := int(startBlock - per)
61
-	for ibh := startBlock; ibh >= minusBlockStart; {
62
-		var blk map[string]interface{}
63
-		blk = (SrcNode(n.Coin).GetBlockByHeight(ibh)).(map[string]interface{})
64
-		lb = append(lb, blk)
65
-		ibh--
66
-	}
67
-	return lb
68
-}
69
-
70
-// func (n *Node) GetLastBlocks() []map[string]interface{} {
71
-// 	var lb []map[string]interface{}
72
-// 	blockcount := SrcNode().GetBlockCount()
73
-// 	minusblockcount := int(blockcount - 19)
74
-// 	for ibh := blockcount; ibh >= minusblockcount; {
75
-// 		var blk map[string]interface{}
76
-// 		blk = (SrcNode().GetBlockByHeight(ibh)).(map[string]interface{})
77
-// 		lb = append(lb, blk)
78
-// 		ibh--
79
-// 	}
80
-// 	return lb
81
-// }
82
-
83
-func (n *Node) GetBlock(blockhash string) interface{} {
84
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
85
-	if jrc == nil {
86
-		fmt.Println("Error n status write")
87
-	}
88
-	bparams := []string{blockhash}
89
-	block, err := jrc.MakeRequest("getblock", bparams)
90
-	if err != nil {
91
-		fmt.Println("Jorm Node Get Block Error", err)
92
-	}
93
-	return block
94
-}
95
-
96
-func (n *Node) GetBlockTxAddr(blockheight int) interface{} {
97
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
98
-	if jrc == nil {
99
-		fmt.Println("Error n status write")
100
-	}
101
-	//bh, err := strconv.Atoi(blockheight)
102
-	//bparams := []int{bh}
103
-	bparams := []int{blockheight}
104
-	blockHash, err := jrc.MakeRequest("getblockhash", bparams)
105
-	if err != nil {
106
-		fmt.Println("Jorm Node Get Block Tx Addr Error", err)
107
-	}
108
-	var block interface{}
109
-	var txs []interface{}
110
-	if blockHash != nil {
111
-		block = n.GetBlock((blockHash).(string))
112
-	}
113
-	iblock := make(map[string]interface{})
114
-	iblock = block.(map[string]interface{})
115
-
116
-	itxs := iblock["tx"].([]interface{})
117
-	//txs := itxs.([]string)
118
-
119
-	for _, itx := range itxs {
120
-		var txid string
121
-		txid = itx.(string)
122
-
123
-		verbose := int(1)
124
-		var grtx []interface{}
125
-		grtx = append(grtx, txid)
126
-		grtx = append(grtx, verbose)
127
-		rtx, err := jrc.MakeRequest("getrawtransaction", grtx)
128
-		if err != nil {
129
-			fmt.Println("Jorm Node Get Block Tx Addr Tx Error", err)
130
-		}
131
-		txs = append(txs, rtx)
132
-
133
-	}
134
-
135
-	//fmt.Println("blockblockblockblockblock", txs)
136
-
137
-	blocktxaddr := map[string]interface{}{
138
-		"b": block,
139
-		"t": txs,
140
-	}
141
-	return blocktxaddr
142
-}
143
-func (n *Node) GetBlockByHeight(blockheight int) interface{} {
144
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
145
-	if jrc == nil {
146
-		fmt.Println("Error n status write")
147
-	}
148
-	//bh, err := strconv.Atoi(blockheight)
149
-	//bparams := []int{bh}
150
-	bparams := []int{blockheight}
151
-	blockHash, err := jrc.MakeRequest("getblockhash", bparams)
152
-	if err != nil {
153
-		fmt.Println("Jorm Node Get Block By Height Error", err)
154
-	}
155
-	var block interface{}
156
-	if blockHash != nil {
157
-		block = n.GetBlock((blockHash).(string))
158
-	}
159
-	return block
160
-}
161
-func (n *Node) GetTx(txid string) interface{} {
162
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
163
-	if jrc == nil {
164
-		fmt.Println("Error n status write")
165
-	}
166
-	verbose := int(1)
167
-	var grtx []interface{}
168
-	grtx = append(grtx, txid)
169
-	grtx = append(grtx, verbose)
170
-	rtx, err := jrc.MakeRequest("getrawtransaction", grtx)
171
-	if err != nil {
172
-		fmt.Println("Jorm Node Get Tx Error", err)
173
-	}
174
-	// if rtx != nil {
175
-	// 	rawtx = rtx.(Tx)
176
-	// }
177
-	return rtx
178
-}
179
-
180
-// func (n *Node) GetAddr(addr string) interface{} {
181
-
182
-// aD := exJDB.EJDBGetAddr(addr)
183
-// if aD.Addr == "" {
184
-// 	return nil
185
-// }
186
-// 	 return aD
187
-// }
188
-func (n *Node) GetRawMemPool() interface{} {
189
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
190
-	if jrc == nil {
191
-		fmt.Println("Error n status write")
192
-	}
193
-	bparams := []int{}
194
-	get, err := jrc.MakeRequest("getrawmempool", bparams)
195
-	if err != nil {
196
-		fmt.Println("Jorm Node Get Raw Mem Pool Error", err)
197
-	}
198
-	return get
199
-}
200
-
201
-func (n *Node) GetMiningInfo() interface{} {
202
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
203
-	if jrc == nil {
204
-		fmt.Println("Error n status write")
205
-	}
206
-	bparams := []int{}
207
-	get, err := jrc.MakeRequest("getmininginfo", bparams)
208
-	if err != nil {
209
-		fmt.Println("Jorm Node Get Mining Info Error", err)
210
-	}
211
-	return get
212
-}
213
-
214
-func (n *Node) GetInfo() interface{} {
215
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
216
-	if jrc == nil {
217
-		fmt.Println("Error n status write")
218
-	}
219
-	bparams := []int{}
220
-	get, err := jrc.MakeRequest("getinfo", bparams)
221
-	if err != nil {
222
-		fmt.Println("Jorm Node Get Info Error", err)
223
-	}
224
-	return get
225
-}
226
-func (n *Node) GetPeerInfo() interface{} {
227
-	jrc := utl.NewClient(n.RPCUser, n.RPCPassword, n.IP, n.Port)
228
-	if jrc == nil {
229
-		fmt.Println("Error n status write")
230
-	}
231
-	bparams := []int{}
232
-	get, err := jrc.MakeRequest("getpeerinfo", bparams)
233
-	if err != nil {
234
-		fmt.Println("Jorm Node Get Peer Info Error", err)
235
-	}
236
-	return get
237
-}

+ 223
- 0
exp/hndNodes.go View File

@@ -0,0 +1,223 @@
1
+package exp
2
+
3
+import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"net/http"
7
+	"strconv"
8
+	"strings"
9
+
10
+	"git.parallelcoin.io/marcetin/explorer/jdb"
11
+	"github.com/gorilla/mux"
12
+	"github.com/ip2location/ip2location-go"
13
+)
14
+
15
+func GetNodeStatus(w http.ResponseWriter, r *http.Request) {
16
+	// nd := cs.MainJDB.MJDBGetAll("nodes")
17
+	// for nd.Next() {
18
+	// 	var node Node
19
+	// 	err := nd.Decode(&node)
20
+	// 	if err != nil {
21
+	// 	}
22
+	// 	if node.BitNode {
23
+	// 		c := tools.NewClient(node.RPCUser, node.RPCPassword, node.IP, node.Port)
24
+	// 		//c := tools.NewClient("duo", "pass", "127.0.0.1", 11066)
25
+	// 		if c == nil {
26
+	// 			fmt.Println("Error node status write")
27
+	// 		}
28
+	// 		params := []string{}
29
+	// 		getinfo, err := c.MakeRequest("getinfo", params)
30
+	// 		if err != nil {
31
+	// 			fmt.Println("Error node status getinfo", err)
32
+	// 		}
33
+	// 		getpeerinfo, err := c.MakeRequest("getpeerinfo", params)
34
+	// 		if err != nil {
35
+	// 			fmt.Println("Error node status getpeerinfo", err)
36
+	// 		}
37
+	// 		// fmt.Println("getinfo", getinfo)
38
+	// 		var nodec Node
39
+	// 		nodec = node
40
+	// 		nodec.GetInfo = getinfo
41
+	// 		nodec.GetPeerInfo = getpeerinfo
42
+	// 		cs.MainJDB.MJDBSet("nodes", node.GPSID, nodec)
43
+	// 	}
44
+	// }
45
+}
46
+
47
+func GetNodes(w http.ResponseWriter, r *http.Request) {
48
+	v := mux.Vars(r)
49
+	rpcSource, err := jdb.JDB.ReadAll("data/" + v["coin"] + "/rpcsrc")
50
+	if err != nil {
51
+		fmt.Println("Error", err)
52
+	}
53
+	nodesList := make(map[string]Node)
54
+	errr := jdb.JDB.Read("data/"+v["coin"], "nodes", &nodesList)
55
+	if errr != nil {
56
+		fmt.Println("Error", errr)
57
+	}
58
+	for _, nd := range rpcSource {
59
+		var node Node
60
+		if err := json.Unmarshal([]byte(nd), &node); err != nil {
61
+			fmt.Println("Error", err)
62
+		}
63
+		var peers []interface{}
64
+		fmt.Println("Load Nodes Direct Connect", node.IP)
65
+		gpeers := RPCSRC(v["coin"]).GetPeerInfo()
66
+		if gpeers != nil {
67
+			switch gpeers.(type) {
68
+			case []interface{}:
69
+				peers = gpeers.([]interface{})
70
+				var peer map[string]interface{}
71
+				for _, gpeer := range peers {
72
+					peer = gpeer.(map[string]interface{})
73
+					peerAddress := peer["addr"].(string)
74
+					if node.IP != peerAddress {
75
+						splitted := strings.Split(peerAddress, ":")
76
+						peerPort := splitted[len(splitted)-1]
77
+						var peerIP string
78
+						for i := range splitted {
79
+							if i == len(splitted)-1 {
80
+								break
81
+							}
82
+							peerIP += splitted[i]
83
+							if i < len(splitted)-2 {
84
+								peerIP += ":"
85
+							}
86
+							pP, err := strconv.ParseInt(peerPort, 10, 64)
87
+							if err != nil {
88
+							}
89
+
90
+							RPCSRC(v["coin"]).AddNode(peerIP)
91
+							var nodec Node
92
+							nodec.Coin = node.Coin
93
+							nodec.IP = peerIP
94
+							nodec.Port = pP
95
+							nodesList[peerIP] = nodec
96
+							addNodesRaw := RPCSRC(v["coin"]).GetAddNodeInfo(nodec.IP)
97
+							addNodes := addNodesRaw.([]interface{})
98
+							for _, addNode := range addNodes {
99
+								an := addNode.(map[string]interface{})
100
+								nodesList[an["addednode"].(string)] = Node{
101
+									Coin: v["coin"],
102
+									IP:   an["addednode"].(string),
103
+								}
104
+
105
+							}
106
+
107
+							// fmt.Println("Load NodesCCCCCCCCCCCCCCCCC::", nodesList)
108
+
109
+							// cs.MainJDB.MJDBSet("nodes", GPSID, nodec)
110
+							// jdb.JDB.Write("nodes", nodec.Slug, nodec)
111
+							jdb.JDB.Write("data/"+v["coin"], "nodes", &nodesList)
112
+						}
113
+					}
114
+				}
115
+			}
116
+		}
117
+	}
118
+}
119
+
120
+// func GetNodesByCoin(coin string) (nodes []Node) {
121
+// 	cnodes, err := jdb.JDB.Read("data/coin/nodes")
122
+// 	if err != nil {
123
+// 		fmt.Println("Error", err)
124
+// 	}
125
+// 	for _, nd := range cnodes {
126
+// 		var node Node
127
+// 		if err := json.Unmarshal([]byte(nd), &node); err != nil {
128
+// 			fmt.Println("Error", err)
129
+// 		}
130
+// 		if node.Coin == coin {
131
+// 			nodes = append(nodes, node)
132
+// 		}
133
+// 	}
134
+// 	return
135
+// }
136
+
137
+func NodesMap(w http.ResponseWriter, r *http.Request) {
138
+	v := mux.Vars(r)
139
+	var nodesIPs []NodeMap
140
+	nodesList := make(map[string]Node)
141
+	errr := jdb.JDB.Read("data/"+v["coin"], "nodes", &nodesList)
142
+	if errr != nil {
143
+		fmt.Println("Error", errr)
144
+	}
145
+	for _, node := range nodesList {
146
+		var NodeMap NodeMap
147
+		ip2location.Open("./utl/IP2LOCATION-LITE-DB11.BIN")
148
+		results := ip2location.Get_all(node.IP)
149
+		NodeMap.Coin = v["coin"]
150
+		NodeMap.IP = node.IP
151
+		NodeMap.Country_short = results.Country_short
152
+		NodeMap.Country_long = results.Country_long
153
+		NodeMap.Region = results.Region
154
+		NodeMap.City = results.City
155
+		NodeMap.Latitude = results.Latitude
156
+		NodeMap.Longitude = results.Longitude
157
+		NodeMap.Zipcode = results.Zipcode
158
+		NodeMap.Timezone = results.Timezone
159
+		ip2location.Close()
160
+		nodesIPs = append(nodesIPs, NodeMap)
161
+	}
162
+	mapNodes := map[string]interface{}{
163
+		"nodes": nodesIPs,
164
+	}
165
+	nodes, err := json.Marshal(mapNodes)
166
+	if err != nil {
167
+		fmt.Println("Error encoding JSON")
168
+		return
169
+	}
170
+	w.Write([]byte(nodes))
171
+}
172
+
173
+// map[
174
+// 	addnode:false
175
+// 	addr:13.127.94.172:8333
176
+// 	addrbind:10.0.0.19:24854
177
+// 	addrlocal:212.62.35.158:56449
178
+// 	banscore:0
179
+// 	bytesrecv:6.532931e+06
180
+// 	bytesrecv_per_msg:
181
+// 		map[
182
+// 				addr:34892
183
+// 				cmpctblock:17439
184
+// 				feefilter:32
185
+// 				getdata:13934
186
+// 				getheaders:1053
187
+// 				headers:2756
188
+// 				inv:1.100541e+06
189
+// 				notfound:12829
190
+// 				ping:3552
191
+// 				pong:3552
192
+// 				reject:156
193
+// 				sendcmpct:66
194
+// 				sendheaders:24
195
+// 				tx:5.341954e+06
196
+// 				verack:24
197
+// 				version:127]
198
+// 				bytessent:2.076168e+06
199
+// 				bytessent_per_msg:
200
+// 					map[
201
+// 							addr:8375
202
+// 							feefilter:32
203
+// 							getaddr:24
204
+// 							getdata:528753
205
+// 							getheaders:1053
206
+// 							headers:954
207
+// 							inv:1.468165e+06
208
+// 							notfound:4092
209
+// 							ping:3552
210
+// 							pong:3552
211
+// 							reject:471 sendcmpct:66 sendheaders:24 tx:56905
212
+// 							verack:24
213
+// 							version:126] conntime:1.556680757e+09 id:154
214
+// 							inbound:false
215
+// 							inflight:[]
216
+// 							lastrecv:1.55669407e+09 lastsend:1.556694073e+09
217
+// 							minping:0.141898 pingtime:0.146475
218
+// 							relaytxes:true
219
+// 							services:000000000000000d
220
+// 							startingheight:574025 subver:/Satoshi:0.14.99/
221
+// 							synced_blocks:574051 synced_headers:574051
222
+// 							timeoffset:-18
223
+// 							version:70015 whitelisted:false]

+ 112
- 0
exp/hndVega.go View File

@@ -0,0 +1,112 @@
1
+package exp
2
+
3
+import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"net/http"
7
+
8
+	"git.parallelcoin.io/marcetin/explorer/jdb"
9
+	"github.com/gorilla/mux"
10
+)
11
+
12
+func GetChartData(w http.ResponseWriter, r *http.Request) {
13
+	v := mux.Vars(r)
14
+	var chartData []Addr
15
+	jdb.JDB.Read("data/"+v["coin"]+"/"+v["cat"], v["data"], &chartData)
16
+	var chartValues []Values
17
+	for _, c := range chartData {
18
+		chartValues = append(chartValues, Values{
19
+			Y: int(c.Value),
20
+		})
21
+	}
22
+	VVC := VizVegaChart{
23
+		Width:  640,
24
+		Height: 480,
25
+		Padding: Padding{
26
+			Top:    24,
27
+			Left:   48,
28
+			Bottom: 24,
29
+			Right:  0,
30
+		},
31
+		Data: []Data{
32
+			Data{
33
+				Name:   "table",
34
+				Values: chartValues,
35
+			},
36
+		},
37
+		Scales: []Scales{
38
+			Scales{
39
+				Name:  "x",
40
+				Type:  "ordinal",
41
+				Range: "width",
42
+				Domain: Domain{
43
+					Data:  "table",
44
+					Field: "x",
45
+				},
46
+			}, Scales{
47
+				Name:  "y",
48
+				Type:  "linear",
49
+				Range: "height",
50
+				Domain: Domain{
51
+					Data:  "table",
52
+					Field: "y",
53
+				},
54
+				Nice: true,
55
+			},
56
+		},
57
+		Axes: []Axes{
58
+			Axes{
59
+				Type:  "x",
60
+				Scale: "x",
61
+			}, Axes{
62
+				Type:  "y",
63
+				Scale: "y",
64
+			},
65
+		},
66
+		Marks: []Marks{
67
+			Marks{
68
+				Type: "rect",
69
+				From: From{
70
+					Data: "table",
71
+				},
72
+				Properties: Properties{
73
+					Enter: Enter{
74
+						X: X{
75
+							Scale: "x",
76
+							Field: "x",
77
+						},
78
+						Width: Width{
79
+							Scale:  "x",
80
+							Band:   true,
81
+							Offset: -1,
82
+						},
83
+						Y: Y{
84
+							Scale: "y",
85
+							Field: "y",
86
+						},
87
+						Y2: Y2{
88
+							Scale: "y",
89
+							Value: 0,
90
+						},
91
+					},
92
+					Update: Update{
93
+						Fill: Fill{
94
+							Value: "steelblue",
95
+						},
96
+					},
97
+					Hover: Hover{
98
+						Fill: Fill{
99
+							Value: "red",
100
+						},
101
+					},
102
+				},
103
+			},
104
+		},
105
+	}
106
+	out, err := json.Marshal(VVC)
107
+	if err != nil {
108
+		fmt.Println("Error encoding JSON")
109
+		return
110
+	}
111
+	w.Write([]byte(out))
112
+}

exp/rts.go → exp/hndl.go View File

@@ -9,17 +9,6 @@ import (
9 9
 	"github.com/gorilla/mux"
10 10
 )
11 11
 
12
-// var node = Node{
13
-// 	NodeID:      "xxxx",
14
-// 	Slug:        "xxxx",
15
-// 	RPCUser:     "user",
16
-// 	RPCPassword: "pass",
17
-// 	IP:          "127.0.0.1",
18
-// 	Port:        11122,
19
-// 	Published:   true,
20
-// }
21
-// var aNode = aNode()
22
-
23 12
 func ViewCoins(w http.ResponseWriter, r *http.Request) {
24 13
 	c := map[string]interface{}{
25 14
 		"d": map[string]interface{}{
@@ -40,10 +29,11 @@ func ViewBlocks(w http.ResponseWriter, r *http.Request) {
40 29
 	lb := map[string]interface{}{
41 30
 		"d": map[string]interface{}{
42 31
 			"currentPage": page,
43
-			"pageCount":   SrcNode(v["coin"]).GetBlockCount() / per,
44
-			"blocks":      SrcNode(v["coin"]).GetBlocks(per, page),
32
+			"pageCount":   RPCSRC(v["coin"]).GetBlockCount() / per,
33
+			"blocks":      RPCSRC(v["coin"]).GetBlocks(per, page),
45 34
 		},
46 35
 	}
36
+
47 37
 	out, err := json.Marshal(lb)
48 38
 	if err != nil {
49 39
 		fmt.Println("Error encoding JSON")
@@ -54,8 +44,7 @@ func ViewBlocks(w http.ResponseWriter, r *http.Request) {
54 44
 
55 45
 func ViewBlock(w http.ResponseWriter, r *http.Request) {
56 46
 	v := mux.Vars(r)
57
-	lastblock := SrcNode(v["coin"]).GetBlockCount()
58
-
47
+	lastblock := RPCSRC(v["coin"]).GetBlockCount()
59 48
 	bl := map[string]interface{}{
60 49
 		"d": lastblock,
61 50
 	}
@@ -72,25 +61,7 @@ func ViewBlockHeight(w http.ResponseWriter, r *http.Request) {
72 61
 	bh := v["blockheight"]
73 62
 	// node := Node{}
74 63
 	bhi, _ := strconv.Atoi(bh)
75
-	block := SrcNode(v["coin"]).GetBlockByHeight(bhi)
76
-	bl := map[string]interface{}{
77
-		"d": block,
78
-	}
79
-	out, err := json.Marshal(bl)
80
-	if err != nil {
81
-		fmt.Println("Error encoding JSON")
82
-		return
83
-	}
84
-	w.Write([]byte(out))
85
-}
86
-
87
-func ViewHeight(w http.ResponseWriter, r *http.Request) {
88
-	v := mux.Vars(r)
89
-	bh := v["blockheight"]
90
-	// node := Node{}
91
-
92
-	bhi, _ := strconv.Atoi(bh)
93
-	block := SrcNode(v["coin"]).GetBlockTxAddr(bhi)
64
+	block := RPCSRC(v["coin"]).GetBlockByHeight(bhi)
94 65
 	bl := map[string]interface{}{
95 66
 		"d": block,
96 67
 	}
@@ -105,11 +76,8 @@ func ViewHeight(w http.ResponseWriter, r *http.Request) {
105 76
 func ViewHash(w http.ResponseWriter, r *http.Request) {
106 77
 	v := mux.Vars(r)
107 78
 	bh := v["blockhash"]
108
-	// node := Node{}
109
-
110
-	block := SrcNode(v["coin"]).GetBlock(bh)
111
-	b := block.(map[string]interface{})
112
-	h := b["height"].(string)
79
+	block := RPCSRC(v["coin"]).GetBlock(bh)
80
+	h := block["height"].(string)
113 81
 	http.Redirect(w, r, "/a/block/"+h, 301)
114 82
 }
115 83
 
@@ -118,7 +86,7 @@ func ViewTx(w http.ResponseWriter, r *http.Request) {
118 86
 	txid := v["txid"]
119 87
 	// node := Node{}
120 88
 
121
-	tX := SrcNode(v["coin"]).GetTx(txid)
89
+	tX := RPCSRC(v["coin"]).GetTx(txid)
122 90
 
123 91
 	tx := map[string]interface{}{
124 92
 		"d": tX,
@@ -132,7 +100,7 @@ func ViewTx(w http.ResponseWriter, r *http.Request) {
132 100
 }
133 101
 func ViewRawMemPool(w http.ResponseWriter, r *http.Request) {
134 102
 	v := mux.Vars(r)
135
-	rawMemPool := SrcNode(v["coin"]).GetRawMemPool()
103
+	rawMemPool := RPCSRC(v["coin"]).GetRawMemPool()
136 104
 	rmp := map[string]interface{}{
137 105
 		"d": rawMemPool,
138 106
 	}
@@ -145,7 +113,7 @@ func ViewRawMemPool(w http.ResponseWriter, r *http.Request) {
145 113
 }
146 114
 func ViewMiningInfo(w http.ResponseWriter, r *http.Request) {
147 115
 	v := mux.Vars(r)
148
-	miningInfo := SrcNode(v["coin"]).GetMiningInfo()
116
+	miningInfo := RPCSRC(v["coin"]).GetMiningInfo()
149 117
 
150 118
 	mi := map[string]interface{}{
151 119
 		"d": miningInfo,
@@ -159,7 +127,7 @@ func ViewMiningInfo(w http.ResponseWriter, r *http.Request) {
159 127
 }
160 128
 func ViewInfo(w http.ResponseWriter, r *http.Request) {
161 129
 	v := mux.Vars(r)
162
-	info := SrcNode(v["coin"]).GetInfo()
130
+	info := RPCSRC(v["coin"]).GetInfo()
163 131
 
164 132
 	in := map[string]interface{}{
165 133
 		"d": info,
@@ -173,7 +141,7 @@ func ViewInfo(w http.ResponseWriter, r *http.Request) {
173 141
 }
174 142
 func ViewPeers(w http.ResponseWriter, r *http.Request) {
175 143
 	v := mux.Vars(r)
176
-	info := SrcNode(v["coin"]).GetPeerInfo()
144
+	info := RPCSRC(v["coin"]).GetPeerInfo()
177 145
 	pi := map[string]interface{}{
178 146
 		"d": info,
179 147
 	}
@@ -184,27 +152,3 @@ func ViewPeers(w http.ResponseWriter, r *http.Request) {
184 152
 	}
185 153
 	w.Write([]byte(out))
186 154
 }
187
-func ViewAddress(w http.ResponseWriter, r *http.Request) {
188
-	// vars := mux.Vars(r)
189
-
190
-	// addr := vars["addr"]
191
-	// node := GetBitNodes(coin)
192
-
193
-	// aD := node.GetAddr(addr)
194
-
195
-	// fmt.Println("343434343444", aD)
196
-	// sty, err := json.Marshal(aD)
197
-	// if err != nil {
198
-	// 	fmt.Println(string(sty), err.Error())
199
-	// }
200
-
201
-	address := map[string]interface{}{
202
-		// "d": aD,
203
-	}
204
-	out, err := json.Marshal(address)
205
-	if err != nil {
206
-		fmt.Println("Error encoding JSON")
207
-		return
208
-	}
209
-	w.Write([]byte(out))
210
-}

+ 0
- 101
exp/mod.go View File

@@ -1,101 +0,0 @@
1
-package exp
2
-
3
-import (
4
-	"encoding/json"
5
-	"fmt"
6
-
7
-	"git.parallelcoin.io/marcetin/explorer/amp"
8
-	"git.parallelcoin.io/marcetin/explorer/jdb"
9
-)
10
-
11
-type Config struct {
12
-	Title string          `json:"title"`
13
-	JDB   string          `json:"jdb"`
14
-	Coins map[string]Coin `json:"coins"`
15
-}
16
-type Coin struct {
17
-	Name string `json:"name"`
18
-	Slug string `json:"slug"`
19
-	Abbr string `json:"abbr"`
20
-	Icon string `json:"icon"`
21
-	X    int64  `json:"x"`
22
-}
23
-type Node struct {
24
-	NodeID      string `json:"nodeid" form:"nodeid"`
25
-	Coin        string `json:"coin" form:"coin"`
26
-	Slug        string `json:"slug"`
27
-	RPCUser     string `json:"rpcuser" form:"rpcuser"`
28
-	RPCPassword string `json:"rpcpassword" form:"rpcpassword"`
29
-	Address     string `json:"address" form:"address"`
30
-	IP          string `json:"ip" form:"ip"`
31
-	Port        int64  `json:"port" form:"port"`
32
-}
33
-
34
-type Block struct {
35
-	BlockHeight int    `json:"blockheight"`
36
-	BlockHash   string `json:"bhash"`
37
-	Data        []byte `json:"b"`
38
-}
39
-
40
-type Blk struct {
41
-	Block string `json:"b"`
42
-}
43
-type Tx struct {
44
-	TxHash string `json:"txhash""`
45
-	Data   []byte `json:"data"`
46
-}
47
-type Addr struct {
48
-	Addr  string  `json:"nodeid" form:"addr"`
49
-	Value float64 `json:"nodeid" form:"value"`
50
-	Rank  int     `json:"nodeid" form:"rank"`
51
-}
52
-type Index struct {
53
-	ID         string                   `json:"id"`
54
-	LastBlocks []map[string]interface{} `json:"lb"`
55
-	Coins      []Coin                   `json:"c"`
56
-	Blocks     []Block                  `json:"b"`
57
-	AMP        amp.AMP                  `json:"amp"`
58
-	RichList   map[string][]Addr        `json:"rich"`
59
-	// Node       *Node                    `json:"n"`
60
-}
61
-
62
-type BlVw struct {
63
-	ID    string  `json:"id"`
64
-	Block Block   `json:"block"`
65
-	AMP   amp.AMP `json:"amp"`
66
-}
67
-
68
-type TxVw struct {
69
-	ID  string  `json:"id"`
70
-	Tx  Tx      `json:"tx"`
71
-	AMP amp.AMP `json:"amp"`
72
-}
73
-
74
-type AdVw struct {
75
-	ID   string  `json:"id"`
76
-	Addr Addr    `json:"addr"`
77
-	AMP  amp.AMP `json:"amp"`
78
-}
79
-
80
-func SrcNode(c string) (n *Node) {
81
-	nodes, _ := jdb.JDB.ReadAll("data/" + c + "/nodes")
82
-	for _, nodeItem := range nodes {
83
-		fmt.Println("asassaaaaaaaa", c)
84
-		if err := json.Unmarshal([]byte(nodeItem), &n); err != nil {
85
-			fmt.Println("Error", err)
86
-		}
87
-	}
88
-	return
89
-}
90
-
91
-func Coins() (cs []Coin) {
92
-	coins, _ := jdb.JDB.ReadAll("coins")
93
-	for _, coinItem := range coins {
94
-		var c Coin
95
-		if err := json.Unmarshal([]byte(coinItem), &c); err != nil {
96
-			fmt.Println("Error", err)
97
-		}
98
-		cs = append(cs, c)
99
-	}
100
-	return
101
-}

+ 47
- 0
exp/modChain.go View File

@@ -0,0 +1,47 @@
1
+package exp
2
+
3
+import (
4
+
5
+)
6
+
7
+
8
+// type Block struct {
9
+// 	Bits              string   `json:"bits"`
10
+// 	Chainwork         string   `json:"chainwork"`
11
+// 	Confirmations     int64    `json:"confirmations"`
12
+// 	Difficulty        float64  `json:"difficulty"`
13
+// 	Hash              string   `json:"hash"`
14
+// 	Height            int64    `json:"height"`
15
+// 	Mediantime        int64    `json:"mediantime"`
16
+// 	Merkleroot        string   `json:"merkleroot"`
17
+// 	NTx               int      `json:"ntx"`
18
+// 	NextBlockHash     string   `json:"nextblockhash"`
19
+// 	Nonce             uint32   `json:"nonce"`
20
+// 	PreviousBlockHash string   `json:"previousblockhash"`
21
+// 	Size              int64    `json:"size"`
22
+// 	StrippedSize      int64    `json:"strippedsize"`
23
+// 	Time              int64    `json:"time"`
24
+// 	TX                []string `json:"tx"`
25
+// 	Version           int64    `json:"version"`
26
+// 	VersionHex        string   `json:"versionhex"`
27
+// 	Weight            int64    `json:"weight"`
28
+// }
29
+
30
+// type BlockShort struct {
31
+// 	Bits          string  `json:"bits"`
32
+// 	Confirmations int64   `json:"confirmations"`
33
+// 	Difficulty    float64 `json:"difficulty"`
34
+// 	Hash          string  `json:"hash"`
35
+// 	Height        int64   `json:"height"`
36
+// 	NTx           int     `json:"ntx"`
37
+// 	Size          int64   `json:"size"`
38
+// 	Time          int64   `json:"time"`
39
+// }
40
+
41
+type Addr struct {
42
+	Addr  string   `json:"addr" form:"addr"`
43
+	Value float64  `json:"value" form:"value"`
44
+ 	Txs   []string `json:"txs" form:"txs"`
45
+}
46
+
47
+

+ 21
- 0
exp/modNode.go View File

@@ -0,0 +1,21 @@
1
+package exp
2
+
3
+type Node struct {
4
+	Coin     string `json:"coin"`
5
+	IP       string `json:"ip"`
6
+	Port     int64  `json:"port"`
7
+	LastSeen string `json:"lastseen"`
8
+}
9
+
10
+type NodeMap struct {
11
+	Coin          string  `json:"coin" form:"coin"`
12
+	IP            string  `json:"ip" form:"ip"`
13
+	Country_short string  `"country_short" form:"country_short"`
14
+	Country_long  string  `json:"country_long" form:"country_long"`
15
+	Region        string  `json:"region" form:"region"`
16
+	City          string  `json:"city" form:"city"`
17
+	Latitude      float32 `json:"latitude" form:"latitude"`
18
+	Longitude     float32 `json:"longitude" form:"longitude"`
19
+	Zipcode       string  `json:"zipcode" form:"zipcode"`
20
+	Timezone      string  `json:"timezone" form:"timezone"`
21
+}

+ 47
- 0
exp/modSystem.go View File

@@ -0,0 +1,47 @@
1
+package exp
2
+
3
+import (
4
+	"git.parallelcoin.io/marcetin/explorer/amp"
5
+)
6
+
7
+type Config struct {
8
+	Title string          `json:"title"`
9
+	JDB   string          `json:"jdb"`
10
+	Coins map[string]Coin `json:"coins"`
11
+}
12
+type Coin struct {
13
+	Name string `json:"name"`
14
+	Slug string `json:"slug"`
15
+	Abbr string `json:"abbr"`
16
+	Icon string `json:"icon"`
17
+	X    int64  `json:"x"`
18
+}
19
+type RPCSource struct {
20
+	RPCSourceID string `json:"rpcsourceid" form:"rpcsourceid"`
21
+	Coin        string `json:"coin" form:"coin"`
22
+	Slug        string `json:"slug"`
23
+	RPCUser     string `json:"rpcuser" form:"rpcuser"`
24
+	RPCPassword string `json:"rpcpassword" form:"rpcpassword"`
25
+	IP          string `json:"ip" form:"ip"`
26
+	Port        int64  `json:"port" form:"port"`
27
+}
28
+
29
+
30
+type Index struct {
31
+	ID         string                   `json:"id"`
32
+	LastBlocks []map[string]interface{} `json:"lb"`
33
+	Coins      []Coin                   `json:"c"`
34
+	// Blocks     []Block                  `json:"b"`
35
+	AMP      amp.AMP           `json:"amp"`
36
+	RichList map[string][]Addr `json:"rich"`
37
+	// Node       *Node                    `json:"n"`
38
+}
39
+
40
+
41
+type Chart struct {
42
+	Coin     string      `json:"coin"`
43
+	Chart    string      `json:"chart"`
44
+	Category string      `json:"category"`
45
+	Data     string      `json:"data"`
46
+	CData    interface{} `json:"data"`
47
+}

+ 92
- 0
exp/modVega.go View File

@@ -0,0 +1,92 @@
1
+package exp
2
+
3
+type VizVegaChart struct {
4
+	Width   int      `json:"width"`
5
+	Height  int      `json:"height"`
6
+	Padding Padding  `json:"padding"`
7
+	Data    []Data   `json:"data"`
8
+	Scales  []Scales `json:"scales"`
9
+	Axes    []Axes   `json:"axes"`
10
+	Marks   []Marks  `json:"marks"`
11
+}
12
+
13
+type Padding struct {
14
+	Top    int `json:"top"`
15
+	Left   int `json:"left"`
16
+	Bottom int `json:"bottom"`
17
+	Right  int `json:"right"`
18
+}
19
+type Data struct {
20
+	Name   string   `json:"name"`
21
+	Values []Values `json:"values"`
22
+}
23
+type Values struct {
24
+	X int `json:"x"`
25
+	Y int `json:"y"`
26
+}
27
+
28
+type Scales struct {
29
+	Name   string `json:"name"`
30
+	Type   string `json:"type"`
31
+	Range  string `json:"range"`
32
+	Domain Domain `json:"domain"`
33
+	Nice   bool   `json:"nice,omitempty"`
34
+}
35
+
36
+type Domain struct {
37
+	Data  string `json:"data"`
38
+	Field string `json:"field"`
39
+}
40
+type Axes struct {
41
+	Type  string `json:"type"`
42
+	Scale string `json:"scale"`
43
+}
44
+
45
+type X struct {
46
+	Scale string `json:"scale"`
47
+	Field string `json:"field"`
48
+}
49
+
50
+type Width struct {
51
+	Scale  string `json:"scale"`
52
+	Band   bool   `json:"band"`
53
+	Offset int    `json:"offset"`
54
+}
55
+type Y struct {
56
+	Scale string `json:"scale"`
57
+	Field string `json:"field"`
58
+}
59
+type Y2 struct {
60
+	Scale string `json:"scale"`
61
+	Value int    `json:"value"`
62
+}
63
+type Enter struct {
64
+	X     X     `json:"x"`
65
+	Width Width `json:"width"`
66
+	Y     Y     `json:"y"`
67
+	Y2    Y2    `json:"y2"`
68
+}
69
+type Fill struct {
70
+	Value string `json:"value"`
71
+}
72
+type Update struct {
73
+	Fill Fill `json:"fill"`
74
+}
75
+type Hover struct {
76
+	Fill struct {
77
+		Value string `json:"value"`
78
+	} `json:"fill"`
79
+}
80
+type Properties struct {
81
+	Enter  Enter  `json:"enter"`
82
+	Update Update `json:"update"`
83
+	Hover  Hover  `json:"hover"`
84
+}
85
+type From struct {
86
+	Data string `json:"data"`
87
+}
88
+type Marks struct {
89
+	Type       string     `json:"type"`
90
+	From       From       `json:"from"`
91
+	Properties Properties `json:"properties"`
92
+}

+ 208
- 0
exp/rpcBlock.go View File

@@ -0,0 +1,208 @@
1
+package exp
2
+
3
+import (
4
+	"fmt"
5
+	"strconv"
6
+	"time"
7
+
8
+	"git.parallelcoin.io/marcetin/explorer/utl"
9
+)
10
+
11
+func (rpc *RPCSource) GetBlockCount() (b int) {
12
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
13
+	if jrc == nil {
14
+		fmt.Println("Error n status write")
15
+	}
16
+	bparams := []int{}
17
+	gbc, err := jrc.MakeRequest("getblockcount", bparams)
18
+	if err != nil {
19
+		fmt.Println("Error n call: ", err)
20
+
21
+	}
22
+	switch gbc.(type) {
23
+	case float64:
24
+		return int(gbc.(float64))
25
+	case string:
26
+		b, _ := strconv.Atoi(gbc.(string))
27
+		return b
28
+	default:
29
+		b, _ := strconv.Atoi(gbc.(string))
30
+		return b
31
+	}
32
+	return
33
+}
34
+
35
+func (rpc *RPCSource) GetBlocks(per, page int) (blocks []map[string]interface{}) {
36
+	fmt.Println("asassaaaablockCountblockCountaaaa", rpc)
37
+	blockCount := rpc.GetBlockCount()
38
+
39
+	startBlock := blockCount - per*page
40
+	minusBlockStart := int(startBlock - per)
41
+	for ibh := startBlock; ibh >= minusBlockStart; {
42
+		blocks = append(blocks, RPCSRC(rpc.Coin).GetBlockShortByHeight(ibh))
43
+		ibh--
44
+	}
45
+	return blocks
46
+}
47
+
48
+func (rpc *RPCSource) GetBlock(blockhash string) map[string]interface{} {
49
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
50
+	if jrc == nil {
51
+		fmt.Println("Error n status write")
52
+	}
53
+	bparams := []string{blockhash}
54
+	rawb, err := jrc.MakeRequest("getblock", bparams)
55
+	if err != nil {
56
+		fmt.Println("Jorm Node Get Block Error", err)
57
+	}
58
+	b := rawb.(map[string]interface{})
59
+	block := make(map[string]interface{})
60
+	if b["bits"] != nil {
61
+		block["bits"] = b["bits"].(string)
62
+	}
63
+	if b["chainwork"] != nil {
64
+		block["chainwork"] = b["chainwork"].(string)
65
+	}
66
+	if b["confirmations"] != nil {
67
+		block["confirmations"] = int64(b["confirmations"].(float64))
68
+	}
69
+	if b["difficulty"] != nil {
70
+		block["difficulty"] = b["difficulty"].(float64)
71
+	}
72
+	if b["hash"] != nil {
73
+		block["hash"] = b["hash"].(string)
74
+	}
75
+	if b["height"] != nil {
76
+		block["height"] = int64(b["height"].(float64))
77
+	}
78
+	if b["mediantime"] != nil {
79
+		block["mediantime"] = int64(b["mediantime"].(float64))
80
+	}
81
+	if b["merkleroot"] != nil {
82
+		block["merkleroot"] = b["merkleroot"].(string)
83
+	}
84
+	if b["nTx"] != nil {
85
+		block["ntx"] = int(b["nTx"].(float64))
86
+	}
87
+	if b["nextblockhash"] != nil {
88
+		block["nextblockhash"] = b["nextblockhash"].(string)
89
+	}
90
+	if b["nonce"] != nil {
91
+		block["nonce"] = int64(b["nonce"].(float64))
92
+	}
93
+	if b["previousblockhash"] != nil {
94
+		block["previousblockhash"] = b["previousblockhash"].(string)
95
+	}
96
+	if b["size"] != nil {
97
+		block["size"] = int64(b["size"].(float64))
98
+	}
99
+	if b["strippedsize"] != nil {
100
+		block["strippedsize"] = int64(b["strippedsize"].(float64))
101
+	}
102
+	if b["time"] != nil {
103
+		unixTimeUTC := time.Unix(int64(b["time"].(float64)), 0)
104
+		block["time"] = unixTimeUTC.Format(time.RFC850)
105
+		block["timeutc"] = unixTimeUTC.Format(time.RFC3339)
106
+	}
107
+	if b["tx"] != nil {
108
+		txsRaw := b["tx"].([]interface{})
109
+		var txs []string
110
+		for _, t := range txsRaw {
111
+			txs = append(txs, t.(string))
112
+		}
113
+		block["tx"] = txs
114
+	}
115
+	if b["version"] != nil {
116
+		block["version"] = int64(b["version"].(float64))
117
+	}
118
+	if b["versionHex"] != nil {
119
+		block["versionhex"] = b["versionHex"].(string)
120
+	}
121
+	if b["weight"] != nil {
122
+		block["weight"] = int64(b["weight"].(float64))
123
+	}
124
+
125
+	if b["pow_algo"] != nil {
126
+		block["pow_algo"] = b["pow_algo"].(string)
127
+	}
128
+	if b["pow_hash"] != nil {
129
+		block["pow_hash"] = b["pow_hash"].(string)
130
+	}
131
+	if b["pow_algo_id"] != nil {
132
+		block["pow_algo_id"] = int64(b["pow_algo_id"].(float64))
133
+	}
134
+
135
+	return block
136
+}
137
+
138
+func (rpc *RPCSource) GetBlockShort(blockhash string) map[string]interface{} {
139
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
140
+	if jrc == nil {
141
+		fmt.Println("Error n status write")
142
+	}
143
+	bparams := []string{blockhash}
144
+	rawb, err := jrc.MakeRequest("getblock", bparams)
145
+	if err != nil {
146
+		fmt.Println("Jorm Node Get Block Error", err)
147
+	}
148
+	b := rawb.(map[string]interface{})
149
+	block := make(map[string]interface{})
150
+	if b["bits"] != nil {
151
+		block["bits"] = b["bits"].(string)
152
+	}
153
+	if b["confirmations"] != nil {
154
+		block["confirmations"] = int64(b["confirmations"].(float64))
155
+	}
156
+	if b["difficulty"] != nil {
157
+		block["difficulty"] = b["difficulty"].(float64)
158
+	}
159
+	if b["hash"] != nil {
160
+		block["hash"] = b["hash"].(string)
161
+	}
162
+	if b["height"] != nil {
163
+		block["height"] = int64(b["height"].(float64))
164
+	}
165
+	if b["nTx"] != nil {
166
+		block["ntx"] = int(b["nTx"].(float64))
167
+	}
168
+	if b["size"] != nil {
169
+		block["size"] = int64(b["size"].(float64))
170
+	}
171
+	if b["time"] != nil {
172
+		unixTimeUTC := time.Unix(int64(b["time"].(float64)), 0)
173
+		block["time"] = unixTimeUTC.Format(time.RFC850)
174
+		block["timeutc"] = unixTimeUTC.Format(time.RFC3339)
175
+	}
176
+	return block
177
+}
178
+func (rpc *RPCSource) GetBlockShortByHeight(blockheight int) (block map[string]interface{}) {
179
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
180
+	if jrc == nil {
181
+		fmt.Println("Error n status write")
182
+	}
183
+	bparams := []int{blockheight}
184
+	blockHash, err := jrc.MakeRequest("getblockhash", bparams)
185
+	if err != nil {
186
+		fmt.Println("Jorm Node Get Block By Height Error", err)
187
+	}
188
+	if blockHash != nil {
189
+		block = rpc.GetBlockShort((blockHash).(string))
190
+	}
191
+	return block
192
+}
193
+
194
+func (rpc *RPCSource) GetBlockByHeight(blockheight int) (block map[string]interface{}) {
195
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
196
+	if jrc == nil {
197
+		fmt.Println("Error n status write")
198
+	}
199
+	bparams := []int{blockheight}
200
+	blockHash, err := jrc.MakeRequest("getblockhash", bparams)
201
+	if err != nil {
202
+		fmt.Println("Jorm Node Get Block By Height Error", err)
203
+	}
204
+	if blockHash != nil {
205
+		block = rpc.GetBlock((blockHash).(string))
206
+	}
207
+	return block
208
+}

+ 85
- 0
exp/rpcInfo.go View File

@@ -0,0 +1,85 @@
1
+package exp
2
+
3
+import (
4
+	"fmt"
5
+
6
+	"git.parallelcoin.io/marcetin/explorer/utl"
7
+)
8
+
9
+func (rpc *RPCSource) GetRawMemPool() interface{} {
10
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
11
+	if jrc == nil {
12
+		fmt.Println("Error n status write")
13
+	}
14
+	bparams := []int{}
15
+	get, err := jrc.MakeRequest("getrawmempool", bparams)
16
+	if err != nil {
17
+		fmt.Println("Jorm Node Get Raw Mem Pool Error", err)
18
+	}
19
+	return get
20
+}
21
+
22
+func (rpc *RPCSource) GetMiningInfo() interface{} {
23
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
24
+	if jrc == nil {
25
+		fmt.Println("Error n status write")
26
+	}
27
+	bparams := []int{}
28
+	get, err := jrc.MakeRequest("getmininginfo", bparams)
29
+	if err != nil {
30
+		fmt.Println("Jorm Node Get Mining Info Error", err)
31
+	}
32
+	return get
33
+}
34
+
35
+func (rpc *RPCSource) GetInfo() interface{} {
36
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
37
+	if jrc == nil {
38
+		fmt.Println("Error n status write")
39
+	}
40
+	bparams := []int{}
41
+	get, err := jrc.MakeRequest("getinfo", bparams)
42
+	if err != nil {
43
+		fmt.Println("Jorm Node Get Info Error", err)
44
+	}
45
+	return get
46
+}
47
+func (rpc *RPCSource) GetPeerInfo() interface{} {
48
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
49
+	if jrc == nil {
50
+		fmt.Println("Error n status write")
51
+	}
52
+	bparams := []int{}
53
+	get, err := jrc.MakeRequest("getpeerinfo", bparams)
54
+	if err != nil {
55
+		fmt.Println("Jorm Node Get Peer Info Error", err)
56
+	}
57
+	return get
58
+}
59
+
60
+func (rpc *RPCSource) AddNode(ip string) interface{} {
61
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
62
+	if jrc == nil {
63
+		fmt.Println("Error n status write")
64
+	}
65
+
66
+	bparams := []string{ip, "add"}
67
+	get, err := jrc.MakeRequest("addnode", bparams)
68
+	if err != nil {
69
+		fmt.Println("Jorm Node Get Peer Info Error", err)
70
+	}
71
+	return get
72
+}
73
+
74
+func (rpc *RPCSource) GetAddNodeInfo(ip string) interface{} {
75
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
76
+	if jrc == nil {
77
+		fmt.Println("Error n status write")
78
+	}
79
+	bparams := []int{}
80
+	get, err := jrc.MakeRequest("getaddednodeinfo", bparams)
81
+	if err != nil {
82
+		fmt.Println("Jorm Node Get Peer Info Error", err)
83
+	}
84
+	return get
85
+}

+ 106
- 0
exp/src.go View File

@@ -0,0 +1,106 @@
1
+package exp
2
+
3
+import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"net/http"
7
+
8
+	"git.parallelcoin.io/marcetin/explorer/utl"
9
+	"github.com/gorilla/mux"
10
+
11
+	"git.parallelcoin.io/marcetin/explorer/jdb"
12
+	"git.parallelcoin.io/marcetin/explorer/tpl"
13
+)
14
+
15
+func RPCSRC(c string) (rpc *RPCSource) {
16
+	rpcSources, _ := jdb.JDB.ReadAll("data/" + c + "/rpcsrc")
17
+	for _, rpcSrc := range rpcSources {
18
+		if err := json.Unmarshal([]byte(rpcSrc), &rpc); err != nil {
19
+			fmt.Println("Error", err)
20
+		}
21
+	}
22
+	return
23
+}
24
+
25
+func Coins() (cs []Coin) {
26
+	coins, _ := jdb.JDB.ReadAll("coins")
27
+	for _, coinItem := range coins {
28
+		var c Coin
29
+		if err := json.Unmarshal([]byte(coinItem), &c); err != nil {
30
+			fmt.Println("Error", err)
31
+		}
32
+		cs = append(cs, c)
33
+	}
34
+	return
35
+}
36
+func ViewAddress(w http.ResponseWriter, r *http.Request) {
37
+	v := mux.Vars(r)
38
+	var addrs map[uint32]Addr
39
+	jdb.JDB.Read("data/"+v["coin"]+"/addrs", "full", &addrs)
40
+	addrHash := hash(v["addr"])
41
+	addr := addrs[addrHash]
42
+	// var a Addr
43
+	txS := make(map[string]interface{})
44
+
45
+	// for _, txID := range addr.Txs {
46
+	// 	// tx := RPCSRC(v["coin"]).GetTx(txID)
47
+	// 	// if tx["vout"] != nil {
48
+	// 	// 	txS["vout"] = tx["vout"].([]interface{})
49
+	// 	// }
50
+	// 	// if tx["vin"] != nil {
51
+	// 	// 	txS["vin"] = tx["vin"].([]interface{})
52
+	// 	// }
53
+	// 	// if tx["time"] != nil {
54
+	// 	// 	txS["time"] = tx["time"]
55
+	// 	// }
56
+	// }
57
+	a := map[string]interface{}{
58
+		"d": []interface{}{addr, txS},
59
+	}
60
+	out, err := json.Marshal(a)
61
+	if err != nil {
62
+		fmt.Println("Error encoding JSON")
63
+		return
64
+	}
65
+	w.Write([]byte(out))
66
+}
67
+
68
+func GetData(w http.ResponseWriter, r *http.Request) {
69
+	v := mux.Vars(r)
70
+	var rawData map[uint32]interface{}
71
+	jdb.JDB.Read("data/"+v["coin"]+"/"+v["cat"], v["data"], &rawData)
72
+	data := map[string]interface{}{
73
+		"coin":     v["coin"],
74
+		"category": v["cat"],
75
+		"d":        rawData,
76
+	}
77
+	fmt.Println("Error encdsfsdfsdfsdfsdfON", rawData)
78
+
79
+	out, err := json.Marshal(data)
80
+	if err != nil {
81
+		fmt.Println("Error encoding JSON")
82
+		return
83
+	}
84
+	w.Write([]byte(out))
85
+}
86
+
87
+func GetChart(w http.ResponseWriter, r *http.Request) {
88
+	v := mux.Vars(r)
89
+	var rich map[uint32]Addr
90
+	jdb.JDB.Read("data/"+v["coin"]+"/"+v["cat"], v["data"], &rich)
91
+	data := Chart{
92
+		Coin:     v["coin"],
93
+		Chart:    v["chart"],
94
+		Category: v["cat"],
95
+		Data:     v["data"],
96
+		CData:    rich,
97
+		// Template: tpl.TPLHandler().Templates,
98
+	}
99
+	// fmt.Println("ssssssssssssssssssssssssasasas", data)
100
+	tpl.TPLHandler().ExecuteTemplate(w, v["chart"]+"_gohtml", data)
101
+}
102
+
103
+func GetAddrsList(w http.ResponseWriter, r *http.Request) {
104
+	v := mux.Vars(r)
105
+	utl.SendJsonResponse(w, CreateAddrsList(v["coin"]))
106
+}

+ 117
- 0
exp/txs.go View File

@@ -0,0 +1,117 @@
1
+package exp
2
+
3
+import (
4
+	"fmt"
5
+
6
+	"git.parallelcoin.io/marcetin/explorer/utl"
7
+)
8
+
9
+func (rpc *RPCSource) GetTx(txid string) map[string]interface{} {
10
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
11
+	if jrc == nil {
12
+		fmt.Println("Error n status write")
13
+	}
14
+	verbose := int(1)
15
+	var grtx []interface{}
16
+	grtx = append(grtx, txid)
17
+	grtx = append(grtx, verbose)
18
+	rawt, err := jrc.MakeRequest("getrawtransaction", grtx)
19
+	if err != nil {
20
+		fmt.Println("Jorm Node Get Tx Error", err)
21
+	}
22
+	fmt.Println("Ersssss", txid)
23
+
24
+	t := rawt.(map[string]interface{})
25
+	tx := make(map[string]interface{})
26
+
27
+	if t["blockhash"] != nil {
28
+		tx["blockhash"] = t["blockhash"].(string)
29
+	}
30
+	if t["chainwork"] != nil {
31
+		tx["chainwork"] = t["chainwork"].(string)
32
+	}
33
+	if t["blocktime"] != nil {
34
+		tx["blocktime"] = int64(t["blocktime"].(float64))
35
+	}
36
+	if t["confirmations"] != nil {
37
+		tx["confirmations"] = int64(t["confirmations"].(float64))
38
+	}
39
+	if t["difficulty"] != nil {
40
+		tx["difficulty"] = t["difficulty"].(float64)
41
+	}
42
+	if t["hash"] != nil {
43
+		tx["hash"] = t["hash"].(string)
44
+	}
45
+	if t["hex"] != nil {
46
+		tx["hex"] = t["hex"].(string)
47
+	}
48
+	if t["locktime"] != nil {
49
+		tx["locktime"] = int64(t["locktime"].(float64))
50
+	}
51
+	if t["size"] != nil {
52
+		tx["size"] = int64(t["size"].(float64))
53
+	}
54
+	if t["time"] != nil {
55
+		tx["time"] = int64(t["time"].(float64))
56
+	}
57
+	if t["txid"] != nil {
58
+		tx["txid"] = t["txid"].(string)
59
+	}
60
+	if t["version"] != nil {
61
+		tx["version"] = int64(t["version"].(float64))
62
+	}
63
+	if t["vin"] != nil {
64
+		tx["vin"] = t["vin"].([]interface{})
65
+	}
66
+	if t["vout"] != nil {
67
+		tx["vout"] = t["vout"].([]interface{})
68
+	}
69
+	if t["vsize"] != nil {
70
+		tx["vsize"] = int64(t["vsize"].(float64))
71
+	}
72
+	if t["weight"] != nil {
73
+		tx["weight"] = int64(t["weight"].(float64))
74
+	}
75
+	return tx
76
+}
77
+
78
+func (rpc *RPCSource) GetBlockTxAddr(blockheight int) interface{} {
79
+	jrc := utl.NewClient(rpc.RPCUser, rpc.RPCPassword, rpc.IP, rpc.Port)
80
+	if jrc == nil {
81
+		fmt.Println("Error n status write")
82
+	}
83
+	bparams := []int{blockheight}
84
+	blockHash, err := jrc.MakeRequest("getblockhash", bparams)
85
+	if err != nil {
86
+		fmt.Println("Jorm Node Get Block Tx Addr Error", err)
87
+	}
88
+	var block interface{}
89
+	var txs []interface{}
90
+	if blockHash != nil {
91
+		block = rpc.GetBlock((blockHash).(string))
92
+	}
93
+
94
+	iblock := make(map[string]interface{})
95
+	iblock = block.(map[string]interface{})
96
+	itxs := iblock["tx"].([]interface{})
97
+	for _, itx := range itxs {
98
+		var txid string
99
+		txid = itx.(string)
100
+
101
+		verbose := int(1)
102
+		var grtx []interface{}
103
+		grtx = append(grtx, txid)
104
+		grtx = append(grtx, verbose)
105
+		rtx, err := jrc.MakeRequest("getrawtransaction", grtx)
106
+		if err != nil {
107
+			fmt.Println("Jorm Node Get Block Tx Addr Tx Error", err)
108
+		}
109
+		txs = append(txs, rtx)
110
+
111
+	}
112
+	blocktxaddr := map[string]interface{}{
113
+		"b": block,
114
+		"t": txs,
115
+	}
116
+	return blocktxaddr
117
+}

+ 2
- 77
rts/hnd.go View File

@@ -2,93 +2,18 @@ package rts
2 2
 
3 3
 import (
4 4
 	"net/http"
5
-	"sort"
6 5
 
7 6
 	"git.parallelcoin.io/marcetin/explorer/amp"
8 7
 	"git.parallelcoin.io/marcetin/explorer/exp"
9
-	"git.parallelcoin.io/marcetin/explorer/jdb"
10 8
 	"git.parallelcoin.io/marcetin/explorer/tpl"
11 9
 )
12 10
 
13
-type ByValue []exp.Addr
14
-
15
-func (a ByValue) Len() int           { return len(a) }
16
-func (a ByValue) Less(i, j int) bool { return a[i].Value < a[j].Value }
17
-func (a ByValue) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
18
-
19
-func richListSingles(l []exp.Addr) (f []exp.Addr) {
20
-	i := 1
21
-	for _, r := range l {
22
-		if len(r.Addr) > 20 {
23
-			f = append(f, exp.Addr{r.Addr, r.Value, i})
24
-		}
25
-		i++
26
-	}
27
-	return f
28
-}
29
-func richListGrouped(l []exp.Addr) (f []exp.Addr) {
30
-	i := 1
31
-	for _, r := range l {
32
-		if len(r.Addr) < 20 {
33
-			f = append(f, exp.Addr{r.Addr, r.Value, i})
34
-		}
35
-		i++
36
-	}
37
-	return f
38
-}
39
-
40 11
 func HomeHandler(w http.ResponseWriter, r *http.Request) {
41
-	var rich = make(map[string]float64)
42
-	var richFullGet = make(map[string]float64)
43
-	jdb.JDB.Read("addrs", "addrs", &richFullGet)
44
-	for r, m := range richFullGet {
45
-		if m < 10 {
46
-			rich["Less than 10"] += m
47
-		}
48
-		if m < 100 {
49
-			rich["Less than 100"] += m
50
-		}
51
-		if m < 1000 {
52
-			rich["Less than 1000"] += m
53
-		}
54
-		if m < 3000 {
55
-			rich["Less than 3000"] += m
56
-		}
57
-		if m < 5000 {
58
-			rich["Less than 5000"] += m
59
-		}
60
-		if m < 10000 {
61
-			rich["Less than 10000"] += m
62
-		}
63
-		if m > 10000 {
64
-			rich["More than 10000"] += m
65
-			rich[r] = m
66
-		}
67
-	}
68
-	richListToSort := []exp.Addr{}
69
-	i := 1
70
-	for k, r := range rich {
71
-		richListToSort = append(richListToSort, exp.Addr{k, r, i})
72
-		i++
73
-	}
74
-	sort.Sort(sort.Reverse(ByValue(richListToSort)))
75
-	richListSort := []exp.Addr{}
76
-	ii := 1
77
-	for _, r := range richListToSort {
78
-		richListSort = append(richListSort, exp.Addr{r.Addr, r.Value, ii})
79
-		ii++
80
-	}
81
-	richList := map[string][]exp.Addr{
82
-		"full":    richListSort,
83
-		"singles": richListSingles(richListToSort),
84
-		"grouped": richListGrouped(richListToSort),
85
-	}
86
-
87 12
 	data := exp.Index{
88 13
 		Coins: exp.Coins(),
89 14
 		// Blocks:   []exp.Block{},
90
-		AMP:      amp.AMPS(),
91
-		RichList: richList,
15
+		AMP: amp.AMPS(),
16
+		// RichList: richList,
92 17
 	}
93 18
 	tpl.TPLHandler().ExecuteTemplate(w, "base_gohtml", data)
94 19
 }

+ 0
- 61
rts/node.go View File

@@ -1,61 +0,0 @@
1
-package rts
2
-
3
-import (
4
-	"fmt"
5
-	"net/http"
6
-	"strconv"
7
-
8
-	"git.parallelcoin.io/marcetin/explorer/exp"
9
-	"git.parallelcoin.io/marcetin/explorer/jdb"
10
-	"git.parallelcoin.io/marcetin/explorer/utl"
11
-)
12
-
13
-// func Start(w http.ResponseWriter, r *http.Request) {
14
-// 	cf := coinAdd(r)
15
-// 	c := coinAdd(r)
16
-// 	n := nodeAdd(r)
17
-// 	jr := map[string]interface{}{
18
-// 		"conf": cf,
19
-// 		"coin": c,
20
-// 		"node": n,
21
-// 	}
22
-// 	w.Header().Set("AMP-Redirect-To", "http://localhost:4000/")
23
-// 	w.Header().Set("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To")
24
-// 	SendJsonResponse(w, jr)
25
-// }
26
-
27
-func AddCoin(w http.ResponseWriter, r *http.Request) {
28
-	c := coinAdd(r)
29
-	w.Header().Set("AMP-Redirect-To", "http://localhost:4000/")
30
-	w.Header().Set("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To")
31
-	SendJsonResponse(w, c)
32
-}
33
-
34
-func coinAdd(r *http.Request) (c exp.Coin) {
35
-	c.Name = r.FormValue("name")
36
-	c.Slug = utl.MakeSlug(c.Name)
37
-	c.Abbr = r.FormValue("abbr")
38
-	c.X, _ = strconv.ParseInt(r.FormValue("x"), 10, 64)
39
-	jdb.JDB.Write("coins/", c.Slug, c)
40
-	return c
41
-}
42
-func nodeAdd(r *http.Request) (n exp.Node) {
43
-	n.Coin = r.FormValue("coin")
44
-	fmt.Println("asassaaaablockCountblockCountaaaa", n.Coin)
45
-
46
-	n.NodeID = r.FormValue("nodeid")
47
-	n.Slug = utl.MakeSlug(n.NodeID)
48
-	n.RPCUser = r.FormValue("rpcuser")
49
-	n.RPCPassword = r.FormValue("rpcpassword")
50
-	n.IP = r.FormValue("ip")
51
-	n.Port, _ = strconv.ParseInt(r.FormValue("port"), 10, 64)
52
-	jdb.JDB.Write("data/"+n.Coin+"/nodes", n.Slug, n)
53
-	return n
54
-}
55
-
56
-func AddNode(w http.ResponseWriter, r *http.Request) {
57
-	n := nodeAdd(r)
58
-	w.Header().Set("AMP-Redirect-To", "http://localhost:4000/")
59
-	w.Header().Set("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To")
60
-	SendJsonResponse(w, n)
61
-}

+ 26
- 22
rts/rts.go View File

@@ -1,41 +1,27 @@
1 1
 package rts
2 2
 
3 3
 import (
4
+	"net/http"
5
+
4 6
 	"git.parallelcoin.io/marcetin/explorer/exp"
7
+	"git.parallelcoin.io/marcetin/explorer/utl"
5 8
 	"github.com/gorilla/mux"
6 9
 )
7 10
 
8 11
 func RTS() *mux.Router {
9 12
 	r := mux.NewRouter().StrictSlash(false)
10 13
 	r.HandleFunc("/", HomeHandler)
11
-	// r.HandleFunc("/block/{id}", viewBlock)
12
-	// r.HandleFunc("/blockhash/{blockhash}", viewBlockHash)
13
-	// r.HandleFunc("/tx/{id}", viewTx)
14
-	// r.HandleFunc("/addr/{id}", viewAddr)
15
-
16
-	// crs := cors.New(cors.Options{
17
-	// 	AllowedOrigins:   []string{"*"}, // allows everything, use that to change the hosts.
18
-	// 	AllowCredentials: true,
19
-	// })
20
-
21
-	////////////////
22
-
23
-	// r.HandleFunc("/{coin}/last", apiLast)
24
-	// r.HandleFunc("/{coin}/info", apiInfo)
25
-	// r.HandleFunc("/{coin}/mining", apiMiningInfo)
26
-	// r.HandleFunc("/{coin}/rawpool", apiRawPool)
27
-	// r.HandleFunc("/search", doSearch)
28
-
29
-	//////////////
30 14
 	a := r.PathPrefix("/a").Subrouter()
31
-	r.HandleFunc("/addcoin", EnableCors(AddCoin)).Methods("POST")
15
+
32 16
 	a.HandleFunc("/coins", exp.ViewCoins).Methods("GET")
17
+	a.HandleFunc("/addcoin", utl.EnableCors(exp.AddCoin)).Methods("POST")
18
+
19
+	a.HandleFunc("/{coin}/addrpcsrc", utl.EnableCors(exp.AddRPCSource)).Methods("POST")
33 20
 
34
-	r.HandleFunc("/{coin}/addnode", EnableCors(AddNode)).Methods("POST")
35 21
 	a.HandleFunc("/{coin}/blocks/{per}/{page}", exp.ViewBlocks).Methods("GET")
36 22
 	a.HandleFunc("/{coin}/b", exp.ViewBlock).Methods("GET")
37 23
 	a.HandleFunc("/{coin}/block/{blockheight}", exp.ViewBlockHeight).Methods("GET")
38
-	a.HandleFunc("/{coin}/b/{blockheight}", exp.ViewHeight).Methods("GET")
24
+	a.HandleFunc("/{coin}/b/{blockheight}", exp.ViewBlockHeight).Methods("GET")
39 25
 	a.HandleFunc("/{coin}/hash/{blockhash}", exp.ViewHash).Methods("GET")
40 26
 
41 27
 	a.HandleFunc("/{coin}/tx/{txid}", exp.ViewTx).Methods("GET")
@@ -45,6 +31,24 @@ func RTS() *mux.Router {
45 31
 	a.HandleFunc("/{coin}/peer", exp.ViewPeers).Methods("GET")
46 32
 	a.HandleFunc("/{coin}/addr/{addr}", exp.ViewAddress).Methods("GET")
47 33
 
34
+	a.HandleFunc("/{coin}/getrichlist", exp.GetAddrsList).Methods("GET")
35
+	a.HandleFunc("/{coin}/getnodes", exp.GetNodes).Methods("GET")
36
+
37
+	a.HandleFunc("/{coin}/nodes", exp.NodesMap).Methods("GET")
38
+
39
+	c := r.PathPrefix("/c").Subrouter()
40
+	c.HandleFunc("/{coin}/{chart}/{cat}/{data}", exp.GetChart).Methods("GET")
41
+
42
+	// c.HandleFunc("/{coin}/{chart}/{cat}/{data}", exp.GetChart).Methods("GET")
43
+	j := r.PathPrefix("/j").Subrouter()
44
+	j.HandleFunc("/{coin}/{cat}/{data}", exp.GetChartData).Methods("GET")
45
+
46
+	d := r.PathPrefix("/d").Subrouter()
47
+	d.HandleFunc("/{coin}/{cat}/{data}", exp.GetData).Methods("GET")
48
+
49
+	s := r.PathPrefix("/s").Subrouter()
50
+	s.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("./tpl/static/"))))
51
+
48 52
 	// r.HandleFunc("/{coin}/{type}/{id}", apiData)
49 53
 	return r
50 54
 }

+ 244
- 88
tpl/fls/css/style.css View File

@@ -7,6 +7,9 @@
7 7
   --color-error: #B00020;
8 8
   --color-bg-light: #fcfcfc;
9 9
   
10
+  --trans-light-1: rgba(207,207,207, .62);
11
+  --trans-dark-1: rgba(48,48,48,.62);
12
+
10 13
   --space-02: .12rem;  /* 2px */
11 14
   --space-05: .25rem;  /* 4px */
12 15
   --space-1: .5rem;  /* 8px */
@@ -18,10 +21,15 @@
18 21
   --space-7: 3.5rem;   /* 56px */
19 22
   --space-8: 4rem;   /* 64px */
20 23
 
21
-  --box-shadow-1: 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 1px -1px rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
24
+  
25
+
26
+  --box-shadow-b: 0 1px 0 0 #303030;
27
+  --box-shadow-l: 0 1px 0 0 #cfcfcf;
22 28
   --box-shadow-inset :inset 0 0 0 1px var(--color-secondary);
23 29
 }
24 30
 
31
+
32
+
25 33
 html
26 34
 {
27 35
   font-family: "Ubuntu", Arial, sans-serif;
@@ -37,19 +45,16 @@ html
37 45
 {
38 46
   box-sizing: border-box;
39 47
   margin: 0;
40
-  color:#303030;
41
-}
42
-small{
43
-  color: inherit;
44 48
 }
45 49
 pre{
50
+  font-size: .62rem;
46 51
   padding: var(--space-1);
47 52
   background-color: var(--color-bg-light);
48 53
   box-shadow: var(--box-shadow-inset);
49 54
   word-break: break-all;
50 55
   white-space: pre-wrap;
51 56
   border-radius: var(--space-05);
52
-
57
+  color:  var(--color-dark);
53 58
 }
54 59
 
55 60
 .pd1{
@@ -66,6 +71,7 @@ html, body {
66 71
 }
67 72
 
68 73
 body {
74
+  color:  var(--color-dark);
69 75
   display: grid;
70 76
   background-color: #cfcfcf;
71 77
   min-height: 100vh;
@@ -78,20 +84,14 @@ body {
78 84
 }
79 85
 
80 86
 @media only screen and (min-width: 500px) {
81
-  body.sidebar {
87
+  body {
82 88
     grid-template-areas: "header header"
83 89
                          "content sidebar"
84 90
                          "footer footer";
85 91
     grid-template-rows: min-content 1fr min-content;
86 92
     grid-template-columns: 2fr 1fr; /* calc(20 * 16px) */
87 93
   }
88
-  body.app-sidebaralt {
89
-    grid-template-areas: "header header"
90
-                         "sidebar content"
91
-                         "footer footer";
92
-    grid-template-rows: min-content 1fr min-content;
93
-    grid-template-columns: 1fr 2fr;
94
-  }
94
+
95 95
 }
96 96
 
97 97
 
@@ -107,6 +107,12 @@ header {
107 107
   background-color: #303030;
108 108
   color: #cfcfcf; 
109 109
 }
110
+header nav{
111
+  display: flex;
112
+}
113
+header button{
114
+  margin-right: var(--space-1);
115
+}
110 116
 main {
111 117
   position: relative;
112 118
   grid-area: content;
@@ -140,25 +146,10 @@ button{
140 146
   box-sizing: border-box;
141 147
 cursor: pointer;
142 148
 }
143
-button.block{
144
-  padding: var(--space-1);
145
-  background-color: var(--color-secondary);
146
-  font-size: 1rem;
147
-  line-height: 1.38rem;
148
-  color:#fff;
149
-  border-radius: var(--space-05) var(--space-05) 0 0;
150 149
 
151
-}
152
-button.txs{
153
-  background-color: var(--color-primary);
154
- color:#fff;
155
- margin-right: var(--space-1);
156
-padding: var(--space-02);
157
-}
158 150
 button.tx{
159 151
   background-color: var(--color-primary);
160
- color:#fff;
161
-margin: var(--space-1);
152
+  color:#fff;
162 153
 }
163 154
 button.addr{
164 155
   margin:0;
@@ -183,26 +174,24 @@ button:hover{
183 174
   box-shadow:inset 0 0 0 1px #fff;
184 175
 }
185 176
 
186
-time{
187
-  font-size: .62rem;
188
-}
189 177
 section{
190 178
 display: flex;
191 179
 flex-direction: column;
192 180
 justify-content: space-between;
193
-
194
-background: #eee;
181
+padding: var(--space-2);
182
+background: var(--color-dark);
195 183
 box-shadow:inset 0 0 0 1px #303030;
196 184
 border-radius: var(--space-1);
185
+overflow: hidden;
186
+color: var(--color-light);
197 187
 }
198 188
 
199
-time{
200
-  color:#3030cf;
189
+section li,section span,section h1,section h2,section h3{
190
+  color:  var(--color-light);
201 191
 }
202 192
 
203 193
 
204 194
 
205
-
206 195
 .blocktxs{
207 196
   padding: 0 1rem;
208 197
 }
@@ -213,25 +202,12 @@ time{
213 202
 
214 203
 
215 204
 
216
-table, tbody{
217
-  width: 100%;
218
-}
219
-  table{
220
-  padding:0 var(--space-1);
221
-}
222
-
223
-tr{
224
-  box-shadow:0 1px 0 0 #303030;
225
-}
226
-
227
-td{
228
-  padding: var(--space-1) 0;
229
-}
230
-
231 205
 
232 206
 h1, h2, h3, h4, h5, h6{
207
+  display: flex;
233 208
   width: 100%;
234
-  padding: var(--space-1);
209
+  flex-direction: column;
210
+  justify-content: center;
235 211
 }
236 212
 
237 213
 
@@ -300,50 +276,72 @@ amp-list.paged-amp-list {
300 276
   text-align: right;
301 277
   padding: var(--space-2) var(--space-2) 0;
302 278
 }
303
-.items {
304
-  display: flex;
305
-  flex-flow: row wrap;
306
-  justify-content: center;
307
-  padding-top: var(--space-2);
279
+
280
+.block {
281
+  margin-bottom: var(--space-1); 
282
+  background: var(--color-bg-light);  
283
+  color: var(--color-dark);
284
+  border-radius: var(--space-1);
285
+  cursor: pointer;  
308 286
 }
309
-.item {
310
-  display: flex;
311
-flex: 1 0 calc(100% - var(--space-4));
312
-  justify-content: space-between;
313
-  justify-content: space-between;
314
-  
315
-  background: var(--color-bg-light);
316
-  
317
-  border-radius: 5px;
318
-  overflow: hidden;
319 287
 
320 288
 
321
-      margin:var(--space-1) var(--space-2) 0;
322
-   
323
-    box-shadow:var(--box-shadow-inset);
324
-    border-radius: var(--space-1);
325
-    align-items: center;
326
-  
289
+
290
+.height{
291
+  padding: var(--space-1);
292
+  background-color: var(--color-secondary);
293
+  font-size: 1rem;
294
+  line-height: 2.38rem;
295
+  color:#fff;
296
+  border-radius: var(--space-1) 0 0 var(--space-1);
327 297
 }
328
-.item > .title,
329
-.item > .copy {
330
-  margin: var(--space-1);
298
+
299
+
300
+time{
301
+  padding:  var(--space-05);
302
+  font-size:.62rem;
303
+  background-color: var(--color-secondary);
304
+color:#fff;
305
+  float:right;
306
+  text-align: right;
307
+  text-transform: uppercase;
308
+  border-radius: var(--space-05);
309
+}
310
+
311
+.block:hover{
312
+  background-color: var(--color-secondary);
313
+}
314
+
315
+
316
+.block:hover time{
317
+  background-color: #fff;
318
+  color: var(--color-secondary);
331 319
 }
332
-.image {
333
-  max-width: 100%;
320
+
321
+
322
+.blocks-list .hash,.blocks-list .date{
323
+  display: none;
334 324
 }
335
-.item > .image > img {
336
-  object-fit: cover;
337
-  object-position: center;
325
+.blocks-list .hash{
326
+
327
+  padding:0 var(--space-2);
328
+  color: #fff;
329
+  line-height: 3.38rem;
338 330
 }
339 331
 
332
+.block:hover .hash,.block:hover .date{
333
+  display: block;
334
+
335
+  }
336
+
337
+  .block:hover small,.block:hover span,.block:hover amp-timeago {
338
+    display: none;
339
+    }
340
+      
340 341
 
341 342
 [overflow] {
342
-  left: 1px;
343
-  right: 1px;
344
-  width: calc(100% - 2px);
345 343
   height: var(--space-8);
346
-  background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .5), #eee, #eee);
344
+  background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .5), #303030, #303030);
347 345
 }
348 346
 [overflow] button {
349 347
   position: absolute;
@@ -375,4 +373,162 @@ flex: 1 0 calc(100% - var(--space-4));
375 373
 amp-list div[role="list"] {
376 374
   display: grid;
377 375
   grid-gap: 0.5em;
378
-}
376
+}
377
+
378
+
379
+ul.flx{
380
+  display: flex;
381
+  flex-wrap: wrap;
382
+  flex:1;
383
+  padding-bottom: var(--space-2);
384
+  justify-content: space-between;
385
+  
386
+}
387
+
388
+ul.flx.col{
389
+flex-direction: column;
390
+}
391
+ul.flx li{
392
+  display: flex;
393
+  flex: 1 0 100%;
394
+  justify-content: space-between;
395
+  align-items: center;
396
+}
397
+
398
+ul.bsd li{
399
+  margin: var(--space-1) 0;
400
+  padding:  0 0 0 var(--space-1);
401
+background-color: var(--color-light);
402
+color:var(--color-dark);
403
+border-radius: var(--space-05);
404
+}
405
+
406
+ul.bsd li:last-child{
407
+  box-shadow: 0 0 0 0 #fff;
408
+}
409
+ul.bsd span{
410
+  padding: var(--space-05);
411
+  background-color: #fff;
412
+  color: var(--color-dark);
413
+}
414
+ul.flx .flx{
415
+  padding: 0;
416
+  }
417
+ul.flx li li{
418
+  flex:1;
419
+  border-radius: var(--space-05);
420
+}
421
+ul.flx li li:first-child{
422
+  margin-left:0;
423
+}
424
+
425
+ul.flx li li span{
426
+  margin-top:var(--space-1);
427
+  padding: var(--space-1);
428
+}
429
+
430
+
431
+
432
+
433
+ul.flx.hor{
434
+
435
+}
436
+ul.flx.hor li{
437
+  margin-left: var(--space-1);
438
+  padding: var(--space-1);
439
+  flex-direction: column;
440
+  text-align: center;
441
+  align-items: normal;
442
+}
443
+ul.grp{
444
+  margin-bottom: var(--space-2);
445
+  padding:  var(--space-2);
446
+  background-color: var(--color-light);
447
+  border-radius: var(--space-05);
448
+  flex-direction: column;
449
+}
450
+
451
+ul.flx.grp li{
452
+  flex:1 0 100%;
453
+  margin: 0;
454
+  padding: 0;
455
+}
456
+ul.flx.grp li li{
457
+  flex:0;
458
+}
459
+
460
+.grb li{
461
+  box-shadow: var(--box-shadow-inset);
462
+}
463
+
464
+
465
+.mustcoin{
466
+  display: none;
467
+}
468
+body.true .mustcoin{
469
+  display: block;
470
+}
471
+
472
+
473
+
474
+:root{
475
+  --bg-color-1: rgb(24, 49, 190);
476
+  --bg-color-2: rgb(20, 148, 31);
477
+ 
478
+}
479
+
480
+
481
+
482
+
483
+
484
+
485
+table {
486
+  width: 100%;
487
+  background: #FFF; 
488
+  margin: 0 auto;
489
+  overflow: scroll;
490
+}
491
+
492
+.scroll-table, td, th {
493
+  border-collapse:collapse; 
494
+  border:2px solid #000; 
495
+  padding: 0.25em;
496
+}
497
+
498
+
499
+table thead th {
500
+  position: sticky;
501
+  top: 0;
502
+  left: 0;
503
+  background:var(--bg-color-1);
504
+  color: #FFF;
505
+  z-index: 999;
506
+  text-align: center;
507
+}
508
+
509
+table thead th:first-child {
510
+  left: 0;
511
+  z-index: 9999;
512
+}
513
+
514
+table tbody{
515
+  height: 60vh;
516
+}
517
+
518
+table tbody td {
519
+  position: sticky;
520
+  color: #000;
521
+  font-weight: 500;
522
+  z-index: 99;
523
+  text-align: center;
524
+}
525
+
526
+table tbody td:first-child {
527
+  left: 0;
528
+  background: var(--bg-color-2);
529
+  color: #FFF;
530
+  font-weight: 400;
531
+  z-index: 999;
532
+  border-bottom: #FFF solid 1px;
533
+}
534
+

+ 46
- 0
tpl/fls/gohtml/78explorer.gohtml View File

@@ -0,0 +1,46 @@
1
+<amp-list class="blocks-list" layout="responsive" width="300" height="900" id="blocks" 
2
+[src]="'/a/' + coin + '/blocks/' + perPage + '/' + pageNumber" 
3
+[src]="'/a/' + coin + '/blocks/' + perPage + '/' + pageNumber" 
4
+binding="no" items="d" reset-on-refresh single-item>
5
+<template type="amp-mustache">
6
+<table>
7
+    <thead>
8
+       <tr>
9
+          <th class="header-sort" title="Sort ascending">Block Height</th>
10
+     
11
+       </tr>
12
+    </thead>
13
+    <tbody>
14
+    {{`{{#blocks}}`}}
15
+       <tr>
16
+          <td>{{`{{ntx}}`}}</td>