LoginSignup
4
4

More than 5 years have passed since last update.

ローカル環境で Ethereum の秘密鍵生成・アドレス取得

Last updated at Posted at 2018-05-02
  • 開発用に Ethereum の秘密鍵とアドレスをいくつか生成したいときがあったので、そのときに使用した方法のメモです。
  • ethereumjs-wallet を使用すると、とても簡単に Ethereum の秘密鍵を生成したりアドレスを取得したりすることができます。
  • もちろんローカル環境(オフライン)で実行可能です。

ethereumjs-wallet のインストール

$ npm install ethereumjs-wallet --save

秘密鍵・アドレス取得コード例

 var Wallet = require('ethereumjs-wallet');
 const wallet = Wallet.generate();
 console.log("privateKey: " + wallet.getPrivateKeyString());
 console.log("address: " + wallet.getAddressString());

実行

  • 上記のコードを app.js として保存した場合は、次のコマンドで実行できます。
$ node app.js

参考

Note

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4