1

Is there a difference between sending ether to a user account or to a smart contract. E.g.:

contract ThisIsAContract{
    function()
        public
        payable
    {}
}

Now I call (pseudocode)

address(0x0).transfer(payout);

and also

address(ThisIsAContract.address).transfer(payout);

Are both okay and do they act the same?

1

The only difference is that transactions to non-contracts always cost 21k (unless you have tx data included), whereas transactions to contracts will execute the byte code at that address, which may cost more than 21k. So when you transfer to a contract, you should always do a gas estimate and set the gas amount manually.

-1

Never use the 0x0 address to transfer ether. Always specify what address you want to transfer ether to. The 0x0 address is the genesis address if you send ether there you will never get it back.

You can read more about the why here: Hundreds of Millions of Dollars Locked at Ethereum 0x0 Address and Smart Contracts’ Addresses — How, Why and What to do?

  • 3
    This might be okay as a comment, but it's certainly not an answer to the question. – smarx Jul 31 '18 at 20:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.