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

Register an Identity

The purpose of this tutorial is to walk through the steps necessary to register an identity.

Overview

Identities serve as the basis for interactions with Dash Platform. They consist primarily of a public key used to register a unique entity on the network. Additional details regarding identities can be found in the Identity description.

For this tutorial you will need a wallet mnemonic with some funds in it: How to Create and Fund a Wallet

Code

🚧

Identity public key reuse

Early versions of Dash Platform did not check if a public key was already used when creating an identity. As of Dash Platform Protocol v0.13, validation ensures that a public key can only be associated with a single identity.

const Dash = require('dash');

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

const createIdentity = async function () {
  try {
    const platform = client.platform;
    const identity = await platform.identities.register();
    console.log({identity});
  } catch (e) {
    console.error('Something went wrong:', e);
  } finally {
    client.disconnect();
  }
}

createIdentity();

The identity ID will be output to the console. The identity will need to have one confirmation before it is accessible via client.platform.identity.get.

What's Happening

After connecting to the Client, we call platform.identities.register. This will generate a keypair and submit an Identity Open Transaction. After the identity is registered, we output it to the console.