I want to write a function let user deposit a fixed amount of eth to a specific address for registering purpose.

pragma solidity ^0.5.0;

contract Election {
    // Constructor
    address public chairman;

    constructor () public {
      chairman = msg.sender;

    function register() public payable{

But this error threw out

member 'transfer' not found or not visible after argument-dependent lookup in address

1 Answer 1


In order to transfer ETH to an address, it has to be marked as payable, so you have to use address payable public chairman;.


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.