input: 
  import hashlib
  import json
  import time
  
  class Blockchain:
  
   def __init__(self):
   self.chain = []
   self.transactions = []
  
   def create_block(self, nonce, previous_hash):
   block = {
   'block_number': len(self.chain) + 1,
   'timestamp': self._current_timestamp(),
   'nonce': nonce,
   'previous_hash': previous_hash
   }
   self.chain.append(block)
   return block
  
   def _current_timestamp(self):
   return round(time.time() * 1000)
  
   def hash_block(self, block):
   string_object = json.dumps(block, sort_keys=True)
   block_string = string_object.encode()
   raw_hash = hashlib.sha256(block_string)
   hex_hash = raw_hash.hexdigest()
   return hex_hash
  
output:     def add_transaction(self, sender, receiver, amount):
          transaction = {
              'sender': sender,
              'receiver': receiver,
              'amount': amount,
              'timestamp': self._current_timestamp()
          }
          self.transactions.append(transaction)
          return len(self.chain) + 1
  
      def get_previous_block(self):
          return self.chain[-1]
  
      def proof_of_work(self, previous_nonce):
          new_nonce = 1
          check_proof = False
          while check_proof is False:
              hash_operation = hashlib.sha256(str(new_nonce**2 - previous_nonce**2).encode()).hexdigest()
              if hash_operation[:4] == '0000':
                  check_proof = True
              else:
                  new_nonce += 1
          return new_nonce
  
      def mine_block(self):
          previous_block = self.get_previous_block()
          previous_nonce = previous_block['nonce']
          nonce = self.proof_of_work(previous_nonce)
          previous_hash = self.hash_block(previous_block)
          block = self.create_block(nonce, previous_hash)
          block['transactions'] = self.transactions
          self.transactions = []
          return block