input: Write a function to implement a basic blockchain system in Python. The function should define a class for each block, a class for the blockchain, and methods to add blocks to the blockchain and retrieve the entire blockchain in JSON format.
  
  The function should be named `create_blockchain`. The input to the function should be a list of dictionaries, where each dictionary contains the necessary data to create a block (e.g., timestamp, data). The output of the function should be a JSON string representing the entire blockchain after adding all the blocks.
  
  assert create_blockchain([
      {'timestamp': '2023-01-01 12:00:00', 'data': 'Block 1 Data'},
      {'timestamp': '2023-01-02 13:00:00', 'data': 'Block 2 Data'}
  ])=='[\n  {\n    "index": 0,\n    "timestamp": "2023-01-01 12:00:00",\n    "data": "Block 1 Data",\n    "previous_hash": null,\n    "hash": "9a5f8b1c7a5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b"\n  },\n  {\n    "index": 1,\n    "timestamp": "2023-01-02 13:00:00",\n    "data": "Block 2 Data",\n    "previous_hash": "9a5f8b1c7a5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b",\n    "hash": "8b1c7a5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f3b5e4f"\n  }\n]'
  assert create_blockchain([])=='[]'
output: def create_blockchain(blocks):
      import hashlib
      import json
      from time import time
  
      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 = self.calculate_hash()
  
          def calculate_hash(self):
              block_string = json.dumps({"index": self.index, "timestamp": self.timestamp, "data": self.data, "previous_hash": self.previous_hash}, sort_keys=True).encode()
              return hashlib.sha256(block_string).hexdigest()
  
      class Blockchain:
          def __init__(self):
              self.chain = []
              self.create_genesis_block()
  
          def create_genesis_block(self):
              genesis_block = Block(0, "2023-01-01 12:00:00", "Genesis Block", "0")
              self.chain.append(genesis_block)
  
          def add_block(self, data):
              previous_block = self.chain[-1]
              new_block = Block(len(self.chain), data['timestamp'], data['data'], previous_block.hash)
              self.chain.append(new_block)
  
          def get_chain_json(self):
              return json.dumps([{"index": block.index, "timestamp": block.timestamp, "data": block.data, "previous_hash": block.previous_hash, "hash": block.hash} for block in self.chain], indent=2)
  
      blockchain = Blockchain()
      for block_data in blocks:
          blockchain.add_block(block_data)
      return blockchain.get_chain_json()