@polkadot/util-cryptothat is included with the API matches with the version of
@polkadot/keyringinstalled. So if the API depends on
util-crypto 1.4.1, it would make sense to include
keyring 1.4.1as the installed version. (This helps in making sure extra versions of the libraries are not included as duplicates, especially in the case where bundles are created. Additionally, this makes sure that weird side-effects in the WASM initialization is avoided.)
typewhich can have a value of either
sr25519, when not specified this would default to
ed25519. This type parameter only applies to the default type of account created when no type is specified, it does not mean that the keyring can only store that type of account.
sr25519by default based on the above construction params, however we can also add an
ed25519account and use it transparently in the same keyring.
sr25519the keyring relies on a WASM build of the schnorrkel libraries. Since the API inlitialization is already async, it initializes the WASM libraries as part of the setup.
.addFromUri(<suri>, [meta], [type])function, where only the
suriparam is required. For instance to add an account via mnemonic, you would do the following -
subkey. Be very wary of the last "dev-seed" option, it is explicitly added for
subkeycompatibility and implies using the "known-everywhere" dev seed. It is however useful when running Polkadot/Substrate with a
addFromUrimethod on the keyring is intelligent enough to detect and add from inputs specified as mnemonics, hex seeds and string seeds (appropriately padded).
Janice//hardwill perform a hard derivation with the path
hardon the pair that is generated from the
Janiceseed. As far as possible, try to stick with mnemonics in your applications, unless you have a good reason to not do so. Humans are generally bad at generating their own entropy and mnemonics has additional properties such as built-in checksums.
keyring.getPairs()to retrieve a list of all pairs in the keyring and
keyring.getPair(<address or publicKey>)to retrieve a pair where we have an identifier.