❀️Understanding the Keyring concept

A keyring is a mechanism for managing cryptographic key pairs.

The keyring serves as a management system for a collection of key pairs. Its primary role is to facilitate the addition and removal of key pairs through a user interface. Each key pair corresponds to a distinct account, and the keyring enables various operations on these accounts, including signing, verification, and encryption/decryption.

In essence, it provides a convenient means to organize and interact with cryptographic keys associated with different accounts within a blockchain ecosystem.

// Import the keyring as required
import { Keyring } from '@polkadot/api';

// Initialize the API as we would normally do
...

// Create a keyring instance
const keyring = new Keyring({ type: 'sr25519' });
// Some mnemonic phrase
const PHRASE = 'entire material egg meadow latin bargain dutch coral blood melt acoustic thought';

// Add an account, straight mnemonic
const newPair = keyring.addFromUri(PHRASE);

Last updated