How to generate Ethereum private key and address in local (offline) environment
1 min readMay 2, 2018
- I used this way when I needed to generate multiple Ethereum private keys and addresses for development.
- With ethereumjs-wallet, you can generate Ethereum private keys and addressed very easily.
- You can run the code in your local (offline) environment, of course.
Install ethereumjs-wallet
$ npm install ethereumjs-wallet --save
Code example
var Wallet = require('ethereumjs-wallet');
const wallet = Wallet.generate();
console.log("privateKey: " + wallet.getPrivateKeyString());
console.log("address: " + wallet.getAddressString());
Run the code
You can run the code with the following command when you name the code above “app.js”.
$ node app.js
References
Support
If you find this article is helpful, it would be greatly appreciated if you could tip Ether to the address below. Thank you!
0x0089d53F703f7E0843953D48133f74cE247184c2