Skip to content

Dash SDK

NPM Version Build Status Release Date standard-readme compliant

Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)

Dash library allows you to connect to DAPI and receive or broadcast payments on the Dash Network, manage identifies, register data contracts, retrieve or submit documents on the Dash Platform, all within a single library.

Install

Browser

<script src="https://unpkg.com/dash"></script>

Node

In order to use this library, you will need to add our NPM package to your project.

Having NodeJS installed, just type :

npm install dash

Usage

const Dash = require('dash');

const client = new Dash.Client({
  network: 'evonet',
  wallet: {
    mnemonic: 'arena light cheap control apple buffalo indicate rare motor valid accident isolate',
  },
});

// Accessing an account allows you to transact with the Dash Network
client.getWalletAccount().then(async (account) => {
  console.log('Funding address', account.getUnusedAddress().address);

  const balance = account.getConfirmedBalance();
  console.log('Confirmed Balance', balance);

  if (balance > 0) {
    // Creating an identity is the basis of all interactions with the Dash Platform
    const identity = await client.platform.identities.register();

    // Prepare a new document containing a simple hello world sent to a hypothetical tutorial contract
    const document = await client.platform.documents.create(
      'tutorialContract.note',
      identity,
      { message: 'Hello World' },
    );

    // Broadcast the document into a new state transition
    await client.platform.documents.broadcast({ create: [document] }, identity);
  }
});

Use-cases examples

Tutorial

Licence

MIT © Dash Core Group, Inc.