1

I was following this, I assume, very simple tutorial for generating a random number using oraclize: https://www.youtube.com/watch?v=J05DBPdkeAo

But I end up getting this error and I dont understant why. (all the 3 error are the same)

enter image description here

Here is the code so if you want to try it yourself on remix.

pragma solidity ^0.4.25;

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

contract RandomNumberURL is usingOraclize {
    uint public randomNumber;

    constructor () payable {
        oraclize_setProof(proofType_Android | proofShield_Ledger);

    }

    function __callback(bytes32 queryID, string result, bytes proof) {
        require(msg.sender = oraclize_cbAddress());

        if(oraclize_proofShield_proof_proofVerify__returnCode(queryID, result, proof) == 0) {
            randomNumber = parseInt(result);
        }else{
            //Proof verification failed ... handle
        }
    }

    function getRandomNumber() payable public {

        string memory query = 
        "https://www.random.org/integers/?num=1&min=1&max=6&col=1&base=10&format=plain&rnd=new";
        bytes32 queryID = oraclize_query("URL", query);
        oraclize_proofShield_commitment[queryID] = keccak256(sha256(query), proofType_Android);

    }
} 

I appreciate any suggestions! Thanks in advance!

0

I think the API has changed since that video was made, so it no longer includes the ProofShield stuff by default. (There's a warning here that sayss it's only experimental anyway: https://github.com/oraclize/ethereum-examples/blob/master/solidity/proofshield/README.md)

This example in their GitHub repo generates a random number, and works with post-0.5.0 versions of Solidity. (Which is better than messing about with code for 0.4.25.)

  • Yup, that helped! Thank you .. and i'm sorry for my distraction. Didn't realize this was outdated. – João Quintanilha Mar 25 at 11:40
  • No problem - glad it helped :-) – Richard Horrocks Mar 25 at 11:42

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.