What is a smart contract?

A smart contract is a self-executing contract that automatically enforces the terms of a contract when certain conditions are met. It is a set of instructions that are written in code and stored on a blockchain.