input: Write a function to implement a basic blockchain system using Python. The function should include a class `Block` representing individual blocks and a class `Blockchain` to manage the chain. Each block should contain an index, timestamp, data, and the hash of the previous block. The blockchain should be capable of adding new blocks and returning the entire chain in JSON format.
  assert create_blockchain().get_chain()=='[]'
  assert json.loads(create_blockchain().add_block({'timestamp': '2023-01-01', 'data': 'Genesis Block'}).get_chain())[0]['data']=='Genesis Block'
  assert json.loads(create_blockchain().add_block({'timestamp': '2023-01-02', 'data': 'Block 2'}).add_block({'timestamp': '2023-01-03', 'data': 'Block 3'}).get_chain())[1]['data']=='Block 3'
  assert create_blockchain().add_block({'timestamp': '2023-01-02', 'data': 'Block 2'}).chain[0].previous_hash is None
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 = self.calculate_hash()
  
      def calculate_hash(self):
          block_string = f"{self.index}{self.timestamp}{self.data}{self.previous_hash}"
          return hashlib.sha256(block_string.encode()).hexdigest()
  
  class Blockchain:
      def __init__(self):
          self.chain = []
          self.create_genesis_block()
  
      def create_genesis_block(self):
          genesis_block = Block(0, "2023-01-01", "Genesis Block", "0")
          self.chain.append(genesis_block)
  
      def add_block(self, data):
          previous_block = self.chain[-1]
          new_index = previous_block.index + 1
          new_block = Block(new_index, data['timestamp'], data['data'], previous_block.hash)
          self.chain.append(new_block)
          return self
  
      def get_chain(self):
          chain_data = []
          for block in self.chain:
              chain_data.append({
                  'index': block.index,
                  'timestamp': block.timestamp,
                  'data': block.data,
                  'previous_hash': block.previous_hash,
                  'hash': block.hash
              })
          return json.dumps(chain_data)