• Home
  • About
    • Jiwon Jeong photo

      Jiwon Jeong

      끊임없이 배우며 성장하는 엔지니어

    • Learn More
    • Email
    • Github
  • Posts
    • All Posts
    • All Tags
    • All Categories
  • Projects

HDWallet

02 Jul 2022

Reading time ~1 minute

HDWallet

  • 하나의 마스터 시드키로부터 여러개의 키를 결정론적으로 만드는 방법
    • 어떤 마스터 시드로부터 변화를 주면서 함께 backup phrase만 가지고 있어도 다양한 계정을 만들 수 있게 됨
    • m / purpose / coin type / account / change / address index
      • m / 44’ / 60’ / 0’ / 0 / n
const { hdkey } = require('ethereumjs-wallet');
const bip39 = require('bip39');
const mnemonic = bip39.generateMnemonic();
const seed = bip39.mnemonicToSeedSync(mnemonic).toString('hex'); //마스터 seed
const key = hdkey.fromMasterSeed(seed)
const child = key.deriveChild(1) //마스터 seed의 private key로부터 이끌어내는 child 계정
const childWallet = child.getWallet()
console.log(childWallet)


BlockChainSecuirity Share Tweet +1