1

I need to create an Ethereum wallet for each user registering in my app (I am using Node.JS as backend). The idea is that each user can deposit and withdraw an amount from his wallet.

So what's the best way to accomplish this? And the best way to secure the private keys? Because users won't have access to this. Is very similar to the wallet on Binance exchange works.

Thanks

0xmysEE
  • 21
  • 3

2 Answers2

1

What you are asking is how to create a hot wallet.

Unless you are an expert in blockchains, I would strongly advise not to build this kind of feature yourself. It is just too dangerous, you are likely get it wrong and your users are likely to lose money due to hacks and similar incidents.

Instead, use something like WalletConnect protocol to let users use any wallet with your app.

Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127
0

You could generate a new random wallets with their private keys using Ethers

https://docs.ethers.io/v5/api/signer/#Wallet

I use this script to make test wallets and store them in a json

const ethers = require('ethers');
var fs = require('fs');
var walletsArray = []

for (let i = 0; i < 10; i++) { let wallet = new ethers.Wallet.createRandom() walletsArray.push(wallet.address) console.log(wallet.privateKey) } fs.writeFile('tenAddresses.json', JSON.stringify(walletsArray), 'utf8', callback);

console.log(walletsArray)

Casareafer
  • 648
  • 2
  • 12