I am curious that some companies give each customer an eth address for making payment and how to redirect the payment to one master account? Save the private key of each customer? Any example? I think the gas will be charged two times?

  • Do you mean for incoming or outgoing transactions? So a company which provides way to pay with Eth or a company which allows paying for products with Eth? Aug 19 '18 at 5:57
  • I mean I want to make a website, for each order there is a new eth address to pay, so I will get a lot of eth address account each with a small amount, how can I combine them together? Can I create a new address for each order and after receiving payment, I can directly redirect the eth to main main eth account?
    – Louis
    Aug 19 '18 at 9:43
  • go for option 1, option 2 will cost much more than transaction fees as contract development is very high priced.
    – Nulik
    Aug 19 '18 at 13:30

You have at least two different options (someone has probably also other ideas):

1) Create a new private&public key pair for each customer - you hold the private key. When they pay for something they send the Eth to that account's address. Then you can check that the Eth is there and send the purchases products and forward the Eth to wherever you want.

2) Create a smart contract which will handle the payments. All payments are received by the same contract but you can distinguish who has paid and how much. You can distinguish the payments either with some parameter in the contract payable functions (for example payment ID) or by the sender's address.

Option 1 is quite straightforward to implement but gas is paid twice (once by buyer, once by you). Option 2 is a bit more complicated but more comprehensive and more professional. With option 2 only the sender pays gas once and after that all the Eth is in the smart contract and you only have to pay gas when you want to send it out of the contract.


The usual procedure is to take a smart contract which manages the payments. You can let the customer send your smart contract some ethereum and a receiptID, which requires a function containing a receiptID or something to uniquely identify the purchase which is being paid. The smart contract can then log a message which you can easily query in your central management software using the javascript api for example. I advise to clear the contract manually if required or if a (configurable) threshold of ethereum was received, so that you don't initiate a transaction for every incoming payment and therefore don't have to pay gas fees every single time.

The second variant is a more old-school variant usually not applied in ethereum because it is more convenient do solve this task using smart contracts. It is a variant which was already discovered and used in bitcoin and is called HD (hierarchical deterministic) wallets. The idea is that you can derive all private and public keys from a single value, which leads to less storage space and management requirements. Another advantage using this method in contrast to basic key management is the ability to derive only public keys. This enables higher security since you don't have to store a single private key in the (insecure) web server, where your products get bought. Instead, you can store the seed in an isolated and highly secure server and derive any private key belonging to the public key a customer derived on your (insecure) web server to finally redirect the customers payment.

Further informations to HD-Wallets: https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc#deterministic-seeded-wallets

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.