I start Electrum in my cmdline like this:
./Electrum --testnet
I connect Ledger Nano S to my laptop. In Electrum I make a new HD Wallet with Derivation path using the Nano S's private key as seed:
"m/49'/1'/0'"
In NodeJS (LedgerJS library) I write this code, using the exact same derivation path, also using the Nano S private key as seed:
const transport = await TransportNodeHid.create();
const btc = new AppBtc(transport);
const result = await btc.getWalletPublicKey("m/49'/1'/0'");
console.log(result.getWalletPublicKey())
Now, since the TransportNodeHid connects to my Ledger Nano S, I expect that the AppBtc object generates a HD Wallet with the exact same seed, and therefore the derivation path
"m/49'/1'/0'"
should give me the exact same Wallet Master Public key and receiving Bitcoin address right?
However, in Electrum:
Master Public Key: upub5EorGi4nr15AW.....
Receiving Address: 2NEYbAH7x6sXU2bS....
and in my NodeJS application, using getWalletPublicKey():
{
publicKey:'049bd7786109d5bed56.....',
bitcoinAddress: 'mtCKwjnNzNZr.....',
chainCode:'c511f1afedb628fdb93299747604b...'
}
Now, I figured out that the publicKey and chainCode that the NodeJS code returns can be combined somehow to create the Master Public Key. However, the bitcoinAddress property should be the address associated with my HD wallet right? It's different from the receiving address in the Electrum app, but it should still be a receiving address.
However I already tried sending 0.0001 BTC to it with Testnet but it never arrived in my Electrum Wallet. So does this mean that this address is not associated with my Electrum Wallet? Even though I gave the exact same Derivation Path and used the exact same seed (hardware device Ledger Nano S)?
How can I "get" more receiving Address from my HD Wallet using the LedgerJS library?
I have checked LedgerJS documentation and examples, but I wouldn't go so far as to call it "documentation", because most functionality is barely explained and examples are virtually non-existent. There's a lot of guesswork involved in how exactly everything works.
https://github.com/LedgerHQ/ledgerjs/tree/master/packages/hw-app-btc#getwalletpublickey