This snap demonstrates the use of snap_getBip44Entropy
to derive a BIP-44
private key from the user's secret recovery phrase.
Note: Using
snap_getBip44Entropy
requires thesnap_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.
This snap exposes an onRpcRequest
handler, which supports the following
JSON-RPC methods:
-
getPublicKey
: Get the public key for the givencoinType
andaddressIndex
. -
signMessage
: Sign amessage
with the private key for the givencoinType
andaddressIndex
. For this particular example, we use theBLS12-381
elliptic curve to sign the message.
For more information, you can refer to the end-to-end tests.