Created
March 11, 2018 01:39
-
-
Save hm0429/b1ccecd7bfaf6228eadf49afeecfd919 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Wallet = require('ethereumjs-wallet'); | |
var EthUtil = require('ethereumjs-util'); | |
// 既存の privateKey を使用して、wallet インスタンスを取得 | |
const privateKeyBuffer = EthUtil.toBuffer('0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb'); | |
const wallet = Wallet.fromPrivateKey(privateKeyBuffer); | |
// ウォレットの秘密鍵を取得 | |
const privateKey = wallet.getPrivateKeyString(); | |
console.log(privateKey); | |
// ウォレットの公開鍵を取得 | |
const publicKey = wallet.getPublicKeyString(); | |
console.log(publicKey); | |
// ウォレットのアドレスを取得 | |
const address = wallet.getAddressString(); | |
console.log(address); | |
// keystore の名前を取得 | |
const keystoreFilename = wallet.getV3Filename(); | |
console.log(keystoreFilename); | |
// keystore (JSONフォーマット) を取得 | |
const keystore = wallet.toV3("PASSWORD"); | |
console.log(keystore); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment