Web ui develoepd
This commit is contained in:
parent
a11085e9bd
commit
b681197cb5
|
|
@ -0,0 +1,142 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Blockshell | All Blocks</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://blackrockdigital.github.io/startbootstrap-bare/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 54px;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
body {
|
||||
padding-top: 56px;
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
position: fixed;
|
||||
height: 40px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: #e7e7e7;
|
||||
padding-left: 80px;
|
||||
padding-top: 10px;
|
||||
color: #000;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">BlockShell</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#">All Blocks
|
||||
<span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">About</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Page Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-10" style="margin-top:20px;">
|
||||
|
||||
<h2><span class="badge badge-primary">{{data['hash']}}</span></h2>
|
||||
<br>
|
||||
|
||||
<table class="table table-dark table-striped">
|
||||
<tr>
|
||||
<td><b>Height</b></td>
|
||||
<td>{{data['index']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Timestamp</b></td>
|
||||
<td>{{data['timestamp']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Data</b></td>
|
||||
<td>{{data['data']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Hash</b></td>
|
||||
<td>{{data['hash']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Previous Block Hash</b></td>
|
||||
<td>{{data['previousHash']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Nonce</b></td>
|
||||
<td>{{data['nonce']}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2" style="margin-top:90px;">
|
||||
<div class="card" style="width: 13rem;">
|
||||
<img class="card-img-top" src="https://preview.ibb.co/e7SO4G/Logomakr_1rc0_PA.png" alt="Card image cap">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">About Project</h5>
|
||||
<p class="card-text">Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.</p>
|
||||
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary">View Profile</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <footer class="fixed-bottom">
|
||||
<p>Project by <a href="https://daxeel.github.io" target="_blank">Daxeel Soni</a></p>
|
||||
</footer> -->
|
||||
|
||||
<!-- Bootstrap core JavaScript -->
|
||||
<script src="https://blackrockdigital.github.io/startbootstrap-bare/vendor/jquery/jquery.min.js"></script>
|
||||
<script src="https://blackrockdigital.github.io/startbootstrap-bare/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Blockshell | All Blocks</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="https://blackrockdigital.github.io/startbootstrap-bare/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 54px;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
body {
|
||||
padding-top: 56px;
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
position: fixed;
|
||||
height: 40px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: #e7e7e7;
|
||||
padding-left: 80px;
|
||||
padding-top: 10px;
|
||||
color: #000;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">BlockShell</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#">All Blocks
|
||||
<span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">About</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Page Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-10" style="margin-top:20px;">
|
||||
|
||||
<h1><span class="badge badge-primary">Latest Blocks</span></h1>
|
||||
{% for item in data -%}
|
||||
<div class="alert alert-success" role="alert">
|
||||
<a href="/block/{{item.hash}}" target="_blank">{{ item.hash }}</a>
|
||||
</div>
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2" style="margin-top:80px;">
|
||||
<div class="card" style="width: 13rem;">
|
||||
<img class="card-img-top" src="https://preview.ibb.co/e7SO4G/Logomakr_1rc0_PA.png" alt="Card image cap">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">About Project</h5>
|
||||
<p class="card-text">Project BlockShell is created by with a vision to teach blockchain concepts to students and programmers.</p>
|
||||
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary">View Profile</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <footer class="fixed-bottom">
|
||||
<p>Project by <a href="https://daxeel.github.io" target="_blank">Daxeel Soni</a></p>
|
||||
</footer> -->
|
||||
|
||||
<!-- Bootstrap core JavaScript -->
|
||||
<script src="https://blackrockdigital.github.io/startbootstrap-bare/vendor/jquery/jquery.min.js"></script>
|
||||
<script src="https://blackrockdigital.github.io/startbootstrap-bare/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
|
|
@ -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/<hash>')
|
||||
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)
|
||||
Loading…
Reference in New Issue