2

I am using Oraclize for generating random number for my smart contract. I write unit test for testing oraclize things so I use ethereum-bridge written by Oraclize. Here is my problem:

  1. First: my smart contract sends random query to oralize
  2. On ethereum-bridge console, I see the query and see successfully message.
  3. after a short time, I always see a failure message such as

ERROR callback tx error, contract myid: 0x16174d0d5cc86d8104d2a08294b5e00040659442a9cfc364d45e988279594cd8

Same code, but some weeks ago it works. Now, it doesn't. I don't know why and how to fix this.

Edit

Here is my Oraclize code:

constructor() public {
    OAR = OraclizeAddrResolverI(0xDB200f12d0DE77CEAD6Cec77AB328a1548ca4574);
    oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}

function _randomWolframAlpha() internal returns (bytes32) {
    require(
        oraclize_getPrice("WolframAlpha") <= address(this).balance,
        "Oraclize query was NOT sent, please add some ETH to cover for the query fee"
    );

    return oraclize_query("WolframAlpha", "random number between 100000000 and 999999999");
}

Here is test code:

        // Wait for the callback to be invoked by Oraclize and the event to be emitted
        const logNewPriceWatcher = promisifyLogWatch(this.contract.OraclizeCallbackEvent({fromBlock: 'latest'}));

        log = await logNewPriceWatcher;
        assert.equal(log.event, 'OraclizeCallbackEvent', 'OraclizeCallbackEvent not emitted.');

Here is my version:

Thanks

  • Could you provide some code snippets of the contract code and test code, as well as the versions of solidity / truffle / oraclize / ethereum-bridge you're using? – Rosco Kalis Dec 15 '18 at 10:25
  • @RoscoKalis I have updated my question. Please take a look. – hqt Dec 17 '18 at 14:37

Browse other questions tagged or ask your own question.