1

I'm just starting in the ethereum and trying to build an app using Web3 and Nodejs. I'll need your lights so I can get any idea to know how to resolve those points:

  1. I have my own public address and would like to generate an address to each of my users
  2. So they can pay me by sending them the generated address.
  3. I would like to trigger the transaction to know if true or false, it has been completed.

Thank you guys !!

1

About 1. for creating fresh addresses you can use keythereum or ethers.js. Take a look on both libraries and pick the one you prefer.

About 2. and 3. To track the payments I see 2 options:

  • You will be using nodejs so you can setup nodejs cronjob and check in block range ({fromBlock: X, toBlock: 'latest'}) the new transactions that sent ethers to your main address. You should always remember the 'fromBlock' number so you don't have to query all the blocks from the beginning, but only the ones that your cronjob didn't cover.
  • OR you should write simple smart contract with ethers transfering method where inside of this method you can fire event with tracking which address sent how much ethers to your main address. Then you can check the events and see the payments history on the blockchain.
| improve this answer | |
  • Hello! Do you think it's possible to have one wallet and generate a new address from this wallet so every user will get a different address? It will be easier for me to trigger which user has done the transaction. What do you think? :) – Bryan Nov 2 '19 at 3:55

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.