Demystifying Consensus Mechanisms: A Comparative Study of Proof of Work vs Proof of Stake