Contract 0xb3ecef15f61572129089a9704b33d53f56991df8

Contract Overview

Balance:
0 Ether
Txn Hash
Block
From
To
Value
0xc90e2507a2e4b2befb5ba5461e45a57bde4cd7dc7e2819633ba06fe5a91f653f50209852019-02-15 3:34:43743 days 3 hrs ago0x4d08747c579e4ebc42f115102e6b0d9e3460f7ec IN  0xb3ecef15f61572129089a9704b33d53f56991df80 Ether0.001242345
0x87c026f635e1a66c22306e183dcef0cea4de9821e8653f2361ba833186e53c8350209772019-02-15 3:31:05743 days 3 hrs ago0x4d08747c579e4ebc42f115102e6b0d9e3460f7ec IN  0xb3ecef15f61572129089a9704b33d53f56991df80 Ether0.0039080968
0x2d9b0139797335c917fc3df7629f0e650c0a8aa894acb53707543a11ab40bbeb50209752019-02-15 3:29:56743 days 3 hrs ago0x4d08747c579e4ebc42f115102e6b0d9e3460f7ec IN  Contract Creation0 Ether0.0053108568
[ Download CSV Export 
Latest 4 internal transactions
Parent Txn Hash Block From To Value
0xc90e2507a2e4b2befb5ba5461e45a57bde4cd7dc7e2819633ba06fe5a91f653f50209852019-02-15 3:34:43743 days 3 hrs ago 0x7973d5166b9526b9e4e63595293d6b895d2d4fe3 0xb3ecef15f61572129089a9704b33d53f56991df80 Ether
0xc90e2507a2e4b2befb5ba5461e45a57bde4cd7dc7e2819633ba06fe5a91f653f50209852019-02-15 3:34:43743 days 3 hrs ago 0xb3ecef15f61572129089a9704b33d53f56991df8  Contract Creation0 Ether
0x87c026f635e1a66c22306e183dcef0cea4de9821e8653f2361ba833186e53c8350209772019-02-15 3:31:05743 days 3 hrs ago 0x7973d5166b9526b9e4e63595293d6b895d2d4fe3 0xb3ecef15f61572129089a9704b33d53f56991df80 Ether
0x87c026f635e1a66c22306e183dcef0cea4de9821e8653f2361ba833186e53c8350209772019-02-15 3:31:05743 days 3 hrs ago 0xb3ecef15f61572129089a9704b33d53f56991df8  Contract Creation0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CREATE2Rewriter

Compiler Version
v0.5.1+commit.c8a2cb62

Optimization Enabled:
Yes with 200 runs

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

// Jochem Brouwer <[email protected]>
// Proof of concept: deploy a contract at the same address but with different bytecode 
// Target address: 0x7973d5166b9526b9e4e63595293d6b895d2d4fe3
// Note: it is possible to replay this but if someone calls deployContract and deploys a contract without 
// the possibility to selfdestruct then deployTEST1 and deployTEST2 will not work anymore (as in, they will not deploy their target code);
// of course it is still possible to replay it using a different seed than 0x1337 

contract CREATE2DumpExternalBytecode {
    
    constructor() public {
        // read external bytecode 
        
        CREATE2Rewriter sender = CREATE2Rewriter(msg.sender);
        
        bytes memory deployMe = sender.deployBytecode();
        
        uint bytecodeLength = deployMe.length;
    
        assembly {
            // this RETURN opcode reads two memory pointers from stack: the memory start position and the length 
            // this normally puts the bytecode in the RETURNVALUE field of a CALL but instead on here this is the 
            // actual code which gets deployed =)
            return (add(deployMe, 0x20), bytecodeLength)
        }
    }
}

contract HelloWorld1 {
    string public Hello = "Hello world!";
    
    function destroy() external { 
        selfdestruct(msg.sender);
    }
}

contract HelloWorld2 {
    string public Hello = "HACKED";

    function destroy() external {
        selfdestruct(msg.sender);
    }
}

contract CREATE2Rewriter {
    // CREATE2DumpExternalBytecode constructor code 
    bytes constant constructorCode = hex'6080604052348015600f57600080fd5b506000339050606081600160a060020a03166331d191666040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b158015606b57600080fd5b505afa158015607e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101560a657600080fd5b81019080805164010000000081111560bd57600080fd5b8201602081018481111560cf57600080fd5b815164010000000081118282018710171560e857600080fd5b5050805190945092508291505060208301f3fe';
    bytes public deployBytecode;
    
    // HelloWorld1 / 2 bytecode which we want to deploy
    bytes constant HelloWorld1_bytecode = hex'608060405260043610610045577c0100000000000000000000000000000000000000000000000000000000600035046383197ef0811461004a578063bcdfe0d514610061575b600080fd5b34801561005657600080fd5b5061005f6100eb565b005b34801561006d57600080fd5b506100766100ee565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b0578181015183820152602001610098565b50505050905090810190601f1680156100dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33ff5b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101745780601f1061014957610100808354040283529160200191610174565b820191906000526020600020905b81548152906001019060200180831161015757829003601f168201915b50505050508156fea165627a7a72305820d655aa9f37fe27daa8e218b7712a2e641f2c18b5c8a9911e69cfc1c8336640390029';
    bytes constant HelloWorld2_bytecode = hex'608060405260043610610045577c0100000000000000000000000000000000000000000000000000000000600035046383197ef0811461004a578063bcdfe0d514610061575b600080fd5b34801561005657600080fd5b5061005f6100eb565b005b34801561006d57600080fd5b506100766100ee565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b0578181015183820152602001610098565b50505050905090810190601f1680156100dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33ff5b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101745780601f1061014957610100808354040283529160200191610174565b820191906000526020600020905b81548152906001019060200180831161015757829003601f168201915b50505050508156fea165627a7a72305820f54e3277e157b3ba1564c90516d898a6ac23e90c395e701e5f17b0d93069b8f90029';
    
    
    // check address 0x7973d5166b9526b9e4e63595293d6b895d2d4fe3 on etherscan 
    // also check extcodeHashes on 0x7973d5166b9526b9e4e63595293d6b895d2d4fe3 index 0 and 1 - they are different 
    // (and they are not empty account hashes =) )
    mapping(address => bytes32[]) public extcodeHashes;
    
    function deployContract(bytes memory deployThis, bytes32 seed) public payable returns (address) {

        address ret; 
        deployBytecode = deployThis;
        
        bytes memory constructorCode_mem = constructorCode;
        
        assembly {
            ret := create2(callvalue, add(0x20, constructorCode_mem), mload(constructorCode_mem), seed)
        }
        bytes32 hash;
        assembly {
               hash := extcodehash(ret)
        }
        
        extcodeHashes[ret].push(hash);
        
        return ret;
    }
    
    function deployTEST1() external returns (address) {
        deployContract(HelloWorld1_bytecode, bytes32(bytes2(0x1337)));
    }
    
    function deployTEST2() external returns (address) {
        deployContract(HelloWorld2_bytecode, bytes32(bytes2(0x1337)));
    }
    
    
}

Contract ABI

[{"constant":false,"inputs":[{"name":"deployThis","type":"bytes"},{"name":"seed","type":"bytes32"}],"name":"deployContract","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"deployBytecode","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deployTEST2","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"extcodeHashes","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deployTEST1","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610924806100206000396000f3fe608060405260043610610066577c010000000000000000000000000000000000000000000000000000000060003504632bd7910b811461006b57806331d191661461013c578063d779c080146101c6578063ea560ce4146101db578063fbc375b714610233575b600080fd5b6101136004803603604081101561008157600080fd5b81019060208101813564010000000081111561009c57600080fd5b8201836020820111156100ae57600080fd5b803590602001918460018302840111640100000000831117156100d057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610248915050565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561014857600080fd5b506101516102c9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018b578181015183820152602001610173565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d257600080fd5b50610113610357565b3480156101e757600080fd5b50610221600480360360408110156101fe57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356103a3565b60408051918252519081900360200190f35b34801561023f57600080fd5b506101136103d3565b8151600090819061025f908290602087019061041b565b5060606101206040519081016040528060fc81526020016107fd60fc913990508381518260200134f573ffffffffffffffffffffffffffffffffffffffff811660009081526001602081815260408320805492830181558352909120823f91015595945050505050565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b505050505081565b600061039f6101e0604051908101604052806101a881526020016106556101a891397f1337000000000000000000000000000000000000000000000000000000000000610248565b5090565b6001602052816000526040600020818154811015156103be57fe5b90600052602060002001600091509150505481565b600061039f6101e0604051908101604052806101a881526020016104ad6101a891397f1337000000000000000000000000000000000000000000000000000000000000610248565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061045c57805160ff1916838001178555610489565b82800160010185558215610489579182015b8281111561048957825182559160200191906001019061046e565b5061039f926104a99250905b8082111561039f5760008155600101610495565b9056fe608060405260043610610045577c0100000000000000000000000000000000000000000000000000000000600035046383197ef0811461004a578063bcdfe0d514610061575b600080fd5b34801561005657600080fd5b5061005f6100eb565b005b34801561006d57600080fd5b506100766100ee565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b0578181015183820152602001610098565b50505050905090810190601f1680156100dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33ff5b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101745780601f1061014957610100808354040283529160200191610174565b820191906000526020600020905b81548152906001019060200180831161015757829003601f168201915b50505050508156fea165627a7a72305820d655aa9f37fe27daa8e218b7712a2e641f2c18b5c8a9911e69cfc1c8336640390029608060405260043610610045577c0100000000000000000000000000000000000000000000000000000000600035046383197ef0811461004a578063bcdfe0d514610061575b600080fd5b34801561005657600080fd5b5061005f6100eb565b005b34801561006d57600080fd5b506100766100ee565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b0578181015183820152602001610098565b50505050905090810190601f1680156100dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b33ff5b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101745780601f1061014957610100808354040283529160200191610174565b820191906000526020600020905b81548152906001019060200180831161015757829003601f168201915b50505050508156fea165627a7a72305820f54e3277e157b3ba1564c90516d898a6ac23e90c395e701e5f17b0d93069b8f900296080604052348015600f57600080fd5b506000339050606081600160a060020a03166331d191666040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b158015606b57600080fd5b505afa158015607e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101560a657600080fd5b81019080805164010000000081111560bd57600080fd5b8201602081018481111560cf57600080fd5b815164010000000081118282018710171560e857600080fd5b5050805190945092508291505060208301f3fea165627a7a723058207347731a98d3f10c9a02316ea86a560a81fe0d6ace97ffe8762437c9a3d6ffcc0029

Swarm Source

bzzr://7347731a98d3f10c9a02316ea86a560a81fe0d6ace97ffe8762437c9a3d6ffcc
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading