Skip to main content
  • Snap
  • Restricted

snap_getBip44Entropy

Description

Enables you to manage users' non-EVM accounts by deriving the BIP-44 keys specified by the coinType parameter. The keys are derived using the entropy from the user's Secret Recovery Phrase.

If the keys you want to derive don't conform to the BIP-44 structure, use snap_getBip32Entropy instead.

This method is designed to be used with the @metamask/key-tree module. @metamask/key-tree can help you get the extended private keys for user addresses, but it's your responsibility to know how to use those keys to, for example, derive an address for the relevant protocol or sign a transaction for the user.

Parameters

coinType

numberrequired

The coin type to use for the derived key, as specified in the SLIP-44 registry.

source

string | null

The ID of the entropy source to use. If not specified, the primary entropy source will be used. For a list of available entropy sources, see the snap_listEntropySources method.

Returns

depth

0 | 1 | 2 | 3 | 4 | 5

The 0-indexed BIP-44 path depth of this node.

A BIP-44 path is of the form:

m / 44' / coin_type' / account' / change / address_index

With the following depths:

0 / 1 / 2 / 3 / 4 / 5

masterFingerprint

number | null

The fingerprint of the master node, i.e., the node at depth 0. May be undefined if this node was created from an extended key.

parentFingerprint

number

The fingerprint of the parent key, or 0 if this is a master node.

index

number

The index of the node, or 0 if this is a master node.

network

"mainnet" | "testnet" | null

The network for the node. This is only used for extended keys, and defaults to mainnet.

privateKey

string | null

The hexadecimal string representation of the private key for this node. May be undefined if the node is a public node.

publicKey

string

The hexadecimal string representation of the public key for this node.

chainCode

string

The hexadecimal string representation of the chain code for this node.

coin_type

number

path

`m / bip32:${number}' / bip32:${number}'`

Example

{
"initialPermissions": {
"snap_getBip44Entropy": [
{
"coinType": 3
}
]
}
}