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
  
  """
  >>> blockchain = Blockchain()
  >>> blockchain.create_block(nonce=1, previous_hash='0')
  {'block_number': 1, 'timestamp': time.time() * 1000, 'nonce': 1, 'previous_hash': '0'}
  >>> blockchain.hash_block({'block_number': 1, 'timestamp': blockchain._current_timestamp(), 'nonce': 1, 'previous_hash': '0'})
  'generated_hash_value'
  """
  
output:     def add_transaction(self, sender, receiver, amount):
          transaction = {
              'sender': sender,
              'receiver': receiver,
              'amount': amount
          }
          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)
          return block