sending ether to external address using fallback function in an ethereum contract

1k views Asked by At

I am trying to create a contract, which when receives some ether, send them all to a fixed external account automatically. I need this for a website, where I have many customers depositing ether. I intend to provide each customer a unique ethereum account or contract account so that whenever they send some ether, my front end knows who has sent, and all of the funds I receive from all the customer goes to my fixed account "0x83fe472e50cf588f3fb309409bda2ab946248d8d".

my contract code is as follows:

contract Transfer_effiAnkit
{

    address constant private receiver = 0x83fe472e50cf588f3fb309409bda2ab946248d8d;


    function () payable 
    {
        receiver.send(msg.value);
    }

    function getAddress() returns(address){

        return receiver;
    }

}

Please help.

1

There are 1 answers

2
Nerdroid On

your contract should works i recommend the use of

mapping (address => uint256) balances;

to keep track of transactions