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
Asked
Active
Viewed 69 times
1 Answers
0
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");
goodvibration
- 26,003
- 5
- 46
- 86