ETH Price: $3,410.60 (+0.04%)
Gas: 51 Gwei

Contract

0xd1915A2bCC4B77794d64c4e483E43444193373Fa
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Last Txn Sent

No transactions sent

First Txn Sent

No transactions sent

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Kill50821272018-02-13 9:37:492210 days ago1518514669IN
0xd1915A2b...4193373Fa
0 ETH0.000080096
Transfer50766612018-02-12 11:27:222211 days ago1518434842IN
0xd1915A2b...4193373Fa
0.00000777 ETH0.00002531.2
Transfer50766542018-02-12 11:23:572211 days ago1518434637IN
0xd1915A2b...4193373Fa
1.235 ETH0.000042692
Force Reseed50766422018-02-12 11:21:502211 days ago1518434510IN
0xd1915A2b...4193373Fa
0 ETH0.000106132
Transfer50766292018-02-12 11:19:232211 days ago1518434363IN
0xd1915A2b...4193373Fa
0.65 ETH0.000102012
Transfer50766212018-02-12 11:17:072211 days ago1518434227IN
0xd1915A2b...4193373Fa
1 ETH0.000074723.5
0x6060604050765932018-02-12 11:11:502211 days ago1518433910IN
 Create: OpenAddressLottery
0 ETH0.000651211.231

Latest 2 internal transactions

Advanced mode:
Parent Txn Hash Block From To Value
50821272018-02-13 9:37:492210 days ago1518514669
0xd1915A2b...4193373Fa
1.65000777 ETH
50766292018-02-12 11:19:232211 days ago1518434363
0xd1915A2b...4193373Fa
1.235 ETH
Loading...
Loading
Contract Self Destruct called at Txn Hash 0x12224d16cf312c863d7daf4fdf46b707d02f9078c92626982cd44a5460db61dc


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-12
*/

pragma solidity ^0.4.19;
/*
 * This is a distributed lottery that chooses random addresses as lucky addresses. If these
 * participate, they get the jackpot: 1.9 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:   50%
 * Ticket price: Anything larger than (or equal to) 0.1 ETH
 * Jackpot size: 1.9 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.
 *
 * Example: For each address, a random number is generated, either 0 or 1. This number is then compared
 * with the LuckyNumber - a constant 1. If they are equal, the contract will instantly send you the jackpot:
 * your bet multiplied by 1.9 (House edge of 0.1)
*/

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 = 1; //if the number of an address equals 1, 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 1
            winner[msg.sender] = true; // every address can only win once
            
            uint win=(msg.value/10)*19; //win = 1.9 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 - 50% chance
        n = uint(keccak256(uint(addr), secretSeed)[0]) % 2; //mod 2 returns either 0 or 1
    }
    
    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"}]

60606040526001600355341561001457600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506100a76080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff168152602001448152602001458152602001428152506100ac64010000000002610525176401000000009004565b6100fe565b8060000151816020015182604001518360600151604051808581526020018481526020018381526020018281526020019450505050506040518091039020600190046001819055504360028190555050565b6105a38061010d6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806337354a68146100d757806341c0e1b51461012457806380ca7aec14610139578063d11711a21461014e575b67016345785d8a000034101580156100c757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156100d5576100d4610158565b5b005b34156100e257600080fd5b61010e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610318565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101376103b7565b005b341561014457600080fd5b61014c61042b565b005b610156610158565b005b600067016345785d8a000034101561016f57610315565b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156101ce57600080fd5b6003546101da33610318565b14156102c5576001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506013600a3481151561024657fe5b040290503073ffffffffffffffffffffffffffffffffffffffff1631811115610284573073ffffffffffffffffffffffffffffffffffffffff163190505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102c457600080fd5b5b6103e860025443031115610314576103136080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff16815260200144815260200145815260200142815250610525565b5b5b50565b600060028273ffffffffffffffffffffffffffffffffffffffff1660015460405180838152602001828152602001925050506040518091039020600060208110151561036057fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090048115156103af57fe5b069050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561041257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561048857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16816000018190555060014303406001900481600101819055504173ffffffffffffffffffffffffffffffffffffffff164402816002018190555060073a0281600301819055506105228160806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050610525565b50565b80600001518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405180910390206001900460018190555043600281905550505600a165627a7a7230582040e758fb3cc96b11f9438489e5c00b768af2cf1f398e8255c50f0d4703f3d6f70029

Deployed Bytecode

0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806337354a68146100d757806341c0e1b51461012457806380ca7aec14610139578063d11711a21461014e575b67016345785d8a000034101580156100c757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156100d5576100d4610158565b5b005b34156100e257600080fd5b61010e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610318565b6040518082815260200191505060405180910390f35b341561012f57600080fd5b6101376103b7565b005b341561014457600080fd5b61014c61042b565b005b610156610158565b005b600067016345785d8a000034101561016f57610315565b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156101ce57600080fd5b6003546101da33610318565b14156102c5576001600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506013600a3481151561024657fe5b040290503073ffffffffffffffffffffffffffffffffffffffff1631811115610284573073ffffffffffffffffffffffffffffffffffffffff163190505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102c457600080fd5b5b6103e860025443031115610314576103136080604051908101604052804173ffffffffffffffffffffffffffffffffffffffff16815260200144815260200145815260200142815250610525565b5b5b50565b600060028273ffffffffffffffffffffffffffffffffffffffff1660015460405180838152602001828152602001925050506040518091039020600060208110151561036057fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090048115156103af57fe5b069050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561041257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561048857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16816000018190555060014303406001900481600101819055504173ffffffffffffffffffffffffffffffffffffffff164402816002018190555060073a0281600301819055506105228160806040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050610525565b50565b80600001518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405180910390206001900460018190555043600281905550505600a165627a7a7230582040e758fb3cc96b11f9438489e5c00b768af2cf1f398e8255c50f0d4703f3d6f70029

Swarm Source

bzzr://40e758fb3cc96b11f9438489e5c00b768af2cf1f398e8255c50f0d4703f3d6f7

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

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.