ETH Price: $2,342.35 (+1.65%)

Contract

0x741F1923974464eFd0Aa70e77800BA5d9ed18902
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Kill50715072018-02-11 14:53:172402 days ago1518360797IN
0x741F1923...d9ed18902
0 ETH0.000020021.5
Transfer50647292018-02-10 11:48:422403 days ago1518263322IN
0x741F1923...d9ed18902
0.00000777 ETH0.000021081
Transfer50645162018-02-10 10:58:362403 days ago1518260316IN
0x741F1923...d9ed18902
1.4 ETH0.000023481.1
Force Reseed50644982018-02-10 10:55:012403 days ago1518260101IN
0x741F1923...d9ed18902
0 ETH0.000080131.51
Transfer50644812018-02-10 10:52:192403 days ago1518259939IN
0x741F1923...d9ed18902
0.1 ETH0.000102782
Transfer50644622018-02-10 10:48:092403 days ago1518259689IN
0x741F1923...d9ed18902
0.1 ETH0.000064043
0x6060604050644532018-02-10 10:45:412403 days ago1518259541IN
 Create: OpenAddressLottery
0 ETH0.000683521.3

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
50715072018-02-11 14:53:172402 days ago1518360797
0x741F1923...d9ed18902
1.40000777 ETH
50644812018-02-10 10:52:192403 days ago1518259939
0x741F1923...d9ed18902
0.2 ETH
Loading...
Loading
Contract Self Destruct called at Txn Hash 0xd8f7a7cb8e5377db9db3e96928e487f8814a6acaad650af61a7f8b69e2b346c9


Contract Source Code Verified (Exact Match)

Contract Name:
OpenAddressLottery

Compiler Version
v0.4.19+commit.c4cbbb05

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-02-10
*/

pragma solidity ^0.4.19;
/*
 * This is a distributed lottery that chooses random addresses as lucky addresses. If these
 * participate, they get the jackpot: 7 times the price of their bet.
 * Of course one address can only win once. The owner regularly reseeds the secret
 * seed of the contract (based on which the lucky addresses are chosen), so if you did not win,
 * just wait for a reseed and try again!
 *
 * Jackpot chance:   1 in 8
 * Ticket price: Anything larger than (or equal to) 0.1 ETH
 * Jackpot size: 7 times the ticket price
 *
 * HOW TO PARTICIPATE: Just send any amount greater than (or equal to) 0.1 ETH to the contract's address
 * Keep in mind that your address can only win once
 *
 * If the contract doesn't have enough ETH to pay the jackpot, it sends the whole balance.
*/

contract OpenAddressLottery{
    struct SeedComponents{
        uint component1;
        uint component2;
        uint component3;
        uint component4;
    }
    
    address owner; //address of the owner
    uint private secretSeed; //seed used to calculate number of an address
    uint private lastReseed; //last reseed - used to automatically reseed the contract every 1000 blocks
    uint LuckyNumber = 7; //if the number of an address equals 7, it wins
        
    mapping (address => bool) winner; //keeping track of addresses that have already won
    
    function OpenAddressLottery() {
        owner = msg.sender;
        reseed(SeedComponents((uint)(block.coinbase), block.difficulty, block.gaslimit, block.timestamp)); //generate a quality random seed
    }
    
    function participate() payable {
        if(msg.value<0.1 ether)
            return; //verify ticket price
        
        // make sure he hasn't won already
        require(winner[msg.sender] == false);
        
        if(luckyNumberOfAddress(msg.sender) == LuckyNumber){ //check if it equals 7
            winner[msg.sender] = true; // every address can only win once
            
            uint win=msg.value*7; //win = 7 times the ticket price
            
            if(win>this.balance) //if the balance isnt sufficient...
                win=this.balance; //...send everything we've got
            msg.sender.transfer(win);
        }
        
        if(block.number-lastReseed>1000) //reseed if needed
            reseed(SeedComponents((uint)(block.coinbase), block.difficulty, block.gaslimit, block.timestamp)); //generate a quality random seed
    }
    
    function luckyNumberOfAddress(address addr) constant returns(uint n){
        // calculate the number of current address - 1 in 8 chance
        n = uint(keccak256(uint(addr), secretSeed)[0]) % 8;
    }
    
    function reseed(SeedComponents components) internal {
        secretSeed = uint256(keccak256(
            components.component1,
            components.component2,
            components.component3,
            components.component4
        )); //hash the incoming parameters and use the hash to (re)initialize the seed
        lastReseed = block.number;
    }
    
    function kill() {
        require(msg.sender==owner);
        
        selfdestruct(msg.sender);
    }
    
    function forceReseed() { //reseed initiated by the owner - for testing purposes
        require(msg.sender==owner);
        
        SeedComponents s;
        s.component1 = uint(msg.sender);
        s.component2 = uint256(block.blockhash(block.number - 1));
        s.component3 = block.difficulty*(uint)(block.coinbase);
        s.component4 = tx.gasprice * 7;
        
        reseed(s); //reseed
    }
    
    function () payable { //if someone sends money without any function call, just assume he wanted to participate
        if(msg.value>=0.1 ether && msg.sender!=owner) //owner can't participate, he can only fund the jackpot
            participate();
    }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"luckyNumberOfAddress","outputs":[{"name":"n","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"forceReseed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"participate","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}]

60606040526007600355341561001457600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506100a76080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff168152602001448152602001458152602001428152506100ac64010000000002610519176401000000009004565b6100fe565b8060000151816020015182604001518360600151604051808581526020018481526020018381526020018281526020019450505050506040518091039020600190046001819055504360028190555050565b6105978061010d6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806337354a68146100d757806341c0e1b51461012457806380ca7aec14610139578063d11711a21461014e575b67016345785d8a000034101580156100c757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156100d5576100d4610158565b5b005b34156100e257600080fd5b61010e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061030c565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101376103ab565b005b341561014457600080fd5b61014c61041f565b005b610156610158565b005b600067016345785d8a000034101561016f57610309565b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156101ce57600080fd5b6003546101da3361030c565b14156102b9576001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007340290503073ffffffffffffffffffffffffffffffffffffffff1631811115610278573073ffffffffffffffffffffffffffffffffffffffff163190505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102b857600080fd5b5b6103e860025443031115610308576103076080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff16815260200144815260200145815260200142815250610519565b5b5b50565b600060088273ffffffffffffffffffffffffffffffffffffffff1660015460405180838152602001828152602001925050506040518091039020600060208110151561035457fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090048115156103a357fe5b069050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561040657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561047c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16816000018190555060014303406001900481600101819055504173ffffffffffffffffffffffffffffffffffffffff164402816002018190555060073a0281600301819055506105168160806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050610519565b50565b80600001518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405180910390206001900460018190555043600281905550505600a165627a7a723058206b596e01d5865f77a048963f5552069d7c81e298834762b54349dc70ffffe0d00029

Deployed Bytecode

0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806337354a68146100d757806341c0e1b51461012457806380ca7aec14610139578063d11711a21461014e575b67016345785d8a000034101580156100c757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156100d5576100d4610158565b5b005b34156100e257600080fd5b61010e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061030c565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101376103ab565b005b341561014457600080fd5b61014c61041f565b005b610156610158565b005b600067016345785d8a000034101561016f57610309565b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156101ce57600080fd5b6003546101da3361030c565b14156102b9576001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007340290503073ffffffffffffffffffffffffffffffffffffffff1631811115610278573073ffffffffffffffffffffffffffffffffffffffff163190505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102b857600080fd5b5b6103e860025443031115610308576103076080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff16815260200144815260200145815260200142815250610519565b5b5b50565b600060088273ffffffffffffffffffffffffffffffffffffffff1660015460405180838152602001828152602001925050506040518091039020600060208110151561035457fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090048115156103a357fe5b069050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561040657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561047c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16816000018190555060014303406001900481600101819055504173ffffffffffffffffffffffffffffffffffffffff164402816002018190555060073a0281600301819055506105168160806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050610519565b50565b80600001518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405180910390206001900460018190555043600281905550505600a165627a7a723058206b596e01d5865f77a048963f5552069d7c81e298834762b54349dc70ffffe0d00029

Swarm Source

bzzr://6b596e01d5865f77a048963f5552069d7c81e298834762b54349dc70ffffe0d0

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.