A smart contract is best defined as a computer code that lets you enforce rules and regulations between two parties that are going to interact to carry out a deal. The agreement once is written can be executed automatically for any number of times. Smart contracts is a legal agreement that is written with the help of code. It is widely used in blockchain to automate tasks and also bring transparency to a particular system. For example, smart contracts can be used to sell or own real-world assets.