ETH Price: $2,457.18 (-1.23%)

Contract

0xd4342DF2C7CfE5938540648582c8D222F1513C50
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Kill50510732018-02-08 4:53:302460 days ago1518065610IN
0xd4342DF2...2F1513C50
0 ETH0.000067495
Participate50504542018-02-08 2:21:342460 days ago1518056494IN
0xd4342DF2...2F1513C50
0.1 ETH0.0004775621
Participate50503902018-02-08 2:03:262460 days ago1518055406IN
0xd4342DF2...2F1513C50
0.1 ETH0.0004775621
Participate50490912018-02-07 20:44:502460 days ago1518036290IN
0xd4342DF2...2F1513C50
0.1 ETH0.0009323841
Force Reseed50479102018-02-07 16:01:292460 days ago1518019289IN
0xd4342DF2...2F1513C50
0 ETH0.0011403321.47483648
Transfer50478832018-02-07 15:55:442460 days ago1518018944IN
0xd4342DF2...2F1513C50
0.9 ETH0.000084164
Force Reseed50478752018-02-07 15:53:042460 days ago1518018784IN
0xd4342DF2...2F1513C50
0 ETH0.0011403321.47483648
Force Reseed50478662018-02-07 15:50:122460 days ago1518018612IN
0xd4342DF2...2F1513C50
0 ETH0.0011682222
Participate50478582018-02-07 15:48:092460 days ago1518018489IN
0xd4342DF2...2F1513C50
0.1 ETH0.0011219322
Participate50478512018-02-07 15:46:042460 days ago1518018364IN
0xd4342DF2...2F1513C50
0.1 ETH0.0004775621
0x6060604050478162018-02-07 15:36:292460 days ago1518017789IN
 Create: AddressLottery
0 ETH0.000363721

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
50510732018-02-08 4:53:302460 days ago1518065610
0xd4342DF2...2F1513C50
1.2 ETH
50478582018-02-07 15:48:092460 days ago1518018489
0xd4342DF2...2F1513C50
0.2 ETH
Loading...
Loading
Contract Self Destruct called at Txn Hash 0x5ec4cec8799c8f42f7d9a54c0596041ffb2434ea0ee30041d079cd5f019b8988


Contract Source Code Verified (Exact Match)

Contract Name:
AddressLottery

Compiler Version
v0.4.19+commit.c4cbbb05

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.4.0;
/*
 * This is a distributed lottery that chooses random addresses as lucky addresses. If these
 * participate, they get the jackpot: the whole balance of the contract, including the ticket
 * price. 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! Contract addresses cannot play for obvious reasons.
 *
 * Ticket price: 0.1 ETH
 * Jackpot chance:   1 in 8
 * 
 * To participate, send 0.10 ETH to the contract with data "d11711a2"
*/
contract AddressLottery{
    struct SeedComponents{
        uint component1;
        uint component2;
        uint component3;
        uint component4;
    }
    
    address owner;
    uint private secretSeed;
    uint private lastReseed;
    
    uint winnerLuckyNumber = 7;
        
    mapping (address => bool) participated;


    function AddressLottery() {
        owner = msg.sender;
        reseed(SeedComponents(12345678, 0x12345678, 0xabbaeddaacdc, 0x22222222));
    }
    
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
  
    modifier onlyHuman() {
        require(msg.sender == tx.origin);
        _;
    }
    
    function participate() payable onlyHuman { 
        require(msg.value == 0.1 ether);
        
        // every address can only win once, obviously
        require(!participated[msg.sender]);
        
        if ( luckyNumberOfAddress(msg.sender) == winnerLuckyNumber)
        {
            participated[msg.sender] = true;
            require(msg.sender.call.value(this.balance)());
        }
    }
    
    function luckyNumberOfAddress(address addr) constant returns(uint n){
        // 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
        ));
        lastReseed = block.number;
    }
    
    function kill() onlyOwner {
        suicide(owner);
    }
    
    function forceReseed() onlyOwner{
        SeedComponents s;
        s.component1 = uint(msg.sender);
        s.component2 = uint256(block.blockhash(block.number - 1));
        s.component3 = block.number * 1337;
        s.component4 = tx.gasprice * 7;
        reseed(s);
    }
    
    function () payable {}
    
    // DEBUG, DELETE BEFORE DEPLOYMENT!!
    function _myLuckyNumber() constant returns(uint n){
        n = luckyNumberOfAddress(msg.sender);
    }
}

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":true,"inputs":[],"name":"_myLuckyNumber","outputs":[{"name":"n","type":"uint256"}],"payable":false,"stateMutability":"view","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"}]

60606040526007600355341561001457600080fd5b60008054600160a060020a03191633600160a060020a03161790556100766080604051908101604090815262bc614e82526312345678602083015265abbaeddaacdc90820152632222222260608201526401000000006102d661007b82021704565b6100c1565b8051816020015182604001518360600151604051808581526020018481526020018381526020018281526020019450505050506040519081900390206001555043600255565b610348806100d06000396000f30060606040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166337354a68811461006e57806341c0e1b51461009f57806345e29057146100b257806380ca7aec146100c5578063d11711a2146100d8575b005b341561007957600080fd5b61008d600160a060020a03600435166100e0565b60405190815260200160405180910390f35b34156100aa57600080fd5b61006c610161565b34156100bd57600080fd5b61008d61018a565b34156100d057600080fd5b61006c61019a565b61006c61021b565b6000600882600160a060020a031660015460405191825260208201526040908101905190819003902060001a7f0100000000000000000000000000000000000000000000000000000000000000027f0100000000000000000000000000000000000000000000000000000000000000900481151561015a57fe5b0692915050565b60005433600160a060020a0390811691161461017c57600080fd5b600054600160a060020a0316ff5b6000610195336100e0565b905090565b6000805433600160a060020a039081169116146101b657600080fd5b33600160a060020a031681554360001981014060018301556105390260028201553a60070260038201556102188160806040519081016040908152825482526001830154602083015260028301549082015260039091015460608201526102d6565b50565b32600160a060020a031633600160a060020a031614151561023b57600080fd5b67016345785d8a0000341461024f57600080fd5b600160a060020a03331660009081526004602052604090205460ff161561027557600080fd5b600354610281336100e0565b14156102d457600160a060020a0333811660008181526004602052604090819020805460ff191660011790559091301631905160006040518083038185876187965a03f19250505015156102d457600080fd5b565b80518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405190819003902060015550436002555600a165627a7a72305820cc99ecc27ddf9ab6f3de49cdab76d7854405f2feacfa778e65b61cba854232f80029

Deployed Bytecode

0x60606040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166337354a68811461006e57806341c0e1b51461009f57806345e29057146100b257806380ca7aec146100c5578063d11711a2146100d8575b005b341561007957600080fd5b61008d600160a060020a03600435166100e0565b60405190815260200160405180910390f35b34156100aa57600080fd5b61006c610161565b34156100bd57600080fd5b61008d61018a565b34156100d057600080fd5b61006c61019a565b61006c61021b565b6000600882600160a060020a031660015460405191825260208201526040908101905190819003902060001a7f0100000000000000000000000000000000000000000000000000000000000000027f0100000000000000000000000000000000000000000000000000000000000000900481151561015a57fe5b0692915050565b60005433600160a060020a0390811691161461017c57600080fd5b600054600160a060020a0316ff5b6000610195336100e0565b905090565b6000805433600160a060020a039081169116146101b657600080fd5b33600160a060020a031681554360001981014060018301556105390260028201553a60070260038201556102188160806040519081016040908152825482526001830154602083015260028301549082015260039091015460608201526102d6565b50565b32600160a060020a031633600160a060020a031614151561023b57600080fd5b67016345785d8a0000341461024f57600080fd5b600160a060020a03331660009081526004602052604090205460ff161561027557600080fd5b600354610281336100e0565b14156102d457600160a060020a0333811660008181526004602052604090819020805460ff191660011790559091301631905160006040518083038185876187965a03f19250505015156102d457600080fd5b565b80518160200151826040015183606001516040518085815260200184815260200183815260200182815260200194505050505060405190819003902060015550436002555600a165627a7a72305820cc99ecc27ddf9ab6f3de49cdab76d7854405f2feacfa778e65b61cba854232f80029

Swarm Source

bzzr://cc99ecc27ddf9ab6f3de49cdab76d7854405f2feacfa778e65b61cba854232f8

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.