smart contract
A smart contract is a small program stored on a blockchain that runs exactly as written whenever someone calls it. Despite the name, it is not a legal document and there are no lawyers involved; think of it more like a vending machine made of code. A vending machine holds the rules ('insert this much, get that item') and carries them out by itself, with no shopkeeper. A smart contract does the same for digital agreements: it holds the rules and the funds, and releases or moves them automatically when the agreed conditions are met. The problem it solves is having to trust a middleman to follow through.
Because the contract's code and the record of everything it has done live on the blockchain, every participant can read the rules in advance and verify that they ran honestly. Once deployed, a contract usually cannot be quietly altered, so it does what it always said it would. People interact with it by sending transactions that call its functions; the network runs the code, updates the stored balances and data, and records the outcome for all to see. Many contracts can also call one another, so simple pieces snap together into larger systems, the way small apps combine into a bigger service.
Smart contracts matter because they let strangers cooperate without a trusted authority in the middle. They power lending pools, exchanges, digital collectibles, voting, and escrow that hold and pay out money according to public rules rather than a company's promise. The trade-off is that the code is the final authority: if it contains a mistake, the contract will still follow that flawed logic faithfully, so careful design and review really matter.
A simple escrow contract holds a buyer's payment and releases it to the seller only after the buyer confirms delivery; if neither confirms within a set time, it returns the money. The rules are public and run themselves, so neither side has to trust the other to be fair.
Most smart contracts cannot be changed after deployment, so a bug usually cannot simply be patched the way ordinary software is.