How Smart Contracts Work
Blockchain technology could run a flight-insurance business without any employees
Smart contracts are software programs that live on a blockchain and form the basis of many of the new blockchain applications and schemes. They are essentially automated systems that can provide services in exchange for cryptocurrency. However, because blockchains are not good for storing large amounts of data nor for querying the state of the outside world, they need services that exist off the blockchain to do those things for them. In this example, an automated flight-insurance smart contract uses an “oracle” to look up data about flight delays.
All illustrations: Greg Mably
A passenger requests flight insurance by sending ethers to a smart contract—an application that exists on the Ethereum blockchain—along with her flight information.
The smart contract sends a request to an “oracle”— a service that exists outside the blockchain—to verify the flight details and gather historical information about that route.
The smart contract then uses that information to determine if the offered premium is adequate. If the smart contract accepts the premium, it then asks the oracle to report on the status of the flight in question.
The oracle uses information from RealTimeFlightData to report the status of the flight to the smart contract.
If the flight is delayed, the contract pays the passenger. If the flight is on time, the contract pays itself.