Skip to content

Instantly share code, notes, and snippets.

@zh
Created January 27, 2023 16:26
Show Gist options
  • Save zh/aa4fed54f3908035c297aef5f7a04ce3 to your computer and use it in GitHub Desktop.
Save zh/aa4fed54f3908035c297aef5f7a04ce3 to your computer and use it in GitHub Desktop.
var ethers = require('ethers');
var crypto = require('crypto');
var id = crypto.randomBytes(32).toString('hex');
var privateKey = "0x"+id;
console.log("SAVE BUT DO NOT SHARE THIS:", privateKey);
var wallet = new ethers.Wallet(privateKey);
console.log("Address: " + wallet.address);
// L I N K .
// https://www.quicknode.com/guides/web3-sdks/how-to-generate-a-new-ethereum-address-in-javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment