├── node.gif ├── client.gif ├── .idea ├── .gitignore ├── vcs.xml ├── inspectionProfiles │ └── profiles_settings.xml ├── modules.xml ├── pyBlockchain.iml └── misc.xml ├── blockchain_client ├── static │ ├── css │ │ └── custom.css │ ├── make_files │ │ ├── custom.css │ │ └── nav_brand.png │ ├── wallet.png │ ├── nav_brand.png │ ├── vendor │ │ └── DataTables │ │ │ ├── DataTables-1.10.22 │ │ │ ├── images │ │ │ │ ├── sort_asc.png │ │ │ │ ├── sort_both.png │ │ │ │ ├── sort_desc.png │ │ │ │ ├── sort_asc_disabled.png │ │ │ │ └── sort_desc_disabled.png │ │ │ ├── js │ │ │ │ ├── dataTables.foundation.min.js │ │ │ │ ├── dataTables.bootstrap.min.js │ │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ │ ├── dataTables.semanticui.min.js │ │ │ │ ├── dataTables.jqueryui.min.js │ │ │ │ ├── dataTables.foundation.js │ │ │ │ ├── dataTables.jqueryui.js │ │ │ │ ├── dataTables.bootstrap.js │ │ │ │ ├── dataTables.bootstrap4.js │ │ │ │ └── dataTables.semanticui.js │ │ │ └── css │ │ │ │ ├── dataTables.semanticui.min.css │ │ │ │ ├── dataTables.foundation.min.css │ │ │ │ ├── dataTables.semanticui.css │ │ │ │ ├── dataTables.foundation.css │ │ │ │ ├── dataTables.bootstrap.min.css │ │ │ │ ├── dataTables.bootstrap4.min.css │ │ │ │ ├── dataTables.bootstrap.css │ │ │ │ └── dataTables.bootstrap4.css │ │ │ ├── css │ │ │ └── DataTables-1.10.16 │ │ │ │ └── images │ │ │ │ ├── sort_asc.png │ │ │ │ ├── sort_both.png │ │ │ │ ├── sort_desc.png │ │ │ │ ├── sort_asc_disabled.png │ │ │ │ └── sort_desc_disabled.png │ │ │ ├── ellipsis.js │ │ │ ├── js │ │ │ └── ellipsis.js │ │ │ └── datatables.min.css │ └── js │ │ ├── generate_wallet.js │ │ ├── make_transaction.js │ │ └── view_trxs.js ├── Wallet.py ├── Transaction.py ├── templates │ ├── view_transactions.html │ ├── base.html │ └── index.html └── blockchain_client.py ├── blockchain_node ├── static │ ├── bg-vid-1.mp4 │ ├── pics │ │ ├── blured_bg.jpg │ │ └── nav_brand.png │ ├── vendor │ │ └── DataTables │ │ │ ├── DataTables-1.10.22 │ │ │ ├── images │ │ │ │ ├── sort_asc.png │ │ │ │ ├── sort_both.png │ │ │ │ ├── sort_desc.png │ │ │ │ ├── sort_asc_disabled.png │ │ │ │ └── sort_desc_disabled.png │ │ │ ├── js │ │ │ │ ├── dataTables.foundation.min.js │ │ │ │ ├── dataTables.bootstrap.min.js │ │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ │ ├── dataTables.semanticui.min.js │ │ │ │ ├── dataTables.jqueryui.min.js │ │ │ │ ├── dataTables.foundation.js │ │ │ │ ├── dataTables.jqueryui.js │ │ │ │ ├── dataTables.bootstrap.js │ │ │ │ ├── dataTables.bootstrap4.js │ │ │ │ └── dataTables.semanticui.js │ │ │ └── css │ │ │ │ ├── dataTables.semanticui.min.css │ │ │ │ ├── dataTables.foundation.min.css │ │ │ │ ├── dataTables.semanticui.css │ │ │ │ ├── dataTables.foundation.css │ │ │ │ ├── dataTables.bootstrap.min.css │ │ │ │ ├── dataTables.bootstrap4.min.css │ │ │ │ └── dataTables.bootstrap.css │ │ │ ├── ellipsis.js │ │ │ └── datatables.min.css │ ├── js │ │ ├── configure.js │ │ ├── mine.js │ │ └── current_trx.js │ └── css │ │ └── main.css └── templates │ ├── current_transactions.html │ ├── index.html │ ├── configure.html │ ├── base.html │ └── mine_page.html ├── .gitattributes ├── .gitignore ├── requirements.txt └── README.md /node.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/node.gif -------------------------------------------------------------------------------- /client.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/client.gif -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /blockchain_client/static/css/custom.css: -------------------------------------------------------------------------------- 1 | .generate-btn{ 2 | margin:0.5rem 0; 3 | } -------------------------------------------------------------------------------- /blockchain_client/static/make_files/custom.css: -------------------------------------------------------------------------------- 1 | .generate-btn{ 2 | margin:0.5rem 0; 3 | } -------------------------------------------------------------------------------- /blockchain_client/static/wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/wallet.png -------------------------------------------------------------------------------- /blockchain_node/static/bg-vid-1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/bg-vid-1.mp4 -------------------------------------------------------------------------------- /blockchain_client/static/nav_brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/nav_brand.png -------------------------------------------------------------------------------- /blockchain_node/static/pics/blured_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/pics/blured_bg.jpg -------------------------------------------------------------------------------- /blockchain_node/static/pics/nav_brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/pics/nav_brand.png -------------------------------------------------------------------------------- /blockchain_client/static/make_files/nav_brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/make_files/nav_brand.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-detectable=false 2 | *.js linguist-detectable=true 3 | *.html linguist-detectable=false 4 | *.python linguist-detectable=true 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc.png -------------------------------------------------------------------------------- /blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_both.png -------------------------------------------------------------------------------- /blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_both.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_asc.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_both.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_desc.png -------------------------------------------------------------------------------- /blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_node/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/DataTables-1.10.22/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sinamna/ChizCoin/HEAD/blockchain_client/static/vendor/DataTables/css/DataTables-1.10.16/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | blockchain_client/__pycache__/blockchain_client.cpython-38.pyc 2 | blockchain_client/__pycache__/Transaction.cpython-38.pyc 3 | blockchain_client/__pycache__/Wallet.cpython-38.pyc 4 | blockchain_client/static/vendor 5 | blockchain_node/static/vendor 6 | blockchain_node/templates 7 | blockchain_client/templates 8 | .idea -------------------------------------------------------------------------------- /.idea/pyBlockchain.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2020.11.8 2 | chardet==3.0.4 3 | click==7.1.2 4 | Flask==1.1.2 5 | Flask-Cors==3.0.9 6 | idna==2.10 7 | itsdangerous==1.1.0 8 | Jinja2==2.11.2 9 | MarkupSafe==1.1.1 10 | pkg-resources==0.0.0 11 | pycryptodome==3.9.9 12 | requests==2.25.0 13 | six==1.15.0 14 | urllib3==1.26.2 15 | Werkzeug==1.0.1 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /blockchain_client/static/js/generate_wallet.js: -------------------------------------------------------------------------------- 1 | $(document).ready(()=>{ 2 | $("input").click(()=>{ 3 | $.ajax({ 4 | url: "/wallet/new", 5 | type: "GET", 6 | success:(response)=>{ 7 | document.getElementById("private_key").innerHTML=response['private_key']; 8 | document.getElementById("public_key").innerHTML=response['public_key']; 9 | document.getElementById("warning").style.display="block"; 10 | }, 11 | error:(error)=>{ 12 | console.log(error) 13 | } 14 | }); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /blockchain_client/Wallet.py: -------------------------------------------------------------------------------- 1 | import binascii 2 | from Crypto.PublicKey import RSA 3 | from Crypto import Random 4 | class Wallet: 5 | """ 6 | wallet is actually a public and private key pair 7 | """ 8 | def __init__(self): 9 | random_seed=Random.new().read 10 | self._private_key=RSA.generate(2048,random_seed) 11 | self._public_key=self._private_key.publickey() 12 | @property 13 | def address(self): 14 | ''' 15 | :return: the public key as the address of wallet 16 | ''' 17 | return binascii.hexlify(self._public_key.exportKey(format='DER')).decode('ascii') 18 | 19 | def to_dict(self): 20 | ''' 21 | :return: dictionary representing the wallet 22 | ''' 23 | return { 24 | 'private_key':binascii.hexlify(self._private_key.export_key(format='DER')).decode('ascii'), 25 | 'public_key':binascii.hexlify(self._public_key.export_key(format='DER')).decode('ascii') 26 | } 27 | 28 | -------------------------------------------------------------------------------- /blockchain_node/static/js/configure.js: -------------------------------------------------------------------------------- 1 | $(document).ready(()=>{ 2 | $("#add_node_btn").click(()=>{ 3 | let URL="/nodes/register"; 4 | $.ajax({ 5 | url:URL, 6 | type:"POST", 7 | dataType:"json", 8 | data:$("#node_form").serialize(), 9 | success:(response)=>{ 10 | 11 | console.log(response); 12 | document.getElementById("node_urls").value=""; 13 | window.location.reload(); 14 | }, 15 | error:(error)=>{ 16 | console.log(error); 17 | } 18 | }); 19 | }); 20 | 21 | $.ajax({ 22 | url:"/nodes/get", 23 | type:'GET', 24 | success:(response)=>{ 25 | let node="" 26 | const nodes=response['nodes']; 27 | for(let i=0;i${nodes[i]}` 29 | document.getElementById("nodes_list").innerHTML+=node; 30 | } 31 | }, 32 | error:(error)=>{ 33 | console.log(error); 34 | } 35 | }); 36 | 37 | 38 | }); -------------------------------------------------------------------------------- /blockchain_node/templates/current_transactions.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html"%} 2 | {% block content %} 3 | 4 |
5 |
6 |
7 |
8 |
9 |

Current Chiz transactions

10 |
11 |
12 |
13 |
14 |
15 | 16 | 17 |
18 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | 27 | {% endblock %} 28 | {% block script%} 29 | 30 | 31 | 32 | {%endblock%} -------------------------------------------------------------------------------- /blockchain_client/Transaction.py: -------------------------------------------------------------------------------- 1 | import binascii 2 | from collections import OrderedDict 3 | from Crypto.PublicKey import RSA 4 | from Crypto.Signature import PKCS1_v1_5 5 | from Crypto.Hash import SHA256 6 | class Transaction: 7 | def __init__(self, sender_address, sender_private_key, receiver_address, value): 8 | self.sender_address = sender_address 9 | self._sender_private_key = sender_private_key 10 | self.receiver_address = receiver_address 11 | self.value = value 12 | 13 | def to_dict(self): 14 | ''' 15 | return: a dictionary representing transaction 16 | ''' 17 | return OrderedDict ({ 18 | 'sender_address': self.sender_address, 19 | 'receiver_address': self.receiver_address, 20 | 'amount': self.value 21 | }) 22 | 23 | def sign_transaction(self): 24 | ''' 25 | sign transaction with private key 26 | ''' 27 | private_key = RSA.import_key(binascii.unhexlify(self._sender_private_key)) 28 | signer = PKCS1_v1_5.new(private_key) 29 | hashed_Trx = SHA256.new(str(self.to_dict()).encode('utf8')) 30 | return binascii.hexlify(signer.sign(hashed_Trx)).decode('ascii') 31 | -------------------------------------------------------------------------------- /blockchain_node/static/css/main.css: -------------------------------------------------------------------------------- 1 | header { 2 | position: relative; 3 | background-color: black; 4 | height: 75vh; 5 | min-height: 25rem; 6 | width: 100%; 7 | overflow: hidden; 8 | } 9 | 10 | header video { 11 | position: absolute; 12 | top: 50%; 13 | left: 50%; 14 | min-width: 100%; 15 | min-height: 100%; 16 | width: auto; 17 | height: auto; 18 | z-index: 0; 19 | -ms-transform: translateX(-50%) translateY(-50%); 20 | -moz-transform: translateX(-50%) translateY(-50%); 21 | -webkit-transform: translateX(-50%) translateY(-50%); 22 | transform: translateX(-50%) translateY(-50%); 23 | } 24 | 25 | header .container { 26 | position: relative; 27 | z-index: 2; 28 | } 29 | 30 | header .overlay { 31 | position: absolute; 32 | top: 0; 33 | left: 0; 34 | height: 100%; 35 | width: 100%; 36 | background-color: black; 37 | opacity: 0.5; 38 | z-index: 1; 39 | } 40 | /* 41 | @media (pointer: coarse) and (hover: none) { 42 | header { 43 | background: url('https://source.unsplash.com/XT5OInaElMw/1600x900') black no-repeat center center scroll; 44 | } 45 | header video { 46 | display: none; 47 | } 48 | } */ -------------------------------------------------------------------------------- /blockchain_node/templates/index.html: -------------------------------------------------------------------------------- 1 | {%extends "base.html"%} 2 | {%block style%} 3 | 4 | {% endblock %} 5 | {% block content%} 6 |
7 |
8 | 11 |
12 |
13 |
14 |

ChizCoin Node

15 |

The intersection between Clients

16 |
17 |
18 |
19 |
20 | 21 |
22 |
23 |
24 |
25 |

ChizCoin is a simple blockchain implementation i did to get familier with base of api, python, flask, a bit of frontend 26 | which led me to bootstrap4

27 |
28 |
29 |
30 |
31 | {% endblock %} -------------------------------------------------------------------------------- /blockchain_node/templates/configure.html: -------------------------------------------------------------------------------- 1 | {%extends "base.html"%} 2 | {% block content %} 3 |
4 |
5 |
6 |

Add Chiz Nodes

7 |

8 | Enter a comma separated list and click on "Add Node" button 9 |

10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 | 18 |
19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 | 31 |
32 |
33 |
34 |
35 |
36 | This node can retrieve ChizCoin data from following Chiz Nodes 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 | {% endblock %} 47 | {% block script%} 48 | 49 | {%endblock%} -------------------------------------------------------------------------------- /blockchain_client/static/js/make_transaction.js: -------------------------------------------------------------------------------- 1 | $(document).ready(()=>{ 2 | $("#generate_transactions").click(()=>{ 3 | $.ajax({ 4 | url:"/transactions/generate", 5 | type:"POST", 6 | dataType:"json", 7 | data:$("#transaction_form").serialize(), 8 | success:(response)=>{ 9 | document.getElementById("confirm_sender_address").value=response["transaction"]["sender_address"]; 10 | document.getElementById("confirm_receiver_address").value=response["transaction"]["receiver_address"]; 11 | document.getElementById("confirm_amount").value=response["transaction"]["amount"]; 12 | document.getElementById("confirm_signature").value=response["signature"]; 13 | $("#baseModal").modal('show'); 14 | }, 15 | error:(error)=>{ 16 | console.log(error); 17 | } 18 | }); 19 | }); 20 | 21 | 22 | $("#confirm_transaction_button").click(()=>{ 23 | node_url=document.getElementById("node_url").value; 24 | $.ajax({ 25 | url:node_url+"transactions/new", 26 | type:"POST", 27 | headers: {'Access-Control-Allow-Origin':'*'}, //node CORS 28 | dataType:'json', 29 | data:$("#confirm_transaction_form").serialize(), 30 | success:(response)=>{ 31 | $("#transaction_form")[0].reset(); 32 | $("#confirm_transaction_form")[0].reset(); 33 | 34 | $("#sender_address").val(""); 35 | $("#sender_private_key").val(""); 36 | $("#receiver_address").val(""); 37 | $("#amount").val(""); 38 | 39 | $("#baseModal").modal('hide'); 40 | $("#success_transaction_modal").modal('show'); 41 | }, 42 | error:(error)=>{ 43 | console.log(error); 44 | } 45 | 46 | }); 47 | }); 48 | }); -------------------------------------------------------------------------------- /blockchain_client/templates/view_transactions.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html"%} 2 | {%block content%} 3 | 4 |
5 |
6 |
7 |
8 |
9 |
10 |

11 | View Transactions 12 |

13 |

14 | Enter node URL and click "View Transaction" button to view transactions in blockchain 15 |

16 |
17 |
18 |
19 |
20 |
21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 |
29 |
30 |
31 |
32 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | {% endblock %} 41 | {% block script%} 42 | 43 | 44 | 45 | {% endblock %} -------------------------------------------------------------------------------- /blockchain_client/blockchain_client.py: -------------------------------------------------------------------------------- 1 | from Transaction import Transaction 2 | from Wallet import Wallet 3 | from flask import Flask,jsonify,request,render_template 4 | 5 | app=Flask(__name__) 6 | #client can have multiple wallets 7 | client_wallets=[] 8 | #index page 9 | @app.route('/') 10 | def index(): 11 | return render_template('./index.html') 12 | 13 | #make_transaction_page 14 | @app.route('/transactions/make') 15 | def make_transactions(): 16 | return render_template('./make_transactions.html') 17 | 18 | #view_transactions 19 | @app.route('/transactions/view') 20 | def view_transactions(): 21 | return render_template('./view_transactions.html') 22 | 23 | #creating wallet 24 | @app.route('/wallet/new',methods=['GET']) 25 | def create_wallet(): 26 | wallet=Wallet() 27 | response=wallet.to_dict() 28 | client_wallets.append(wallet) 29 | return jsonify(response),201 30 | 31 | #generating transacion 32 | @app.route('/transactions/generate',methods=['POST']) 33 | def generate_transactions(): 34 | if request.method=='POST': 35 | form=request.form 36 | sender_address=form['sender_address'] 37 | sender_private_key=form['sender_private_key'] 38 | receiver_address=form['receiver_address'] 39 | transferred_amount=form['amount'] 40 | transaction=Transaction(sender_address,sender_private_key,receiver_address,transferred_amount) 41 | response={ 42 | 'transaction':transaction.to_dict(), 43 | 'signature':transaction.sign_transaction() 44 | } 45 | return jsonify(response),200 46 | else: 47 | return 400 48 | 49 | if __name__=='__main__': 50 | from argparse import ArgumentParser 51 | 52 | parser=ArgumentParser() 53 | parser.add_argument('-p','--port',default=8080,type=int,help='the port to listen on') 54 | args=parser.parse_args() 55 | port=args.port 56 | 57 | app.run(host='127.0.0.1',port=port) 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /blockchain_client/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ChizCoin Client 5 | {%block head%} 6 | 7 | 8 | 9 | 10 | 11 | {% endblock %} 12 | 13 | 14 | 37 | 38 | 39 | {%block content%}{% endblock %} 40 | 41 | 42 | 43 | 44 | {%block script%}{% endblock %} 45 | 46 | -------------------------------------------------------------------------------- /blockchain_node/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ChizCoin Node 5 | {%block head%} 6 | 7 | 8 | 9 | 10 | 11 | {%block style%}{% endblock %} 12 | {% endblock %} 13 | 14 | 15 | 38 | 39 | 40 | {%block content%}{% endblock %} 41 | 42 | 43 | 44 | 45 | {%block script%}{% endblock %} 46 | 47 | -------------------------------------------------------------------------------- /blockchain_client/static/vendor/DataTables/DataTables-1.10.22/js/dataTables.foundation.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Foundation integration 3 | ©2011-2015 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(c){return b(c,window,document)}):"object"===typeof exports?module.exports=function(c,l){c||(c=window);l&&l.fn.dataTable||(l=require("datatables.net")(c,l).$);return b(l,c,c.document)}:b(jQuery,window,document)})(function(b,c,l,F){var k=b.fn.dataTable;c=b('').appendTo("head");k.ext.foundationVersion=c.css("font-family").match(/small|medium|large/)?6:5;c.remove();b.extend(k.ext.classes, 6 | {sWrapper:"dataTables_wrapper dt-foundation",sProcessing:"dataTables_processing panel callout"});b.extend(!0,k.defaults,{dom:"<'row grid-x'<'small-6 columns cell'l><'small-6 columns cell'f>r>t<'row grid-x'<'small-6 columns cell'i><'small-6 columns cell'p>>",renderer:"foundation"});k.ext.renderer.pageButton.foundation=function(g,x,y,z,d,m){var r=new k.Api(g),A=g.oClasses,n=g.oLanguage.oPaginate,B=g.oLanguage.oAria.paginate||{},e,h,f,C=5===k.ext.foundationVersion,w=function(t,u){var v,D=function(p){p.preventDefault(); 7 | b(p.currentTarget).hasClass("unavailable")||r.page()==p.data.action||r.page(p.data.action).draw("page")};var q=0;for(v=u.length;q",{"class":A.sPageButton+" "+h,"aria-controls":g.sTableId,"aria-label":B[a],tabindex:g.iTabIndex,id:0===y&&"string"===typeof a?g.sTableId+"_"+a:null}).append(f?b("<"+f+"/>",{href:"#"}).html(e):e).appendTo(t);g.oApi._fnBindAction(E,{action:a},D)}}}};w(b(x).empty().html('