Consensus is how a blockchain achieves agreement in a decentralised peer-to-peer (P2P) network.