You are on page 1of 1

import hashlib

class Block:

def __init__(self, blockNumber, transactions, timestamp ,signatures):


self.blockNumber = blockNumber
self.transactions = transactions
self.signatures = signatures
self.timestamp = timestamp

def signBlock(self, sign_str):


prehashData = sign_str
prehash = hashlib.sha3_256(prehashData.encode()).hexdigest().encode()
hash_signature = hashlib.sha3_256(prehash).hexdigest()
self.signatures.append(hash_signature)