input: Write a function to create a basic blockchain system in Python. The function should define a Block class that initializes an instance with index, timestamp, data, and previous_hash, and a Blockchain class that initializes an empty chain. The Blockchain class should have a method to add new blocks to the chain and a method to return the entire blockchain in JSON format.
  
  assert create_blockchain([]) == "[]"
  assert create_blockchain([{'timestamp': '2023-01-01', 'data': 'Block 1'}]) == '[{"index": 0, "timestamp": "2023-01-01", "data": "Block 1", "previous_hash": null, "hash": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]'
  assert create_blockchain([{'timestamp': '2023-01-02', 'data': 'Block 2'}, {'timestamp': '2023-01-03', 'data': 'Block 3'}]) == '[{"index": 0, "timestamp": "2023-01-02", "data": "Block 2", "previous_hash": null, "hash": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"index": 1, "timestamp": "2023-01-03", "data": "Block 3", "previous_hash": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "hash": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"}]'
output: class Block:
      def __init__(self, index, timestamp, data, previous_hash):
          self.index = index
          self.timestamp = timestamp
          self.data = data
          self.previous_hash = previous_hash
          self.hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  
  class Blockchain:
      def __init__(self):
          self.chain = []
  
      def add_block(self, block):
          if not self.chain:
              block.previous_hash = None
          else:
              block.previous_hash = self.chain[-1].hash
          self.chain.append(block)
  
      def to_json(self):
          return json.dumps([block.__dict__ for block in self.chain])
  
  def create_blockchain(blocks):
      blockchain = Blockchain()
      for i, block_data in enumerate(blocks):
          block = Block(i, block_data['timestamp'], block_data['data'], None)
          blockchain.add_block(block)
      return blockchain.to_json()