Smart contracts are self-executing contracts with the terms of the agreement directly written into lines of code. They exist on a blockchain, a decentralized and distributed digital ledger that ensures transparency, security, and immutability. The code and the agreements contained therein are executed automatically when predefined conditions are met.