What is consensus in a blockchain?

Consensus in a blockchain refers to the agreement among network nodes about the validity of transactions. Popular consensus mechanisms include Proof of Work (PoW) and Proof of Stake (PoS).