I'm getting the following error when I'm trying to test (truffle test) my contract which uses Oraclize API 0.5 to get the ledger random from oraclize (datasource = "random"). I'm using solidity 0.5.0 compiler, and this is the error trace:

Returned error: VM Exception while processing transaction: revert
    at C:\Users\<UserName>\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-deployer\src\deployment.js:364:1
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
Truffle v5.0.2 (core: 5.0.2)
Node v11.6.0

I've tried to run another contract example (RandomExample) but it throws the same error, which means the error is not in contract but probably in the way it queries ethereum-bridge and Ganache (v1.2.3). I used the following code to initialize ethereum-bridge:

.\ethereum-bridge.cmd -H localhost:7545 --loglevel:debug --dev -a 9

any ideas what could be the possible error? the error is throwing when the following code is called inside the contract:

queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);

1 Answer 1


Since the random datasource is currently available ONLY on the Ethereum mainnet and on all Ethereum public testnets (Rinkeby, Kovan, Ropsten-revival); and it is not integrated yet with private blockchains/testrpc/browser-solidity-vmmode, you will need to get a mnemonic passphrase and an infura key to make the example work.

If you look at the branch new-truffle-random-example of the Oraclize GitHub Repo ethereum-example, this RandomExample maybe a good alternative for you: https://github.com/oraclize/ethereum-examples/tree/new-truffle-random-example/solidity/truffle-examples/random-datasource. The readme is complete of all the instructions to make it succeed.


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.