In the context of blockchains and cryptocurrencies, smart contracts are:
– pre-written logic (computer code),
– stored and replicated on a distributed storage platform (eg a blockchain),
– executed/run by a network of computers (usually the same ones running the blockchain),
– and can result in ledger updates (cryptocurrency payments, etc).
… In other words, they are little programs that execute “if this happens then do that”, run and verified by many computers to ensure trustworthiness.
If blockchains give us distributed trustworthy storage, then smart contracts give us distributed trustworthy calculations.
With smart contracts running on a blockchain, the logic is run in parallel on all the participating computers, and the results are compared by all participants. Participants only change their own version of the ledger if they agree the results. No one can cheat a blockchain, in theory.
Thanks to our friend Antony Lewis of bitsonblocks.net for the explanation. He's one of our favorite writers on the subject.