LoginSignup
2
0

More than 3 years have passed since last update.

ethers.js で Ethereum ウォレットを作成

Last updated at Posted at 2019-07-26

ethers.js でウォレットを作成して、アドレス、ニーモニック、秘密鍵を取得するサンプルコードです。

// ethers.js をインポート
const ethers = require('ethers')

// ウォレットを作成
let wallet = new ethers.Wallet.createRandom()

// ウォレットのアドレスを取得
let address = wallet.address
console.log("address:", address)

// ウォレットのニーモニックを取得
let mnemonic = wallet.mnemonic
console.log("mnemonic:", mnemonic)

// ウォレットの秘密鍵を取得
let privateKey = wallet.privateKey
console.log("privateKey:", privateKey)

Ref.

2
0
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
2
0