diff --git a/_example/blockchain.pdf b/_example/blockchain.pdf index 3e7f280..bee019a 100644 Binary files a/_example/blockchain.pdf and b/_example/blockchain.pdf differ diff --git a/_example/interface.pdf b/_example/interface.pdf new file mode 100644 index 0000000..b64a7c1 Binary files /dev/null and b/_example/interface.pdf differ diff --git a/gclient.go b/gclient.go index 85387e6..9a65d83 100644 --- a/gclient.go +++ b/gclient.go @@ -180,6 +180,7 @@ func transactionPage(w http.ResponseWriter, r *http.Request) { t.Execute(w, data) return } + flag := false for _, addr := range Addresses { res := nt.Send(addr, &nt.Package{ Option: GET_LHASH, @@ -192,6 +193,15 @@ func transactionPage(w http.ResponseWriter, r *http.Request) { Option: ADD_TRNSX, Data: bc.SerializeTX(tx), }) + if res == nil || res.Data != "ok" { + continue + } + flag = true + } + if !flag { + data.Error = "TX failed" + } else { + data.Error = "TX success" } } t.Execute(w, data) diff --git a/templates/account.html b/templates/account.html index 8c7de82..5d3b072 100644 --- a/templates/account.html +++ b/templates/account.html @@ -1,20 +1,20 @@ {{define "title"}} - Account + Account {{end}} {{define "content"}} -
+
-
-
-
- -
-
- -
-
-
-
-
+
+
+
+ +
+
+ +
+
+
+
+ {{end}} diff --git a/templates/base.html b/templates/base.html index c1eea91..1258dd9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,41 +1,41 @@ - - {{block "title" .}} - Title - {{end}} - - - + + {{block "title" .}} + Title + {{end}} + + + -
-
+
+ {{block "content" .}} + Content + {{end}} +
diff --git a/templates/blockchain.html b/templates/blockchain.html index 6d7f03f..46f4fe9 100644 --- a/templates/blockchain.html +++ b/templates/blockchain.html @@ -1,35 +1,35 @@ {{define "title"}} - BlockChain + BlockChain {{end}} {{define "content"}} -
+
-
-
-
- {{ if .Address }} - - - {{ end }} -
-
- -
- -
-
-
-
- {{ if .Error }} - Error: {{ .Error }} - {{ else }} - {{ range $i, $e := .Size }} - - {{ end }} - {{ end }} -
-
+
+
+
+ {{ if .Address }} + + + {{ end }} +
+
+ +
+ +
+
+
+
+ {{ if .Error }} + Error: {{ .Error }} + {{ else }} + {{ range $i, $e := .Size }} +
+ [Block {{ $i }}] +
+ {{ end }} + {{ end }} +
+ {{end}} diff --git a/templates/blockchainX.html b/templates/blockchainX.html index 5e482f1..702c245 100644 --- a/templates/blockchainX.html +++ b/templates/blockchainX.html @@ -1,94 +1,94 @@ {{define "title"}} - Block + Block {{end}} {{define "content"}} - {{ if .Error }} - Error: {{ .Error }} - {{ else }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Nonce{{ .Block.Nonce }}
Difficulty{{ .Block.Difficulty }}
CurrHash{{ .Block.CurrHash }}
PrevHash{{ .Block.PrevHash }}
Miner{{ .Block.Miner }}
Signature{{ .Block.Signature }}
TimeStamp{{ .Block.TimeStamp }}
Transactions - {{ range .Block.Transactions }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RandBytes{{ .RandBytes }}
PrevBlock{{ .PrevBlock }}
Sender{{ .Sender }}
Receiver{{ .Receiver }}
Value{{ .Value }}
ToStorage{{ .ToStorage }}
CurrHash{{ .CurrHash }}
Signature{{ .Signature }}
- {{ end }} -
Mapping - {{ range $k, $e := .Block.Mapping }} - - - - - -
{{ $k }}{{ $e }}
- {{ end }} -
- {{ end }} + {{ if .Error }} + Error: {{ .Error }} + {{ else }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nonce{{ .Block.Nonce }}
Difficulty{{ .Block.Difficulty }}
CurrHash{{ .Block.CurrHash }}
PrevHash{{ .Block.PrevHash }}
Miner{{ .Block.Miner }}
Signature{{ .Block.Signature }}
TimeStamp{{ .Block.TimeStamp }}
Transactions + {{ range .Block.Transactions }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RandBytes{{ .RandBytes }}
PrevBlock{{ .PrevBlock }}
Sender{{ .Sender }}
Receiver{{ .Receiver }}
Value{{ .Value }}
ToStorage{{ .ToStorage }}
CurrHash{{ .CurrHash }}
Signature{{ .Signature }}
+ {{ end }} +
Mapping + {{ range $k, $e := .Block.Mapping }} + + + + + +
{{ $k }}{{ $e }}
+ {{ end }} +
+ {{ end }} {{end}} diff --git a/templates/index.html b/templates/index.html index 8fa39e8..8be8980 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,6 +9,3 @@ {{end}} - - - \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index b3fd919..0f46b87 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,21 +1,21 @@ {{define "title"}} - Login + Login {{end}} {{define "content"}} - {{ if .Error }} -

{{ .Error }}

- {{ end }} -
+ {{ if .Error }} +

{{ .Error }}

+ {{ end }} +
-
-
-
- -
- -
-
-
-
+
+
+
+ +
+ +
+
+
+ {{end}} diff --git a/templates/signup.html b/templates/signup.html index e8c9822..7166f89 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -1,20 +1,20 @@ {{define "title"}} - Signup + Signup {{end}} {{define "content"}} -
+
-
-
-
- {{ if .PrivateKey }} - - {{ end }} -
- -
-
-
-
+
+
+
+ {{ if .PrivateKey }} + + {{ end }} +
+ +
+
+
+ {{end}} diff --git a/templates/transaction.html b/templates/transaction.html index 56341d1..2bd34c1 100644 --- a/templates/transaction.html +++ b/templates/transaction.html @@ -1,21 +1,26 @@ {{define "title"}} - Transaction + Transaction {{end}} {{define "content"}} -
+
-
-
-
- -
-
- -
- -
-
-
-
+
+
+
+ {{ if .Error }} + + {{ end }} +
+
+ +
+
+ +
+ +
+
+
+ {{end}}