I'm getting error here :: "send" and "transfer" are only available for objects of type "address payable", not "address".

    function pickWinner() public{
    uint index = random() % players.length;

   players[index].transfer(address(this).balance);     //error

1 Answer 1


In solidity there are 2 types of address: address and address payable. They are define diferently. For example,

 address public _firstKindOfAddress;
 address payable public _secondKindOfAddress;

If you want to transfer ether (or any other native coin) to some address, you must use the second option, address payable.


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