Let’s consider a real-life scenario in which smart contracts are used. Rachel is at the airport, and her flight is delayed. AXA, an insurance company, provides flight delay insurance utilizing Ethereum smart contracts. This insurance compensates Rachel in such a case. How? The smart contract is linked to the database recording flight status. The smart contract is created based on terms and conditions.
The condition set for the insurance policy is a delay of two hours or more. Based on the code, the smart contract holds AXA’s money until that certain condition is met. The smart contract is submitted to the nodes on EMV (a runtime compiler to execute the smart contract code) for evaluation. All the nodes on the network executing the code must come to the same result. That result is recorded on the distributed ledger. If the flight is delayed in excess of two hours, the smart contract self-executes, and Rachel is compensated. Smart contracts are immutable; no one may alter the agreement.
More detail: https://www.simplilearn.com/tutorials/blockchain-tutorial/what-is-smart-contract