blockshell no moduel bug fixed

This commit is contained in:
Daxeel Soni 2018-01-27 19:04:58 +05:30
parent b681197cb5
commit dca5504dba
8 changed files with 247 additions and 255 deletions

6
.gitignore vendored
View File

@ -1 +1,7 @@
*.pyc
chain.txt
aaa/
build/
dist/
blockshell/
blockshell.egg-info/

0
blockchain/__init__.py Normal file
View File

View File

@ -3,7 +3,7 @@
import click
import urllib
import json
from blockshell import Block, Blockchain
from blockchain.chain import Block, Blockchain
# Supported commands
SUPPORTED_COMMANDS = [
@ -44,7 +44,7 @@ def init(difficulty):
# Start lbc chell
while True:
cmd = raw_input("[LBC] $ ")
cmd = raw_input("[BlockShell] $ ")
processInput(cmd)
# Process input from LBC shell
@ -86,6 +86,7 @@ def help(cmd):
print "Commands:"
print " dotx <transaction data> Create new transaction"
print " allblocks Fetch all mined blocks in blockchain"
print " getblock <block hash> Fetch information about particular block"
def throwError(msg):
print "Error : " + msg

View File

@ -7,13 +7,14 @@ setup(
author_email = "daxeelsoni44@gmail.com",
url = "https://daxeel.github.io",
description = ("A command line utility for learning Blockchain concepts."),
py_modules=['bls'],
py_modules=['bscli'],
install_requires=[
'Click',
'colorama'
'colorama',
'flask'
],
entry_points='''
[console_scripts]
blockshell=bls:cli
blockshell=bscli:cli
''',
)

View File

@ -1,24 +1,13 @@
<!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>
<meta name="description" content="Blockshell Web for Blockshell CLI">
<meta name="author" content="Daxeel Soni">
<title>Blockshell | Block Data</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 {
@ -29,7 +18,6 @@
padding-top: 56px;
}
}
footer {
position: fixed;
height: 40px;
@ -39,46 +27,32 @@
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>
<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>
<a class="nav-link" href="#" data-toggle="modal" data-target="#exampleModal">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>
@ -105,38 +79,55 @@
<td>{{data['nonce']}}</td>
</tr>
</table>
<p class="lead">
</p>
</div>
<div class="col-lg-2" style="margin-top:90px;">
<div class="col-lg-2" style="margin-top:30px;">
<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>
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary">Contact Creator</a>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Blockshell Creator</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<img class="card-img-top" src="https://image.ibb.co/nqzp4w/Daxeel_3.jpg" alt="Card image cap">
<br><br>
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary col-md-12">View Profile</a>
</div>
<div class="col-md-8">
<h5 class="card-title">Daxeel Soni</h5>
<p class="card-text">Young software engineer and with the passion of startup product building using tech skills. I am a co-lead of Facebook Developers Circle, Ahmedabad. A technology educator and speaker invited to various institutes and events such as IIM, Nirma, Google Developers Group, Facebook events etc.</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</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>

View File

@ -1,19 +1,13 @@
<!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="">
<meta name="description" content="Blockshell Web for Blockshell CLI">
<meta name="author" content="Daxeel Soni">
<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 {
@ -24,7 +18,6 @@
padding-top: 56px;
}
}
footer {
position: fixed;
height: 40px;
@ -34,15 +27,10 @@
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">
@ -52,63 +40,72 @@
</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>
<a class="nav-link" href="#" data-toggle="modal" data-target="#exampleModal">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="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>
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary">Contact Creator</a>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Blockshell Creator</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<img class="card-img-top" src="https://image.ibb.co/nqzp4w/Daxeel_3.jpg" alt="Card image cap">
<br><br>
<a href="https://daxeel.github.io" target="_blank" class="btn btn-primary col-md-12">View Profile</a>
</div>
<div class="col-md-8">
<h5 class="card-title">Daxeel Soni</h5>
<p class="card-text">Young software engineer and with the passion of startup product building using tech skills. I am a co-lead of Facebook Developers Circle, Ahmedabad. A technology educator and speaker invited to various institutes and events such as IIM, Nirma, Google Developers Group, Facebook events etc.</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</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>

6
web.py
View File

@ -2,12 +2,8 @@ from flask import Flask, render_template, jsonify
import json
app = Flask(__name__)
# Index endpoint
@app.route('/')
def hello_world():
return "Blockshell"
@app.route('/allblocks')
@app.route('/')
def blocks():
f = open("chain.txt", "r")
data = json.loads(f.read())