Skip to content

Instantly share code, notes, and snippets.

@aheissenberger
Created March 2, 2019 09:25
Show Gist options
  • Save aheissenberger/47f06eaab48e16f60d42a7805c9c8ce1 to your computer and use it in GitHub Desktop.
Save aheissenberger/47f06eaab48e16f60d42a7805c9c8ce1 to your computer and use it in GitHub Desktop.
create a wallet address (ethereum)
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