Andrew Miller's Sep 2015 Serpent blockhash oracle: stores block-number-to-blockhash mappings beyond the EVM's 256-block BLOCKHASH window.
Key Facts
Description
A Serpent contract by Andrew Miller (github.com/amiller/ethereum-blockhashes) that keeps a permanent mapping from block number to blockhash, working around the 256-block limit of block.blockhash that had broken Etherpot. add_recent(n) stores a hash still visible to the EVM; add_old(header, n) proves an older block by checking that sha3(header) equals the stored hash of its child, then stores the parent hash read from the header. This is the first deployment (2015-09-03), matching the repo's initial commit ac069aa exactly (runtime and creation).
Source Verified
Exact runtime and creation match, ethereum/serpent f67c1a9 (also 6faaebb, a7716d3, fd9b0b6). Source blockhashes_ac069aa.se, unmodified.
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 (Serpent)
event Error(x:str)
# Add one of the most recent 256 blocks
def add_recent(n):
h = block.prevhash(block.number - n)
if h == 0:
log(type=Error, text("block.prevhash failed"))
else:
self.storage[n] = h
# Add a block at any height, as long as we have the child
def add_old(header:str, n):
with h = self.storage[n+1]:
with p = sha3(header:str):
with parent = ~calldataload(72+32): # I don't know how calldataload works
if h - p == 0:
self.storage[n] = parent
else:
log(type=Error, text("sha3 hash does not match"))
# Returns the blockhash, or 0
def get_blockhash(n):
h = block.prevhash(block.number - n)
if h == 0: return self.storage[n]