input: 
  import hashlib
  import json
  
  class Blockchain:
      """A basic implementation of a blockchain using core Python modules.
      
      >>> blockchain = Blockchain()
      >>> blockchain.create_block(nonce=12345, previous_hash="0")
      {'block_number': 1, 'timestamp': 1672531200000, 'nonce': 12345, 'previous_hash': '0'}
      >>> blockchain.chain
      [{'block_number': 1, 'timestamp': 1672531200000, 'nonce': 12345, 'previous_hash': '0'}]
      """
  
      def __init__(self):
          self.chain = []
          self.transactions = []
  
      def create_block(self, nonce, previous_hash):
          """Create and add a new block to the blockchain."""
          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 the current timestamp in milliseconds."""
          import time
          return round(time.time() * 1000)
  
      def hash_block(self, block):
          """Hash a block using SHA-256."""
          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):
          """Add a new transaction to the list of transactions."""
          transaction = {
              'sender': sender,
              'receiver': receiver,
              'amount': amount
          }
          self.transactions.append(transaction)
          return len(self.chain) + 1
  
      def mine_block(self):
          """Mine a new block and add it to the blockchain."""
          if not self.transactions:
              return False
  
          previous_block = self.chain[-1] if self.chain else {'block_number': 0, 'previous_hash': '0'}
          previous_hash = self.hash_block(previous_block)
          nonce = self._proof_of_work(previous_hash)
          block = self.create_block(nonce, previous_hash)
          self.transactions = []
          return block
  
      def _proof_of_work(self, previous_hash):
          """Simple proof of work algorithm."""
          nonce = 0
          while self._valid_proof(nonce, previous_hash) is False:
              nonce += 1
          return nonce
  
      def _valid_proof(self, nonce, previous_hash):
          """Validate the proof of work."""
          guess = f'{nonce}{previous_hash}'.encode()
          guess_hash = hashlib.sha256(guess).hexdigest()
          return guess_hash[:4] == "0000"
  
      def is_chain_valid(self):
          """Check if the blockchain is valid."""
          previous_block = self.chain[0]
          block_index = 1
  
          while block_index < len(self.chain):
              current_block = self.chain[block_index]
              if current_block['previous_hash'] != self.hash_block(previous_block):
                  return False
              if not self._valid_proof(current_block['nonce'], current_block['previous_hash']):
                  return False
              previous_block = current_block
              block_index += 1
          return True
  