input: Write a function to compose a basic blockchain system in Python. The function should include a Block class to represent each block in the blockchain, and a Blockchain class to manage the chain of blocks. The function should also include a method to add blocks to the blockchain and a method to retrieve the entire blockchain in JSON format.
  assert create_blockchain() == "Blockchain created"
  assert add_block({"timestamp": "2023-10-01 12:00:00", "data": "Initial block"}) == "Block added"
  assert get_chain() == '[{"index": 0, "timestamp": "2023-10-01 12:00:00", "data": "Initial block", "previous_hash": null, "hash": "..."}]'
output: def create_blockchain():
      global blockchain
      blockchain = Blockchain()
      return "Blockchain created"
  
  def add_block(block_data):
      blockchain.add_block(block_data)
      return "Block added"
  
  def get_chain():
      return blockchain.to_json()
  
  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):
          sha = hashlib.sha256()
          sha.update(f"{self.index}{self.timestamp}{self.data}{self.previous_hash}".encode('utf-8'))
          return sha.hexdigest()
  
  class Blockchain:
      def __init__(self):
          self.chain = [self.create_genesis_block()]
  
      def create_genesis_block(self):
          return Block(0, "2023-10-01 12:00:00", "Initial block", "0")
  
      def get_latest_block(self):
          return self.chain[-1]
  
      def add_block(self, data):
          latest_block = self.get_latest_block()
          new_block = Block(latest_block.index + 1, data["timestamp"], data["data"], latest_block.hash)
          self.chain.append(new_block)
  
      def to_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])