Skip to content

Commit

Permalink
Update blockchain.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BroProgramerWeb3 authored Jan 10, 2024
1 parent 52451ca commit 97b7553
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Blockchain_2/Blockchain/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# To be installed: pip install Flask
# Download Postman to test the API
# Importing the libraries
# Importing the libraries to use the libraries for the blockchain system
import datetime # to get the current time
import hashlib # to hash the blocks
import json # to encode the blocks before hashing
Expand All @@ -20,10 +20,11 @@ def __init__(self):
self.create_block(
proof = 1,
previous_hash='0'
)

)

# this function is to make a block which includes neccessary items
def create_block(self, proof, previous_hash):
#create the block with its properties
#create the block variable with its properties
block= {
'index': len(self.chain) + 1,
'timestamp': str(datetime.datetime.now()),# get the timestamp
Expand Down Expand Up @@ -133,7 +134,7 @@ def mine_block():

# create a response to return to the user
response = {
'message': 'Congratulation! you just mined a block!',
'message': 'Congratulations! you just mined a block!',
'index': block['index'],
'timestamp': block['timestamp'],
'proof': block['proof'],
Expand All @@ -145,7 +146,7 @@ def mine_block():
# Getting the full Blockchain
@app.route('/get_chain', methods = ['GET'])

# creating the get_chain function to get the full chain
# Creating the get_chain function to get the full chain
def get_chain():
# create a response to return to the user
response = {
Expand Down

0 comments on commit 97b7553

Please sign in to comment.