October 2015 Oraclize demo by Thomas Bertani that self-destructs if WolframAlpha stops naming Obama as US president.
Historical Significance
One of the earliest oracle-driven contracts on Ethereum: it uses Oraclize, then weeks old, to bring a WolframAlpha answer on chain and act on it, a self-destruct condition tied to a real-world fact. It shows the first-generation Oraclize API (query(uint256,string,string)) and an on-chain substring search written before Solidity had string utilities.
Context
Deployed in October 2015, about three months after Ethereum launched and a few weeks before Devcon 1 in London, where Thomas Bertani presented Oraclize as a provably honest oracle service. Smart contracts had no native way to read off-chain data, and Oraclize was among the first services to offer it.
Key Facts
Description
Obama Oracle is an early Oraclize demonstration contract deployed on October 22, 2015 (block 422,591) by 0x0047a8033cc6d6ca2ed5044674fd421f44884de8, the key Thomas Bertani used for his September 2015 Oraclize experiments. Two byte-identical copies followed within minutes at 0x593f6c40023183a3b6c0811d2612c31c1aaec4e0 (block 422,602) and 0x29b46a3f3fcc2353f6bef5d5bb6811ce75be3849 (block 422,609).
On deployment the constructor asks the Oraclize contract at 0xd4cb3eb955e03ac64644678fd3d6a7f3104ee70d to query WolframAlpha for "president of the United States". When the answer arrives from the Oraclize callback address 0x26588a9301b0428d95e6fc3a5024fce8bec12d51, the contract searches it for "Obama" with an on-chain indexOf. If the name is missing it self-destructs and sends its balance to the deployer; otherwise it queries WolframAlpha again. The owner can also destroy it with kill().
None of the three copies ever received a callback: each has only its creation transaction, and all three are still on chain, long after Obama left office in January 2017.
Source Verified
Byte-exact runtime and creation. The public uint getter (selector 0x14ff041d) uses the collision name fOjqVd(); the original name is unknown (7+ characters).
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Obama Oracle by Thomas Bertani (Oraclize), 0x66c67a9e26f5f1bf04c0e8797a4ae2f01db5785a
// (byte-identical copies at 0x593f6c40... and 0x29b46a3f...)
// Block 422591, 2015-10-22. soljson v0.1.6, optimizer OFF.
contract OraclizeI {
function query(uint timestamp, string datasource, string arg) returns (uint);
}
contract ObamaOracle {
address constant owner = 0x0047a8033cc6d6ca2ed5044674fd421f44884de8;
address constant cbProxy = 0x26588a9301b0428d95e6fc3a5024fce8bec12d51;
OraclizeI constant oracle = OraclizeI(0xd4cb3eb955e03ac64644678fd3d6a7f3104ee70d);
uint public fOjqVd = 5; // original name unknown: 0x14ff041d, no match for names up to 6 chars; collision name used
function ObamaOracle() {
OraclizeI o = oracle;
o.query(0, "WolframAlpha", "president of the United States");
}
// Canonical 2015 Oraclize stringutils indexOf
function indexOf(string _haystack, string _needle) returns (int) {
bytes memory h = bytes(_haystack);
bytes memory n = bytes(_needle);
if (h.length < 1 || n.length < 1 || (n.length > h.length))
return -1;
else if (h.length > (2**128 - 1))
return -1;
else {
uint subindex = 0;
for (uint i = 0; i < h.length; i++) {
if (h[i] == n[0]) {
subindex = 1;
while (subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) {
subindex++;
}
if (subindex == n.length)
return int(i);
}
}
return -1;
}
}
function callback() {
if (indexOf(string(msg.data), "Obama") == -1) suicide(owner);
OraclizeI o = oracle;
o.query(0, "WolframAlpha", "president of the United States");
}
function() {
if (msg.sender == cbProxy) callback();
}
function kill() {
if (msg.sender == owner) suicide(owner);
}
}External Links
Related contracts
Target
Same deployerTarget contract.
0x9e0ae8...c9428eSeptember 17, 2015GetSet
Same deployerA minimal getter/setter proxy from the Oraclize team. set() forwards calls to a hardcoded target contract, get() returns constant 255.
0x77beac...7e96c2September 17, 2015SimpleStorage
Same deployerThe storage example rewired to send a wei and return a constant
0x7aa73b...46473bSeptember 17, 2015Controller
Same deployerController contract.
0x3c9492...e332e5September 17, 2015GetSet
Same deployerA 57-byte test contract: set() stores the transaction's ether value into storage slot 0, and get() reads it back.
0xe595e8...423530September 17, 2015GetSet
Same deployerA 57-byte test contract: set() stores the transaction's ether value into storage slot 0, and get() reads it back.
0xd17e9b...03b76aSeptember 17, 2015