# Creating a Blockchain using Python by Dr B P Sharma # To be installed: # pip install Flask # Postman HTTP Client from https://www.getpostman.com # Importing the required libraries import datetime import hashlib import json from flask import Flask, jsonify # Building a sample Blockchain class Blockchain: def __init__(self): self.chain = [] self.createBlock(proof = 1, previousHash = '0') def createBlock(self, proof, previousHash): block = {'index': len(self.chain) + 1, 'timestamp': str(datetime.datetime.now()), 'proof': proof, #nonce 'previousHash': previousHash} self.chain.append(block) return block ...
Comments
Post a Comment