I am developing smart contract that involves random number usage. I decided to use oraclize.it to get it according to this example. Documentation says that Oraclize smart contract available in Ropsten net and I running local Parity node with test accounts in Ropsten.
But it totally stuck on get it running - Parity says "contract will raise error" on deployed on and only way to run it without exception is to remove all lines referenced oraclize code.
Here is my simplest contract:
pragma solidity ^0.4.0;
import "./oraclizeAPI_0.4.sol";
contract GetRandom is usingOraclize {
event newRandomNumber(bytes);
function GetRandom() {
oraclize_setProof(proofType_Ledger);
update();
}
function __callback(bytes32 _queryId, string _result, bytes _proof) oraclize_randomDS_proofVerify(_queryId, _result, _proof) {
// if we reach this point successfully, it means that the attached authenticity proof has passed!
if (msg.sender != oraclize_cbAddress()) throw;
newRandomNumber(bytes(_result));
}
function update() payable {
uint N = 7; // number of random bytes we want the datasource to return
uint delay = 0; // number of seconds to wait before the execution takes place
uint callbackGas = 200000; // amount of gas we want Oraclize to set for the callback function
// this function internally generates the correct oraclize_query and returns its queryId
bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
}
}
Because Parity cannot "import" files I just replaced "import" statement with content of latest Oraclize API (0.4) file.
And it simply does not works.
I would like to run this code in Remix but it unable to connect to my local node. More exact it looks like it connected but contract cannot be deployed - i always got error related to incorrect JSON-RPC response (usually it means that connection to node unsuccessful).