Smart Contract
Think of a smart contract as a vending machine written in code: insert the right input, and the output is dispensed automatically, exactly as programmed. Once deployed on a blockchain, the code cannot be changed unilaterally — it runs the same way for every user, every time. This immutability (the property of not being alterable) and trustlessness (no need to trust the other party, only the code) are what make smart contracts central to DeFi, NFTs, and many other blockchain applications.
A simple hypothetical: suppose two parties agree that if Asset X's price exceeds $100 at a given date, Party A pays Party B $50. A smart contract can hold the funds in escrow and release them automatically the moment a verified price feed reports that condition, with no lawyer, broker, or bank involved. The blockchain records the transaction permanently and publicly.
A common confusion is equating "smart" with "correct." Smart contracts execute exactly what the code says — not necessarily what the programmer intended. Bugs and logic errors have led to significant losses in crypto's history, since the immutability that prevents tampering also prevents easy fixes after deployment. Gas fees are charged every time a smart contract is executed, reflecting the computational work required.