Can you provide a detailed explanation of how blockchain technology ensures data integrity and security, while also mentioning the role of consensus mechanisms? Your response should contain at least 4 sentences.
user