For example, in conditional payments, the release of payment can be conditioned by confirmation of some event having been posted by an oracle. In a sports betting contract, an oracle posts the result of a game and the party who correctly predicted the outcome wins the money locked on the contract. In a flight delay insurance contract, an oracle posts the delay of a particular flight and if it is above some threshold, the insured gets the money locked on the contract by the insurer.
In stablecoins and other synthetic assets that are created using Autonomous Agents, oracles are very important for providing accurate price data.
Oracles need to be trusted by both (or more) parties of a smart contract or by all users of an Autonomous Agent to provide true data because the performance of smart contracts and AAs depends on that data. That's why oracles are usually run by well known and reputable individuals or organizations. Where especially high level of assurance is required, smart contracts or AAs can reference several oracles.
Oracles are bridges between the real world and the distributed ledger. They bring real-world data to the ledger, usually by reading some publicly accessible API and posting that data into the Obyte DAG. Data is posted as a data feed transaction. In Obyte, several types of transactions are possible, payment being the most popular one, and data feed is another type of transaction. The data feed is posted from the oracle address and can be easily found by this address and data feed name.
Oracles are usually automated and operate in one of three modes:
Data can also be posted manually, Obyte wallet allows to easily do so. This makes sense for rare or one-off events.
Once a data point is posted by an oracle, it is stored on the DAG indefinitely and can be freely read by smart contracts and Autonomous Agents using oracle address and data feed name. Smart contracts that depend on oracle data can reference it like this:
['in data feed', [ ['ORACLE_ADDRESS'], 'data feed name', '=', 'expected value'] ]
Autonomous Agents can read the latest data feed value like this:
data_feed[[oracles=$oracle_address, feed_name=$data_feed_name]]
Developers, see the developer docs to learn more about posting data feeds, using oracle data in smart contracts, and using oracle data in AAs.