[Ethereum] Remix error : The constructor should be payable if you send value

remixsolidity

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() {
      update();
  }

  function __callback(bytes32 myid, string result) {
      if (msg.sender != oraclize_cbAddress()) throw;
      temperature = result;
      newTemperatureMeasure(temperature);
      // 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");
  }

} 

Best Answer

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/

Related Topic