A Survey on Blockchain: Architecture, ConsensusProtocols, and Applications