A minimal random number generator that stores a blockhash at deployment. Has a bug: the rand() function always returns 0.
Historical Significance
An early attempt at on-chain randomness from the Frontier era, demonstrating a common pitfall that many early developers encountered: the unavailability of the current block hash within the executing block. This bug pattern was widespread enough to be explicitly documented in later Solidity best practices.
Context
Deployed in February 2016 during the Frontier era, compiled with Solidity v0.1.6. On-chain randomness was a hot topic in early Ethereum development, with developers experimenting with blockhash-based approaches before the limitations were well understood.
Key Facts
Description
A tiny contract (126 bytes runtime) deployed on Feb 4, 2016 that attempts to generate a random value by storing block.blockhash(blockNumber) at deployment time. The rand() function takes min and max parameters but ignores them entirely, simply returning the stored blockhash.
The contract has a notable bug: block.blockhash(block.number) always returns 0 in the EVM because the current block's hash is not yet available. The developer likely intended block.blockhash(block.number - 1) to get the previous block's hash. As a result, rand() always returns 0.
Uses inline state variable initializers instead of a constructor function, which produces unusually compact init code (36 bytes). The same deployer (0x5de92686587b10cD47E03B71f2E2350606fCAf14) deployed over 100 other experimental contracts during the same period.
Source Verified
Exact bytecode match (init + runtime). 36 bytes init, 126 bytes runtime. Uses inline state variable initializers, no constructor.
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)
contract Random {
uint blockNumber = block.number;
bytes32 randomValue = block.blockhash(blockNumber);
function rand(uint256 min, uint256 max) returns (bytes32) {
return randomValue;
}
}External Links
Related contracts
1
Same deployerStandard ethereum.org tutorial token (Homestead, Mar 2016): name/symbol/decimals metadata, a public balanceOf mapping and an overflow-checked transfer firing th
0x05d0d0...eda304February 3, 2016Test
Same eraThe earliest known Ethereum contract with executable runtime code. A single function go() that returns the string "eth", compiled with the first publicly available Solidity compiler (v0.1.1).
0x651629...8c21faAugust 7, 2015Greeter
Same eraAn early Ethereum contract that returns the string “Hello World!” when called.
0xfea8c4...8b08ebAugust 7, 2015PrimeChecker
Same eraPrimeChecker contract. Identical bytecode to 0x66d796e7 -- smallestfactor(uint256) returns the smallest prime factor, or n if prime. Deployed Aug 7, 2015 by the
0x7b2d5c...164661August 7, 2015testContract
Same eraThe first publicly posted Ethereum contract that returned a value when called, demonstrating interactive smart contract execution.
0xa3483b...018cdcAugust 7, 2015MovieVoting
Same eraA Frontier Day 1 movie voting contract where users send ETH to permanently rank movies on-chain — one of the earliest interactive dApps on Ethereum.
0x8bbf81...69c7f7August 8, 2015