Ethereum addresses in Solidity

ETH addresses are hexadecimal like: 0x123AFD… The same addresses can be owned by a wallet or by Smart contract deployment. So you can send and get balance of both.

Basic functions are:

  • address.balance: total weis in account (1 ETH == 10^18 weis).
  • address.transfer(amount): send an amount in weis, raising an exception if error.
  • address.send(amount): returns true if success instead of raising an exception.

Transfer/send costs are 2300 in gas.

Global objects in a contract are:

  • msg.sender: Sending address
  • msg.value: weis sent
  • now: current timestamp

Functions or addresses should be marked as PAYABLE to receive ETH.

Leave a Reply

Your email address will not be published. Required fields are marked *