0

So I want to allow users to deposit ETH to their accounts in my website. How could i go about giving a user an ETH address to deposit to that address and then detect it and add the funds to user's account? the same way that binance does if you are familiar with.

well i guess first i need a pool of ETH accounts with their private keys, which brings up the first question: how can i automatically generate bunch of eth accounts and export heir private key?

then i would allocate each user an ETH depositing address and would need to keep checking for a deposit in that ETH account, and that is the second question, which is how can i check for deposit/transactions in that address

any help or advice would be appreciated, i couldn't find any article or tutorial about it

1

how can i automatically generate bunch of eth accounts and export heir private key?

You can generate eth account with private key using web3 API like: web3.eth.accounts.create()(demo code)

how can i check for deposit/transactions in that address

You can do this using RPC calls, using Etherscan API. By using below api you can get all transaction done by address. You can use this api to listen for new transaction.

http://api.etherscan.io/api?module=account&action=txlist&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken

Or you can just subscribe to event using web3js for specific address.

PS: Little tip from me(ignore if you don't like)

To make solution for your second question less complicated, You can create smart contract with payable functions which accept address as argument. When user deposit, this smart contract function will be called and you will pass address of the user(I'm assuming that you have stored all users address in your database.) as a argument.

Smart contract simply transfer this funds to address which you provided in the argument.

|improve this answer|||||

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.