Guides
Dash CoreDash PlatformDash.orgDash User DocsLog In
Hey! These docs are for version 0.18.0, which is no longer officially supported. Click here for the latest version, 0.25-redirect!


The purpose of this tutorial is to walk through the steps necessary to add credits to an identity's balance.

# Overview

As users interact with Dash Platform applications, the credit balance associated with their identity will decrease. Eventually it will be necessary to topup the balance by converting some Dash to credits. Additional details regarding credits can be found in the [Credits description](🔗).

## Prerequisites

  • [node.js](🔗) (v12+)

  • Basic familiarity with JavaScript asychronous functions using [async/await](🔗)

  • The Dash JavaScript SDK is initialized (covered in [Connecting to a Network](🔗))

  • A wallet mnemonic with some funds in it: [Tutorial: Create and Fund a Wallet](🔗)

  • A Dash Platform Identity: [Tutorial: Register an Identity](🔗)

# Code

Wallet Operations

Currently, the JavaScript SDK does not cache wallet information, and therefore, it re-syncs the entire Core chain for some wallet operations (e.g. `client.getWalletAccount()`). This can result in wait times of 5+ minutes.

An upcoming release will add a persistence feature to cache wallet information during initial sync so that subsequent access is much faster. For now, the `skipSynchronizationBeforeHeight` option can be used to only sync the wallet starting at a certain block height.



# What's Happening

After connecting to the Client, we call `platform.identities.topUp` with an identity ID and a topup amount in duffs. This creates a lock transaction and increases the identity's credit balance by the relevant amount (minus fee). The updated balance is output to the console.

Dash / Credit Conversion

Dash is converted to credits at a ratio of `1 duff : 1000 credits`. This provides flexibility for very granular platform fees.