Created
March 2, 2019 09:25
-
-
Save aheissenberger/47f06eaab48e16f60d42a7805c9c8ce1 to your computer and use it in GitHub Desktop.
create a wallet address (ethereum)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto"); | |
var ethUtils = require("ethereumjs-util"); | |
var getRandomWallet = function() { | |
var randbytes = crypto.randomBytes(32); | |
var address = "0x" + ethUtils.privateToAddress(randbytes).toString("hex"); | |
return { address: address, privKey: randbytes.toString("hex") }; | |
}; | |
console.log(getRandomWallet().address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment