Back to Home

Contract 0xf6bf0ee51fe0...2e9241ec3b5c

Unknown
0xf6bf0ee51fe0...2e9241ec3b5c
FrontierSource Verified
Deployed August 8, 2015 (10 years ago)Block 54,913

Commit-reveal lottery prototype by the EarlyLottery developer. buyTicket(bytes32) takes a hash commitment. submitSecret reveals the secret. payout() sends to wi...

Key Facts

Deployment Block
54,913
Deployment Date
Aug 8, 2015, 07:30 PM
Code Size
1.1 KB
Gas at Deploy
326,142
Transactions by Year
201524
20181
202664

Source Verified

Soliditysource_identified
Compiler: v0.1.5+

1073 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.824 ETH remains locked since Aug 8 2015.

Heuristic Analysis

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

Detected Type: Unknown

Frontier Era

The initial release of Ethereum. A bare-bones implementation for technical users.

Block span: 01,149,999
July 30, 2015March 14, 2016

Bytecode Overview

Opcodes1,096
Unique Opcodes131
Jump Instructions68
Storage Operations34

Verified Source Available

This contract has verified source code.

View Verification Proof
Show source code (Solidity)
contract Lottery {
    uint startBlock;
    uint numParticipants;
    address[] participants;
    uint64[] secrets;
    mapping (address => bytes32) hashes;
    mapping (address => uint) amounts;

    function Lottery() { startBlock = block.number; }

    function submitSecret(uint64 secret) {
        if (!(block.number % 88 < 0x44 && block.number % 88 >= 0x30)) return;
        if (sha3(bytes8(secret)) != hashes[msg.sender]) return;
        participants.length++;
        participants[participants.length - 1] = msg.sender;
        secrets.length++;
        secrets[secrets.length - 1] = secret;
    }

    function random() returns (uint64 r) {
        for (uint i = 0; i < secrets.length; i++) {
            r ^= secrets[i];
        }
    }

    function payout() {
        if (!payoutReady()) return;
        uint winner = random() % participants.length;
        participants[winner].call.value(this.balance - tx.gasprice * 25000)();
        startBlock = block.number;
        participants.length = 0;
        secrets.length = 0;
        numParticipants = 0;
    }

    function payoutReady() returns (bool) {
        return block.number % 88 > 0x44 && block.number - startBlock > 0x44;
    }

    function buyTicket(bytes32 hash) {
        if (block.number % 88 >= 0x28) return;
        hashes[msg.sender] = hash;
        amounts[msg.sender] += msg.value;
        numParticipants++;
    }
}

External Links