Guides
Dash CoreDash PlatformDash.orgDash User DocsLog In
These docs are for v0.16.0. Click to read the latest docs for v0.25-redirect.

Retrieve an Account's Identities

Get the list of Dash Platform Identities associated with an account

Overview

In this tutorial we will retrieve the list of identities associated with a specified mnemonic-based account. Since multiple identities may be created using the same mnemonic, it is helpful to have a way to quickly retrieve all these identities (e.g. if importing the mnemonic into a new device).

Prerequisites

Code

const Dash = require('dash');

const client = new Dash.Client({
  network: 'evonet',
  wallet: {
    mnemonic: 'a Dash wallet mnemonic with evonet funds goes here',
  },
});

const retrieveIdentityIds = async () => {
  const account = await client.getWalletAccount();
  return account.getIdentityIds();
};

retrieveIdentityIds()
  .then((d) => console.log('Mnemonic identities:\n', d))
  .catch((e) => console.error('Something went wrong:\n', e))
  .finally(() => client.disconnect());

Example Response

[
  '8DpCxc6CY1vHQzQVv8EezN4fpKis5K2YuxGYRSiccsC8',
  '4SUjmwadgF8LLxnjXchhkNtw7tfgacg82CuZegWktW61'
]

What's Happening

After we intialize the Client and getting the account, we call account.getIdentityIds to retrieve a list of all identities created with the wallet mnemonic. The list of identities is output to the console.