Hi I need one help as I am unable to run below logic in solidity as some change in solidity.

function transfer_balance(address recipient_address, uint amount) 
public returns(bool) {
    if(msg.sender == owner){
         if (amount <= get_balance()){
             //transfer the amount received as argument to the recipient_address
             recipient_address.transfer(amount);<-- error here
             return true;
            return false;
        return false;

Error is

TypeError: Member "transfer" not found or not visible after argument- dependent lookup in address. recipient_address.transfer(amount); ^------------------------^

This is little confusing as it was run on old version on solidity.

1 Answer 1


There are a number breaking changes when moving from Solidity version 0.4.X to 0.5.X

One of the big differences is the introduction of the address payable type, which is different than address. Only a variable with the address payable type has the transfer function:

The address type was split into address and address payable, where only address payable provides the transfer function. An address payable can be directly converted to an address, but the other way around is not allowed. Converting address to address payable is possible via conversion through uint160. If c is a contract, address(c) results in address payable only if c has a payable fallback function. If you use the withdraw pattern, you most likely do not have to change your code because transfer is only used on msg.sender instead of stored addresses and msg.sender is an address payable.

So the simple solution here is to update you function definition to:

function transfer_balance(address payable recipient_address, uint amount) public returns(bool)
  • Thanks@shawn its work. I have check the breaking changes in solidity and reform my code accroding to it. Commented Dec 18, 2018 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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