From dca5504dba55645f966502d9727e2d31ba13980b Mon Sep 17 00:00:00 2001 From: Daxeel Soni Date: Sat, 27 Jan 2018 19:04:58 +0530 Subject: [PATCH] blockshell no moduel bug fixed --- .gitignore | 6 + blockchain/__init__.py | 0 blockshell.py => blockchain/blockchain.py | 0 bls.py => bscli.py | 5 +- setup.py | 7 +- templates/blockdata.html | 265 +++++++++++----------- templates/blocks.html | 213 +++++++++-------- web.py | 6 +- 8 files changed, 247 insertions(+), 255 deletions(-) create mode 100644 blockchain/__init__.py rename blockshell.py => blockchain/blockchain.py (100%) rename bls.py => bscli.py (92%) diff --git a/.gitignore b/.gitignore index 0d20b64..0e08475 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ *.pyc +chain.txt +aaa/ +build/ +dist/ +blockshell/ +blockshell.egg-info/ diff --git a/blockchain/__init__.py b/blockchain/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/blockshell.py b/blockchain/blockchain.py similarity index 100% rename from blockshell.py rename to blockchain/blockchain.py diff --git a/bls.py b/bscli.py similarity index 92% rename from bls.py rename to bscli.py index 40e70a5..4423018 100644 --- a/bls.py +++ b/bscli.py @@ -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 Create new transaction" print " allblocks Fetch all mined blocks in blockchain" + print " getblock Fetch information about particular block" def throwError(msg): print "Error : " + msg diff --git a/setup.py b/setup.py index 33cbef3..92374f0 100644 --- a/setup.py +++ b/setup.py @@ -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 ''', ) diff --git a/templates/blockdata.html b/templates/blockdata.html index 2a781d7..037ebb1 100644 --- a/templates/blockdata.html +++ b/templates/blockdata.html @@ -1,142 +1,133 @@ - - - - - - - - - - - - - - - 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 index 500c2bb..d6c327f 100644 --- a/templates/blocks.html +++ b/templates/blocks.html @@ -1,114 +1,111 @@ - - - - - - - - - - Blockshell | All Blocks - - - - - - - - - - - - - - - -
-
-
- -

Latest Blocks

- {% for item in data -%} - - - - - - - - - - - - + + + + + diff --git a/web.py b/web.py index 5af2387..ca809d5 100644 --- a/web.py +++ b/web.py @@ -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())