0

What is Oracles? Why is it needed? Is there any good technical blog with an example in which Oracles is explained?

From whatever I read about Oracles

Oracle is a trusted third party API from which smart contract will fetch the data.

Purpose of the blockchain is to remove interference of third parties/brokers and let two transacting parties transact peer to peer even when they don't trust each other.

Then are Oracles introducing new broker/trusted parties in the blockchain? Isn't it contradiction with a purpose of the blockchain?

1

Your quote is correct. And all of your assumptions are also correct.

Ethereum blockchain is deterministic. It means it always contains all of the data required for processing and everyone is able to process the same transaction in exactly the same way. At any given point in time, all the data is known in the blockchain.

This poses certain...difficulties when creating a real-world usage of a smart contract. As the blockchain has no knowledge of anything outside the blockchain, it can't for example tell you the temperature in London at present moment.

So what to do when you want external information into the contract? You send it a transaction which contains that information. For example you can send the current temperature of London to the contract and after that others can query for it.

This is where oracles come in. You can ask an oracle to send a transaction to the blockchain with whatever data you want. That way you don't have to perform the transactions yourself. Here's how it roughly works:

1) Your contract calls an oracle contract with a data request (for example temperature in London)

2) The oracle provider's backend notices the request (probably through some event) and fetches the temperature from some regular online service.

3) The backend sends a transaction to the oracle contract with the temperature

4) The oracle contract forwards the data to your contract

So, oracles are not miracle workers, they can't do anything you couldn't do yourself, they just facilitate the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.