I've been trying to run two contracts on a private net, using oraclize brigde. First one runs perfectly, however the second one for some reason doesn't call the callback function (despite having sent a query) unless I delete some of the code from the function. Here is the problematic part of the code from it:

pragma solidity ^0.4.16;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
import "github.com/Arachnid/solidity-stringutils/strings.sol";

contract CFDBroker is usingOraclize {

   using strings for *;

   mapping (uint => uint) instruments;
   mapping (bytes32 => uint) queries;
   uint public GOLD;
   uint public EURUSD;
   uint public DJI;

   function sendFunds() payable {



   function __callback(bytes32 myid, string result, bytes proof) {

       require(msg.sender == oraclize_cbAddress());

       if (queries[myid] == 1){
           //parse and update gold
           var s = result.toSlice();
           GOLD = parseInt(s.beyond("$".toSlice()).until("/".toSlice()).toString())*100;
           instruments[1] = GOLD;

       } else{
           if(queries[myid] == 2){
               //parse and update eur/usd
               s = result.toSlice();
               var r = result.toSlice().beyond(".".toSlice());
               EURUSD = parseInt(s.beyond("$".toSlice()).until(".".toSlice()).concat(r));
               instruments[2] = EURUSD;

           } else{
               if(queries[myid] == 3){
                   //update DJI
                   DJI = parseInt(result)*100;



       //getData(); --supposed source of the problem


    *  Instrument IDs:
    *  0 - ASK FOR ALL
    *  1 - GOLD
    *  2 - EUR/USD
    *  3 - DJI
   function getData() private{

       queries[oraclize_query(50, "WolframAlpha","gold price in usd")] = 1; //ask for gold
       queries[oraclize_query(50, "WolframAlpha","eur/usd")] = 2; // ask for eur/usd
       queries[oraclize_query(50, "WolframAlpha","DJI price")] = 3; //ask for DJI


It's a model of a CFD broker, the quoted part is supposed to update prices of 3 financial instruments every 60 seconds. It works fine, when getData() in callback is commented. All in all, it seems very similar to this problem: link.

The contract is a part of my student project, I'd be very grateful for any help :).


Marco from Oraclize here. I can see two potential source of the problem:

  1. Not enough funds are present on the contract balance to pay for three new queries
  2. Not enough gas provided to the callback function

Did you try sending more gas along the callback or increasing the contract balance?

| improve this answer | |
  • Ok, it seems, that I didn't understand how Oraclize works well enough. Anyway turns out, that I didn't send enough gas to callback. Thanks a lot for your answer :). – Jakub Sep 7 '17 at 15:21

First,you should check there is no typo mistake.It's a easy mistake to type _callback for __callback function.There is double _,not only single _before callback.It's a Easily neglected!

Second,when you are in Remix, navigate to Settings,look at the Plugin area and click on Oraclize plugin.Only bind remix with the module Oraclize that you can use oraclize. if you are using web3/injected provider,which means you are using Rospten/Kovan testnets or your local private network, you will get the following message:

This Oraclize plugin is currently NOT working in remix via web3/injected provider. This is available for the in-memory mode only (JavaScript VM). If you want to use Oraclize-based contracts, please verify first that Oraclize is integrated with the blockchain you are using - if not you can enable it via a dedicated ethereum-bridge instance

So you can only use Oraclize in JavaScript VM, or you need to use ethereum-bridge for your local private network and testnets like Ropsten.

| improve this answer | |

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.