Blockchain and Smart Contracts for Decentralized Applications