From step 3 to step 6, you work will be implemented in the Ledger Live repository.
Derive Address from device
Before starting this step, make sure you have setup your environment to work with ledger-live
.
First and easiest step is to get an address from the device for MyCoin, by creating the hw-getAddress.ts
Resolver:
apps/ledger-live-common/src/families/mycoin/hw-getAddress.js
:
import type { Resolver } from "../../hw/getAddress/types";
import MyCoin from "@ledgerhq/hw-app-mycoin";
const resolver: Resolver = async (transport, { path, verify }) => {
const myCoin = new MyCoin(transport);
const r = await myCoin.getAddress(path, verify);
return {
address: r.address,
publicKey: r.publicKey,
path,
};
};
export default resolver;
Test that you can derive an address:
ledger-live getAddress --currency mycoin --path "44'/8008'/0'/0/0" --derivationMode ""
Derivation
Ledger Live uses the BIP44 derivation mode by default (as derivationMode=""
), which is standard and most common way for HD wallet.
If MyCoin has a conventional derivation path (BIP44), Ledger Live should already be able to derive an address correctly.
If you need to use another derivation mode:
Make changes to libs/ledger-live-common/src/derivation.ts
:
- Add a new derivation mode with
overridesDerivation
:
// const modes = Object.freeze({
// ...
mycoinbip44h: { // Hardened BIP44 for MyCoin
overridesDerivation: "44'/8008'/<account>'/0'/<address>'",
},
// });
- Add the mode to family in
legacyDerivations
:
// const legacyDerivations: $Shape<CryptoCurrencyConfig<DerivationMode[]>> = {
// ...
mycoin: ["mycoinbip44h"],
// };
- Disable the default use of BIP44 in
disableBIP44
:
// const disableBIP44 = {
// ...
mycoin: true,
// };
- Add the coin to
seedIdentifierPath
:
// const seedIdentifierPath = {
// ...
mycoin: `${purpose}'/${coinType}'/0'/0'/0'`,
// };
See Derivation documentation for further details.
You can check that the derivationMode is correct by executing:
pnpm build:cli
pnpm run:cli getAddress --currency=mycoin --path="44'/8008'/0'/0/0" --derivationMode=""