I got below piece of code from one site and trying to run it using Remix. But while creating the contract I am getting error message:

The constructor should be payable if you send value

I assigned gas limit as 80000000000 and value as 1 ether while creating the contract, which didn't had any positive effect.

Please help, how I can solve this error?

   WolframAlpha example

   This contract sends a temperature measure request to WolframAlpha

pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract WolframAlpha is usingOraclize {

  string public temperature;

  event newOraclizeQuery(string description);
  event newTemperatureMeasure(string temperature);

  function WolframAlpha() {

  function __callback(bytes32 myid, string result) {
      if (msg.sender != oraclize_cbAddress()) throw;
      temperature = result;
      // do something with the temperature measure..

  function update() payable {
      newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
      oraclize_query("WolframAlpha", "temperature in London");


2 Answers 2


When using Oraclize you either:

  • Deploy / run the contract by deploying it to the mainnet or a testnet

  • Or you test it on the Javascript VM but not on Remix. You have to use Oraclize's own IDE: https://dev.oraclize.it/

  • Thanks it worked when I ran the code on dev.oraclize.it. Any idea why it causes issue on Remix?
    – tanmay
    Jan 4, 2018 at 16:57
  • 1
    Remix JS VM is not prepared to run the Oraclize API. You can still use Remix if you use a web3 provider or injected web (Metamask) on a testnet or mainnet. Jan 4, 2018 at 17:39

In addition to the previous answer, which would lead you to a different issue, the original issue is that you have not marked the constructor function as payable although you send along some value during deployment.

function WolframAlpha() payable {
  • If this is the case, then the error is even in oraclize own example: WolframAlpha.sol Jan 4, 2018 at 15:46
  • Even after making above mentioned change the error didn't go away in Remix. But the original code runs smoothly in Oraclize's own IDE. Can you elaborate what issues will come up if I follow answer given by Pablo above?
    – tanmay
    Jan 4, 2018 at 17:01
  • The Orclize contract and Oraclize's functionality are only available on the mainnet, testnets and their own Remix IDE. Trying to use it in TestRPC and the JavaScript EVM of the regular Remix IDE will of course result in Errors.
    – n1cK
    Jan 9, 2018 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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