When i am going to deploy this code its give error:The contract code couldn't be stored, please check your gas amount.

Solidity CODE:

pragma solidity ^0.4.0;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract OraclizeFetch is usingOraclize{

string public ETHXBT;

event newOraclizeQuery(string description);
event price(string price);

function OraclizeFetch() payable{
    oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);

function __callback(bytes32 myid, string result, bytes proof) {
    if (msg.sender != oraclize_cbAddress()) throw;
    ETHXBT = result;

function update() payable {
    if (oraclize.getPrice("URL") > this.balance) {
        newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
    } else {
        newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
        oraclize_query(60, "URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c.0");


My genesis.json file:

{ "nonce": "0xdeadbeefdeadbeef", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x400", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": {



  • Hi, Thomas from Oraclize here, on what network are you trying to run this on? Is it a private testnet or what else? – Thomas Bertani Feb 20 '17 at 17:29
  • Hi Thomas,We are using private network. – Anurag Feb 21 '17 at 4:54
  • if you want to use Oraclize within a private chain context, you need to set up and execute the Oraclize ethereum-bridge there. You will find instructions in that repository. If you need any further assistance, feel free to come to our dedicated gitter support channel. – Thomas Bertani Feb 21 '17 at 11:23

Here's a working example of your code, testable with Oraclize in a browser:


Some issues were that you were trying to call oraclize through oraclize.getPrice before that variable was even initialized and set. To do this you need to either pre-initialize it somehow, one way to pre-initialize is calling oraclize_setProof(proofType_NONE) to get results without proofs, or use the internal getPrice function provided by Oraclize in the API which is oraclize_getPrice.

Secondly, in another iteration of the contract you asked us about, you were setting the gas to include to 50M, yet you weren't doing a price check of that allotted gas amount, and it's a very high and unrealistic gas cost amount especially for this query, which will cost several ether with such a high gas amount.

This contract should work fine on your privatenet, just ensure the OAR is set correctly for it.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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