Skip to Content
Building Blockchain Projects
book

Building Blockchain Projects

by Narayan Prusty
April 2017
Intermediate to advanced
266 pages
7h 4m
English
Packt Publishing
Content preview from Building Blockchain Projects

Callback functions

Once your result is ready, Oraclize will send a transaction back to your contract address and invoke one of these three methods:

  • either __callback(bytes32 myid, string result). Myid is a unique ID for every query. This ID is returned by the oraclize_query method. If you have multiple oraclize_query calls in your contract, then this is used to match the query this result is for.
  • If you requested for the TLS Notary proof, this is the result: __callback(bytes32 myid, string result, bytes proof)
  • As a last resort, if the other methods are absent, the fallback function is function()

Here is an example of the __callback function:

function __callback(bytes32 myid, string result) {  if (msg.sender != oraclize_cbAddress()) throw; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Blockchain Apps

Building Blockchain Apps

Michael Juntao Yuan
Blockchain Development with Hyperledger

Blockchain Development with Hyperledger

Salman A. Baset, Luc Desrosiers, Nitin Gaur, Petr Novotny
Advanced Blockchain Development

Advanced Blockchain Development

Imran Bashir, Narayan Prusty

Publisher Resources

ISBN: 9781787122147Supplemental Content