Skip to content

Instantly share code, notes, and snippets.

@pasupulaphani
Last active July 17, 2018 20:21
Show Gist options
  • Save pasupulaphani/4a54ed7a43877629534ef7a91ed7a3af to your computer and use it in GitHub Desktop.
Save pasupulaphani/4a54ed7a43877629534ef7a91ed7a3af to your computer and use it in GitHub Desktop.
Trusted proof of data from a datasource using Oraclize
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract OraclizeAgeOfPresidentProof is usingOraclize {
string public result;
constructor() {
oraclize_setProof(proofType_Android | proofStorage_IPFS);
oraclize_setCustomGasPrice(2 * 1000000000);
}
function update() payable {
oraclize_query("nested", "[WolframeAlpha] Age of ${[WolframeAlpha] Current US president}", 180000);
}
function __callback(bytes32 _queryId, string _r, bytes _p) {
require(msg.sender == oraclize_cbAddress());
result = _r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment