How to use the ethereumjs-wallet/hdkey.fromExtendedKey function in ethereumjs-wallet

To help you get started, we’ve selected a few ethereumjs-wallet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blocktrail / blocktrail-sdk-nodejs / lib / rsk-wallet.js View on Github external
RskWallet.prototype.getAddressByPath = function(path) {
    var self = this;
    //bitcoin
    var derivedPrimaryPublicKey = self.getPrimaryPublicKey(path);
    console.log("btc derived key:",derivedPrimaryPublicKey);
  
    //rsk
    var derivedEthAddy = ethhdkey.fromExtendedKey(derivedPrimaryPublicKey.toBase58())
    var address = derivedEthAddy.getWallet().getAddressString()
    console.log("rsk addy: ",address)
    return address
};
github blockchain / My-Wallet-V3 / src / eth / eth-wallet.js View on Github external
deriveChild (index, secPass) {
    let w = this._wallet;
    let cipher;
    if (w.isDoubleEncrypted) {
      if (!secPass) throw new Error('Second password required to derive ethereum wallet');
      else cipher = w.createCipher(secPass);
    }
    let masterHdNode = w.hdwallet.getMasterHDNode(cipher);
    let accountNode = masterHdNode
      .deriveHardened(44)
      .deriveHardened(60)
      .deriveHardened(0)
      .derive(0)
      .derive(index);
    return EthHd.fromExtendedKey(accountNode.toBase58());
  }
github airswap / AirSwap.js / src / HDW / redux / middleware.js View on Github external
const getHWDAddresses = (store, start) => {
  const hdk = new HDKey()
  hdk.publicKey = new Buffer(publicKey, 'hex')
  hdk.chainCode = new Buffer(chainCode, 'hex')
  const accounts = []
  for (let i = start; i < start + increment; i++) {
    const derivedKey = hdk.derive(`m/${i}`)
    const address = ehdkey
      .fromExtendedKey(derivedKey.publicExtendedKey)
      .getWallet()
      .getAddress()
      .toString('hex')
    const aPath = `${path}/${i}`
    const aAddress = `0x${address}`
    accounts.push({
      path: aPath,
      address: aAddress,
      index: i,
    })
    addressMapping[aPath] = aAddress
    store.dispatch(addTrackedAddress({ address: aAddress, tokenAddress: ETH_ADDRESS }))
  }
  store.dispatch({
    type: 'LOADED_HDW_ACCOUNTS',
github balance-io / balance-manager / src / handlers / trezor-eth.js View on Github external
window.TrezorConnect.getXPubKey(basePath, response => {
      if (response.success) {
        trezorEthInstance.networkId = networkId;
        trezorEthInstance.hdkey = HDKey.fromExtendedKey(response.xpubkey);
        trezorEthInstance.basePath = basePath;
        resolve(trezorEthInstance);
      } else {
        reject(response.error);
      }
    });
  });
github meth / eth-hd-wallet / src / index.js View on Github external
constructor (xPrivKey) {
    this._hdKey = fromExtendedKey(xPrivKey)
    this._root = this._hdKey.derivePath(BIP44_PATH)
    this._children = []
  }