input: Write a function to implement a simple blockchain system in Python. The function should include a Block class with attributes for index, timestamp, data, previous_hash, and an auto-generated hash based on block contents. It should also include functions to create the blockchain, adding blocks to it, and printing the blockchain. The function should return the blockchain as a list of Block objects.
  
  def blockchain_system():
      import hashlib
      import json
      from datetime import datetime
  
      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.hash_block()
  
          def hash_block(self):
              sha = hashlib.sha256()
              sha.update((str(self.index) + 
                         str(self.timestamp) + 
                         str(self.data) + 
                         str(self.previous_hash)).encode('utf-8'))
              return sha.hexdigest()
  
      def create_genesis_block():
          return Block(0, datetime.now(), "Genesis Block", "0")
  
      def next_block(last_block, data):
          this_index = last_block.index + 1
          this_timestamp = datetime.now()
          this_data = data
          this_hash = last_block.hash
          return Block(this_index, this_timestamp, this_data, this_hash)
  
      blockchain_transactions = ["transaction1", "transaction2", "transaction3"]
      blockchain = [create_genesis_block()]
      previous_block = blockchain[0]
  
      for i in range(1, len(blockchain_transactions)):
          block_to_add = next_block(previous_block, blockchain_transactions[i])
          blockchain.append(block_to_add)
          previous_block = block_to_add
  
      return blockchain
  
  assert [block.data for block in blockchain_system()] == ["Genesis Block", "transaction1", "transaction2", "transaction3"]
  assert blockchain_system()[0].hash == blockchain_system()[1].previous_hash
  assert blockchain_system()[1].hash == blockchain_system()[2].previous_hash
  assert blockchain_system()[2].hash == blockchain_system()[3].previous_hash
output: 
  def blockchain_system():
      import hashlib
      import json
      from datetime import datetime
  
      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.hash_block()
  
          def hash_block(self):
              sha = hashlib.sha256()
              sha.update((str(self.index) + 
                         str(self.timestamp) + 
                         str(self.data) + 
                         str(self.previous_hash)).encode('utf-8'))
              return sha.hexdigest()
  
      def create_genesis_block():
          return Block(0, datetime.now(), "Genesis Block", "0")
  
      def next_block(last_block, data):
          this_index = last_block.index + 1
          this_timestamp = datetime.now()
          this_data = data
          this_hash = last_block.hash
          return Block(this_index, this_timestamp, this_data, this_hash)
  
      blockchain_transactions = ["transaction1", "transaction2", "transaction3"]
      blockchain = [create_genesis_block()]
      previous_block = blockchain[0]
  
      for i in range(1, len(blockchain_transactions)):
          block_to_add = next_block(previous_block, blockchain_transactions[i])
          blockchain.append(block_to_add)
          previous_block = block_to_add
  
      return blockchain
  