@metamask/bip44-example-snap

2.1.3 • Public • Published

@metamask/bip44-example-snap

This snap demonstrates the use of snap_getBip44Entropy to derive a BIP-44 private key from the user's secret recovery phrase.

Snap manifest

Note: Using snap_getBip44Entropy requires the snap_getBip44Entropy permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the snap_getBip44Entropy permission:

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

Each of the coin types in the initialPermissions.snap_getBip44Entropy array represents a BIP-44 coin type. The coin types in the array above represent Bitcoin and Dogecoin, respectively. All coin types can be found in the SLIP-44 registry here.

Snap usage

This snap exposes an onRpcRequest handler, which supports the following JSON-RPC methods:

  • getPublicKey: Get the public key for the given coinType and addressIndex.
  • signMessage: Sign a message with the private key for the given coinType and addressIndex. For this particular example, we use the BLS12-381 elliptic curve to sign the message.

For more information, you can refer to the end-to-end tests.

Readme

Keywords

none

Package Sidebar

Install

npm i @metamask/bip44-example-snap

Weekly Downloads

4,224

Version

2.1.3

License

(MIT-0 OR Apache-2.0)

Unpacked Size

225 kB

Total Files

7

Last publish

Collaborators

  • mcmire
  • nicholasellul
  • naugtur
  • ritave
  • danfinlay
  • kumavis
  • rekmarks
  • metamaskbot
  • gudahtt
  • sethkfman