Last active
July 17, 2018 20:21
-
-
Save pasupulaphani/4a54ed7a43877629534ef7a91ed7a3af to your computer and use it in GitHub Desktop.
Trusted proof of data from a datasource using Oraclize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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