A smart contract is a self-executing computer program that runs on a blockchain that can run, control, or record legally relevant activities between parties within the network. It is a collection of code stored within supported blockchains, e.g., Ethereum, which users can interact with.
Smart contracts can be used to define rules which can be automatically enforced. Since they function on the blockchain, they enjoy all the technology's benefits, such as immutability, transparency, decentralization, and encryption. A smart contract is a transaction protocol that eliminates the need for a trusted intermediary to oversee the secure enforcement of the terms of the contract.