> For the complete documentation index, see [llms.txt](/llms.txt).

- Snap
- Restricted

# snap_getBip32PublicKey

Gets the [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)public key for the derivation path specified by the `path` parameter. Note that this returns the public key, not the extended public key (`xpub`), or Ethereum address.

## Parameters[​](#parameters "Direct link to Parameters")

object

required

An object containing the parameters for the `snap_getBip32PublicKey` method.

### curve

"ed25519" | "ed25519Bip32" | "secp256k1"

required

The curve to use for the derived key. This must be a curve supported by [@metamask/key-tree](https://npmjs.com/package/@metamask/key-tree).

### path

string[]

required

The derivation path to use for the derived key, represented as an array of path segments. For example, the path `m/44'/1'/0'/0/0` would be represented as `['m', "44'", "1'", "0'", '0', '0']`.

### compressed

boolean

Whether to return the compressed public key. Defaults to `false`.

### 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[​](#returns "Direct link to Returns")

string

The public key as hexadecimal string. May be compressed or uncompressed depending on the `compressed` parameter provided in the request parameters.

## Example

- Manifest
- Usage

```
{
  "initialPermissions": {
    "snap_getBip32PublicKey": [
      {
        "path": ["m", "44'", "3'", "0'", "0", "0"],
        "curve": "secp256k1"
      }
    ]
  }
}

```

```
// This example uses Dogecoin, which has a derivation path starting with
// "m / 44' / 3'".
const dogecoinPublicKey = await snap.request({
  method: 'snap_getBip32PublicKey',
  params: {
    // The path and curve must be specified in the initial permissions.
    path: ['m', "44'", "3'", "0'", '0', '0'],
    curve: 'secp256k1',
    compressed: false,
  },
})

// '0x...'
console.log(dogecoinPublicKey)

```
