An external data source can be linked to a P2SH address with a certain value set in the script.
The script requires two keys to unlock the funds, one key held by the beneficiary, the other key held by a trusted Oracle whose job is to validate that the value conditions are met.
A self-executing insurance contract can be written by the insurance company and a user, both trusting an oracle to check an external data source.
For example, the insurance contract can be a promise to indemnify the user if a flight is canceled.
Because the script includes a hash of the contract terms, the oracle signature of a transaction spending the Oracle Contract address to the user address is the oracle testimony that the flight was indeed canceled.
<contract_hash> DROP 2 <beneficiary pubkey> <oracle pubkey> 2 CHECKMULTISIG
0 <beneficiary signature> <oracle signature>
Contract hash: cd6c5f44e130f979874b87f11562d8dc1e73bd3a83d666e3a66de681a0e1cb2e
Beneficiary (Compressed) Public Key: 023927B837A922696836E26399F759965328437F93AAFAF3E02767D22860C0FBA7
Oracle (Compressed) Public Key: 02259B57015E60DE464E1D83C375BDD01D272290C51CEDE0B794301DE1B7770C7B
Oracle Contract Address: 3Qr7QGxKLosD3RsRB96BpMx9vFb2rpNtm5