Oracles

  • Oracles let smart contracts execute based on real-world data.
  • They query, validate, and authenticate information at the request of a node.
  • You can minimize the amount of transaction data that an oracle sees by tearing off the portions that the oracle does not need to access.

Oracles are network services that supply external information to smart contracts. They serve as bridges between Corda networks and the outside world, broadening the uses for smart contracts to include agreements that require off-ledger information to execute. This could include anything from the current exchange rate for a transfer of funds, to the weather in Minnesota for an insurance policy.

Oracles are not the source of information—they’re an entity that queries, verifies, and authenticates external data sources, then relays that information back to a smart contract.

For example, Alice sells Bob an insurance policy that covers a crop failure due to drought. They agree that Alice will pay Bob $50,000 if temperatures on his farm rise above 100 degrees Fahrenheit for seven consecutive days. They can write this into a smart contract that depends on a mutually-trusted API reporting the weather from the National Weather Service. If Bob puts in a claim, the oracle queries the API to determine that the defined drought conditions have been met. If they have, the smart contract executes and Bob receives $50,000 from Alice.

If a node wants to assert a fact when proposing a transaction (for example, Bob claiming that his farm is experiencing drought), they can request a command that asserts that fact from the oracle. If the oracle determines the fact to be true (for example, by querying the National Weather Service’s API), they send the node the required command. The node can then include the fact (in the form of the command) in their transaction, and the oracle signs the transaction to assert the validity of the fact.

Some oracles monetize their services. In that case, you’ll need to pay the oracle before they sign the transaction.

The oracle doesn’t need to see the whole contract–only the part it needs to validate. The node proposing the transaction can tear off unrelated parts of the contract before the oracle sees it. For example, in Alice and Bob’s contract, the oracle is only attesting to the temperature on Bob’s farm, so it doesn’t need to know how much the insurance policy is for. Bob could tear off that information.

Previous
Time-windows
Next
Nodes

Was this page helpful?

Thanks for your feedback!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.

We're sorry this page wasn't helpful. Let us know how we can make it better!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Create an issue

Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.