Understanding Proof of Work and Proof of Stake