1

On a locally hosted instance of Ethererum I am trying to replay and understand the Bad Parity hack. I have a Wallet and a Wallet Library Contract.

Wallet.sol

constructor(address lib) public payable {
    walletLibrary = lib; 
    walletLibrary.delegatecall(bytes4(keccak256("initWallet(address)")), msg.sender);
}


function () public payable {
    emit LogValue(301,msg.value);
    walletLibrary.delegatecall(msg.data);
}

I want to fetch all the coins by resetting the owner with the fallback Method.

WalletLibrary

function initWallet(address _owner) public payable {
   owner = _owner;
}

My idea is to call the fallback method with Remix with the following parameters:

bytes4(keccak256("initWallet(address)")), msg.sender);

I manually computed bytes4 and keccak with the web3 console, is this approach correct?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.