The first time when i run this it runs fine but the second time when i call the coinFlip() function it shows gas estimation failed can someone tell me why it is happening.

pragma solidity ^0.6.0;

import 'https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol';

contract CoinFlipOracle is usingProvable {

string public result;
bytes32 public oraclizeId;

function coinFlip() public payable returns(string memory) {
    oraclizeId = provable_query('WolframAlpha', 'flip a coin');
    return result;

function __callback(bytes32 _oraclizeId, string memory _result) public override(usingProvable) {
    // this function should be only call from oracalize service
    require(msg.sender == provable_cbAddress());
    result = _result;


error message


You need provide some ether along with the gas fees. Only the first call in provable oracle is free.

edit: provide atleast 0.1 usd worth Ether. (Approx 0.0005)

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.