Blockchains: Fundamentals and Applications