Replies: 1 comment 4 replies
-
I had a look at your code, and it looks like your BIP-32 and BIP-44 methods are using different derivation paths. For BIP-44, you're using: const deriveAddress = await getBIP44AddressKeyDeriver(addressNode);
const secondAccount = deriveAddress(0); which will derive the key at For BIP-32, you're using: const addressNode = await snap.request({
// [...]
path: ['m', "44'", "966'"],
});
// [...]
const accountKey0 = await slip10Node.derive(["bip32:0'"]); which will derive the child
So in the case of BIP-44, you're deriving with a I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
I am trying to get to grips with handling private keys within metamask snaps. My aim is to derive the account keys I get when using metamask flask (ie create a snap which will return my account private and public key as a string, similar to the 'hello' example. I have been using polygon to do this using the BIP44 and BIP32 methods as described at https://docs.metamask.io/snaps/reference/rpc-api/. with coinType: 966 and path: ['m', "44'", "966'"], curve: 'secp256k1' for BIP44 and BIP32 methods respectively, but they are different keys (I feel I may be lacking some general understanding here but expected them to be the same). I've also started looking at the 'snap_getEntropy' call, but can't figure out how to derive a private key from the entropy. How is this done with metamask? In each of these methods of creating new private keys, is the mnemonic being used? Is there a way of building a snap to access the mnemonic?
Code at https://github.com/leopashov/snap
Beta Was this translation helpful? Give feedback.
All reactions