This chapter presents a detailed description of smart contracts and proof-based consensus mechanisms used in blockchain technology. Smart contracts are used in blockchain technology while making the transaction between two parties, and it enables only the validated transaction to be included in the blockchain. However, to validate a transaction Satoshi Nakamoto, who is the inventor of blockchain, introduced a Proof-of-Work (PoW) consensus algorithm while performing transactions among blockchain nodes (i.e., users). Later on, various proof-based consensus mechanisms (e.g., Proof-of-Stake (PoS), Proof-of-Location (PoL), PBFT (Practical Byzantine Fault Tolerance)) are proposed. The main concept of applying proof-based algorithms is that the nodes within the blockchain network that performs and exhibits sufficient proof will get the privilege to append a new block to the main chain and collect the reward. In this chapter, we present a clear explanation of smart contracts and discuss some of the most important consensus algorithms of blockchain that are widely used.