1

is it possible to do using web3.js for a dapp that is going to be run on mainnet.?

I have a requirement to assign valid ethereum address to each user who are registering on my website. I want this to be created on user registration, Not planning to use a address book for mapping. What would be the best way to achieve it.?

1 Answer 1

1

It is possible, since you mentioned registration, I am assuming you have a backend, so when user is registering, just generate random public and private keypair (https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#create), and store public key in database. If you need private key too, make sure you encrypt it with users password before storing in database (https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#encrypt). Now if you are going to send transactions using that public address, you can save encrypted private key in session and ask user for password on every action, so you could safely decrypt it on frontend, or you can save decrypted version of private key in session, which is more user friendly, but less secure. And if user resets password, do not forget to decrypt private key and encrypt it with new password. Since you mentioned web3.js I assumed that you are using JS backend and provided you links with JS version of web3 library.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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