codedamn

Re-entrancy Attack

Created by Kshitij about a year ago

0

No description provided

3 Comments

    0

    even if a transaction of 0 ether keeps ongoing, then won't it affect mainnet, or system of the sender and requester, what will happen?

    @ujjwalaaka0945

    Ujjwal Aakash

    @ujjwalaaka0945

    0

    So address.transfer(1) will call fallback function but address.transfer(0) won't call fallback function?

    @nvml33t

    Nitish Maximus

    @nvml33t

    0

    Ok I get it, making balance[address] = 0 first, the second time when the fallback function in hacker's smart contract is called, we are going to transfer 0 ETH.

    But, our smart contract is still executing the transfer function isn't it? Although its not transferring anything.

    The issue here is that everytime our contract is executing the transfer() function we are spending gas in form of ETH from our contract balance and if this continue, then eventually we might empty of our contract balance.

    One possible solution to this that I think is that using a require statement to check if balance[address] != zero and then only get to the transfer part.

    Is it right Sir? Please try to reply 🙂

    @moyez

    Moyez Rabbani

    @moyez

Your comment