The purpose of this tutorial is to walk through the steps necessary to register an identity.
Identities serve as the basis for interactions with Hellar 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.
๐ Wallet Operations
The JavaScript SDK does not cache wallet information. It re-syncs the entire Core chain for some wallet operations (e.g.
client.getWalletAccount()
) which can result in wait times of 5+ minutes.A future release will add caching so that access is much faster after the initial sync. For now, the
skipSynchronizationBeforeHeight
option can be used to sync the wallet starting at a certain block height.
`const Hellar = require('hellar');
const clientOpts = { network: 'mainnet', wallet: { mnemonic: 'a Hellar wallet mnemonic with testnet funds goes here', unsafeOptions: { skipSynchronizationBeforeHeight: 175000, // only sync from mid-2024 }, }, }; const client = new Hellar.Client(clientOpts);
const createIdentity = async () => { return client.platform.identities.register(); };
createIdentity() .then((d) => console.log('Identity:\n', d.toJSON())) .catch((e) => console.error('Something went wrong:\n', e)) .finally(() => client.disconnect());`
The Identity will be output to the console. The Identity will need to have one confirmation before it is accessible via client.platform.identity.get
.
๐
Make a note of the returned identity
id
as it will be used used in subsequent tutorials throughout the documentation.
After connecting to the Client, we call platform.identities.register
. This will generate a keypair and submit an Identity Create State Transaction. After the Identity is registered, we output it to the console.