There is a site with simple registration and user login. How can I create a new ethereum account for each new user and store the keys of these accounts in my database
1 Answer
Try this:
const crypto = require("crypto");
const util = require("ethereumjs-util");
const privateKey = "0x" + crypto.randomBytes(32).toString("hex");
const publicAddr = "0x" + util.privateToAddress(privateKey).toString("hex");