Name: Shubham Bhadaker Sathaye College - 02 Blockchain Practical 01
Name: Shubham Bhadaker Sathaye College - 02 Blockchain Practical 01
Sathaye College_ 02
Blockchain practical 01
import datetime
import hashlib
class Block:
self.previous_block_hash = previous_block_hash
self.data = data
self.timestamp = timestamp
self.hash = self.get_hash()
@staticmethod
def create_genesis_block():
return Block('0','0',datetime.datetime.now())
def get_hash(self):
inner_hash = hashlib.sha256(header.encode()).hexdigest().encode()
comp_hash = hashlib.sha256(inner_hash).hexdigest()
return comp_hash
number_of_blocks = 14
Blockchain = [Block.create_genesis_block()]
for i in range(1,number_of_blocks):