This question already has an answer here:

The following is what the Ethereum documentation of Oraclize says:

Firstly, in the most common case, a transaction executing a function of a smart contract is broadcasted by an user. The function contains a special instruction which manifest to Oraclize, who is constantly monitoring the Ethereum blockchain for such instruction, a request for data.

Secondly, according to the parameters of such request, Oraclize will fetch or compute a result, build, sign and broadcast the transaction carrying the result. In the default configuration, such transaction will execute the __callback function which should be placed in the smart contract by its developer: for this reason, this transaction is referred in the documentation as the Oraclize callback transaction.

What kind of instruction is executed? What messages are passed around when calling the oraclize_query function?

Is the "special" instruction and oraclize_query the same thing? As far as I understand, oraclize_query is the request for data, right?

The other answers, don't address what the "special" instruction is, etc.

marked as duplicate by Ismael, Richard Horrocks, lungj, carver, Edmund Edgar Sep 15 '17 at 20:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


EDIT: I found out in the comments at the question suggested by others to be the original one where the answers are that it actually does work the way I suggested (the events part was what I was unsure about)

I am not completely sure about this, but this is my assumption of how things work under the hood:

  • when oraclize_query is invoked, it publishes an event with the data about what kind of query etc.

  • oraclize monitors the blockchain and filters those events

  • after finding out the answer, they send it to the contract that asked for it using __callback function (implemented by the requester)

This is the reason why it takes few blocks for the answer to be delivered.

I tried to confirm those assumptions by looking at the code, but got lost in it.

  • An event is just data in the blockchain, right? It is not a transaction/message? – Shuzheng Sep 15 '17 at 17:57
  • exactly. it is a way of logging - solidity.readthedocs.io/en/develop/contracts.html#events – kruk Sep 15 '17 at 20:27
  • Why do they mention a special (invalid) instruction? – Shuzheng Sep 16 '17 at 5:16
  • sorry, I don't get: who mentions a special or invalid instruction? – kruk Sep 18 '17 at 16:27
  • The Oraclize documentation for Ethereum API. – Shuzheng Sep 20 '17 at 5:20

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