Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Add more supported derivations for web3-subprovider #200

Closed
qmn1711 opened this issue Aug 8, 2018 · 5 comments · Fixed by #299
Closed

Add more supported derivations for web3-subprovider #200

qmn1711 opened this issue Aug 8, 2018 · 5 comments · Fixed by #299
Labels

Comments

@qmn1711
Copy link

qmn1711 commented Aug 8, 2018

For now @ledgerjs/web3-subprovider support only 44'/60'/x'/n pattern.
But in Ledger Live they're using m/44'/60'/0'/0, so please support this derivation in @ledgerjs/web3-subprovider.

p/s: Could @ledgerjs/web3-subprovider accept a lot of derivations like myetherwallet.com doing?

@pointtoken
Copy link

pointtoken commented Aug 10, 2018

Indeed, I think this broke the implementation on airswap , as I tried to use my Ledger (initialized with Ledger Live) on airswap and it couldn't find my address.

@pointtoken
Copy link

I'm seeing this break all earlier Ledger implementations -- for example, if I use a Ledger on IDEX it can't find the address of my current ETH address. Something is broken...

@amougel
Copy link
Contributor

amougel commented Aug 16, 2018

Changing the current implementation of account listing will either be a breaking change or really messy. I am thinking of replacing current path, acountsOffset and accountsLength by a list of paths [SubproviderOptions] to allow for more flexibility. (

type SubproviderOptions = {
// refer to https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
networkId: number,
// derivation path
path?: string,
// should use actively validate on the device
askConfirm?: boolean,
// number of accounts to derivate
accountsLength?: number,
// offset index to use to start derivating the accounts
accountsOffset?: number
};
)

@gre WDYT?

@TimDaub
Copy link

TimDaub commented Oct 30, 2018

I'm facing the same issue. Sent some ERC721 to an address of m/44'/60'/0'/0 and now I cannot retrieve it with ledgerjs.

// @format
const Eth = require("@ledgerhq/hw-app-eth").default;
const TransportNodeHid = require("@ledgerhq/hw-transport-node-hid").default;
const eip55 = require("eip55");

(async function() {
  console.log(TransportNodeHid);
  transport = await TransportNodeHid.create();
  const eth = new Eth(transport);
  const r = await eth.getAddress("44'/60'/0'/0", false);
  const address = eip55.encode(r.address);
  console.log(address);
})();

const privkey =
  "seed of my ledger nano s";

var HDKey = require("hdkey");
var hdkey = HDKey.fromMasterSeed(new Buffer(privkey, "hex"));
const childkey = hdkey.derive("m/44'/60'/0'/0");
const address = publicToAddress(childkey.publicKey, true).toString("hex");
console.log(address);

// generates the same addresses, but Ledger Live generates another one.

Gives me 0xC9xxx80 while Ledger Live gives me 0xFExxx3A. I'd like to reproduce 0xFExxx3A but I haven't found a way with eth.getAddress.

When I go to mycrypto.com or airswap.com and enter: m/44'/60'/0'/0 it generates me the correct address. Is it that ledger drops the last 0 somehow? I'm confused 😕

Edit: The solution is to use 44'/60'/0'/0/0 that's what Ledger Live is using. Via: LedgerHQ/ledger-live-desktop#1185

@milonite
Copy link

Same problem. There's some plan to support different paths? I still get

For now @ledgerjs/web3-subprovider support only 44'/60'/x'/n pattern.
But in Ledger Live they're using m/44'/60'/0'/0/0, so please support this derivation in @ledgerjs/web3-subprovider.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants