Address & Address Payable

In Solidity, address and address payable are special data types used to represent Ethereum addresses.

The address data type has the following attributes:

  • balance: returns the balance of the address in wei

  • code:code at the Address (can be empty)

  • codehash: the codehash of the Address

  • call: allows sending a message to another address with a specified amount of wei and optional data

The address payable data type has all the attributes of the address data type, plus additional attributes:

  • transfer: same as the transfer attribute of the address data type, but marked as payable so that it can receive ether

  • send: same as the send attribute of the address data type, but marked as payable so that it can receive ether. Note that send is not recommended to be used with address payable, as it can result in lost ether if the recipient address has a fallback function that consumes too much gas.

Overall, these attributes allow for interacting with Ethereum addresses and sending/receiving ether between them.

Last updated