Back to Home

EarlyLottery

Lottery / Gambling
0x7573aca378b8...de810cad9fb4
FrontierContract #85Source VerifiedEdit this contract
Deployed August 8, 2015 (11 years ago)Block 55,701

Commit-reveal lottery prototype deployed on 8 August 2015, the earlier draft of the EarlyLottery contract by the same developer.

Frontier EraVerified Source

Historical Significance

A commit-reveal lottery written in Solidity and deployed on 8 August 2015 by 0xfd2605a2bf58fdbb90db1da55df61628b47f9e8c, who deployed the larger EarlyLottery contract the following day. Play runs on an 88 block cycle read off block.number. buyTicket(bytes32) accepts a hash commitment in the first 40 blocks of the cycle and credits the sent ether. submitSecret(uint64) reveals the preimage between blocks 48 and 68. payout() picks a winner once block.number modulo 88 passes 68 and at least 68 blocks have elapsed since the previous draw, xors the revealed secrets together for the index into the ticket array, and sends the pot minus 25000 times tx.gasprice. Two flaws are visible in the compiled code. The reveal writes secrets[secrets.length], which is out of bounds and always throws, so no secret could ever be recorded, and payout() clears the ticket array before the loop that was meant to walk it and clear each entrant's commitment and balance. The later EarlyLottery contract rewrites both. Source recovered by exact bytecode match: solc v0.1.1+commit.6ff4cd6 with the optimizer on reproduces all 986 bytes of the creation transaction.

Context

Deployed 8 August 2015, the second day of the Ethereum Frontier network.

Key Facts
Deployment Block
55,701
Deployment Date
Aug 8, 2015, 11:09 PM
Code Size
986.0 B
Gas at Deploy
296,899
Transactions by Year
20157
202623

Description

A commit-reveal lottery written in Solidity and deployed on 8 August 2015 by 0xfd2605a2bf58fdbb90db1da55df61628b47f9e8c, who deployed the larger EarlyLottery contract the following day. Play runs on an 88 block cycle read off block.number. buyTicket(bytes32) accepts a hash commitment in the first 40 blocks of the cycle and credits the sent ether. submitSecret(uint64) reveals the preimage between blocks 48 and 68. payout() picks a winner once block.number modulo 88 passes 68 and at least 68 blocks have elapsed since the previous draw, xors the revealed secrets together for the index into the ticket array, and sends the pot minus 25000 times tx.gasprice. Two flaws are visible in the compiled code. The reveal writes secrets[secrets.length], which is out of bounds and always throws, so no secret could ever be recorded, and payout() clears the ticket array before the loop that was meant to walk it and clear each entrant's commitment and balance. The later EarlyLottery contract rewrites both. Source recovered by exact bytecode match: solc v0.1.1+commit.6ff4cd6 with the optimizer on reproduces all 986 bytes of the creation transaction.

Source Verified

SolidityNear-exact bytecode match
Compiler: v0.1.5+

963 bytes. Source reconstructed: commit-reveal lottery by same developer as EarlyLottery (0x7af6af3d). 5 functions: submitSecret(bytes32), random(), payout(), payoutReady(), buyTicket(bytes32). Correct size match and all selectors confirmed with v0.1.5 optimizer ON. 935 diffs in optimizer layout -- exact compiler snapshot not found. 0.300 ETH remains locked since Aug 8 2015.

Historian Categories

Lottery / Gambling
Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Lottery / Gambling

Bytecode Overview

Opcodes986
Unique Opcodes125
Jump Instructions59
Storage Operations32

External Links

Related contracts