A smart contract is a computer program deployed on a blockchain that allows applications to run. Fundamentally, it is a simple computer program that runs autonomously on a blockchain. It contains predefined rules and conditions that automatically trigger actions when specific conditions are met. This allows advanced transactions, inner transactions, and messages to be sent on-chain.
Interacting with other smart contracts, they can theoretically automate trustless agreements across decentralized blockchains. Given an ecosystem of [[Interoperability|interoperable]] blockchains, this would also require that smart contracts met the property of [[composability]].
Key properties of smart contracts include:
- Autonomy: Once deployed, smart contracts operate autonomously based on predefined logic.
- Deterministic Execution: The execution outcome is predictable and deterministic, ensuring consistent results for all participants.
- [[Immutability]]: Once deployed to the blockchain, smart contracts cannot be altered or tampered with.
- Just as with a blockchain ledger's global state, the state of a smart contract relies upon this property, but the blockchain state is probabilistic not deterministic.
Today, smart contracts are most successfully implemented on the Ethereum blockchain. In the book [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook/blob/develop/book.asciidoc) written by two very prominent blockchain figures - Andreas M. Antonopoulos and Gavin Wood - [smart contracts are defined within the context of the Ethereum blockchain](https://github.com/ethereumbook/ethereumbook/blob/develop/07smart-contracts-solidity.asciidoc#what-is-a-smart-contract). Because smart contracts do not change state once deployed, Antonopoulos and Wood note that executed code holds the property of determinism.
Smart contracts are currently used in a variety of applications but most notably in Decentralized Finance (DeFi) applications where large amounts of money are in play.