0

We want to start accepting ether from our clients and I'm learning API to make correct architechture.

Need to find correct answers for two questions:

  1. Usually (working with btc), we create new incoming address for each new incoming transaction. In ether it's made via geth account new and it creates new wallet with new address. Is that correct and common way of accepting incoming payments?

If we have thousands of clients, creating new account for each new incoming trasaction will get us tens of thousands accounts. And to transfer ether from those children wallets to main wallet will cost us a commission (since there is no move method like in btc blockchain).

May be it more appropriate to require client send us ether with unique message and use the same address all the time? But I dont see how to attach message to transaction in eth_sendTransaction command.

  1. I couldnt find any method to list all incoming transaction to my wallet, The only way I could figure out that there is incoming transaction is to request eth_getBlockByNumber method and than go through all transactions in block to find those that were sent to my address. Is that correct and common way of acquiring incoming transactions?

thanks for help

1

This is one use case where you should use smart contracts. You can write all the logic inside the contract and it can accept payments from whoever, with whatever parameters (payload). Once you have Ether in the contract, you can withdraw some of it to wherever you want (to your personal wallet for example).

Something like this for the paying part:

mapping (bytes32 =>  uint) payments;

function acceptPayment(bytes32 clientName) public payable {
    payments[clientName] = msg.value;
}

Also you need functions for checking paid amounts, possibility to withdraw etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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