From b681197cb53a7c6854e9b8a728bc30387b762c81 Mon Sep 17 00:00:00 2001 From: Daxeel Soni Date: Thu, 25 Jan 2018 19:10:01 +0530 Subject: [PATCH] Web ui develoepd --- templates/blockdata.html | 142 +++++++++++++++++++++++++++++++++++++++ templates/blocks.html | 114 +++++++++++++++++++++++++++++++ web.py | 28 ++++++++ 3 files changed, 284 insertions(+) create mode 100644 templates/blockdata.html create mode 100644 templates/blocks.html create mode 100644 web.py diff --git a/templates/blockdata.html b/templates/blockdata.html new file mode 100644 index 0000000..2a781d7 --- /dev/null +++ b/templates/blockdata.html @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + Blockshell | All Blocks + + + + + + + + + + + + + + + +
+
+
+ +

{{data['hash']}}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Height{{data['index']}}
Timestamp{{data['timestamp']}}
Data{{data['data']}}
Hash{{data['hash']}}
Previous Block Hash{{data['previousHash']}}
Nonce{{data['nonce']}}
+ + + +

+ +

+
+ +
+
+ Card image cap +
+
About Project
+

Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.

+ View Profile +
+
+
+ +
+
+ + + + + + + + + + + + diff --git a/templates/blocks.html b/templates/blocks.html new file mode 100644 index 0000000..500c2bb --- /dev/null +++ b/templates/blocks.html @@ -0,0 +1,114 @@ + + + + + + + + + + + + Blockshell | All Blocks + + + + + + + + + + + + + + + +
+
+
+ +

Latest Blocks

+ {% for item in data -%} + + {%- endfor %} + + + +

+ +

+
+ +
+
+ Card image cap +
+
About Project
+

Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.

+ View Profile +
+
+
+ +
+
+ + + + + + + + + + + + diff --git a/web.py b/web.py new file mode 100644 index 0000000..5af2387 --- /dev/null +++ b/web.py @@ -0,0 +1,28 @@ +from flask import Flask, render_template, jsonify +import json + +app = Flask(__name__) +# Index endpoint +@app.route('/') +def hello_world(): + return "Blockshell" + +@app.route('/allblocks') +def blocks(): + f = open("chain.txt", "r") + data = json.loads(f.read()) + f.close() + return render_template('blocks.html', data=data) + +@app.route('/block/') +def block(hash): + f = open("chain.txt", "r") + data = json.loads(f.read()) + f.close() + for eachBlock in data: + if eachBlock['hash'] == hash: + return render_template('blockdata.html', data=eachBlock) + + +if __name__ == '__main__': + app.run(debug=True)