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

Create and Fund a Wallet

Overview

In order to make changes on Dash platform, you need a wallet with a balance. This tutorial explains how to generate a new wallet, retrieve an address from it, and transfer test funds to the address from a faucet.

Code

const Dash = require('dash');

const clientOpts = {
  network: 'evonet',
  wallet: {
  	mnemonic: null, // this indicates that we want a new wallet to be generated
    	              // if you want to get a new address for an existing wallet
      	            // replace 'null' with an existing wallet mnemonic
  }
};

const client = new Dash.Client(clientOpts);

async function createWallet() {
  try {
    const account = await client.wallet.getAccount();
    await account.isReady();
    
    const mnemonic = client.wallet.exportWallet();
    const address = account.getUnusedAddress();
    console.log('Mnemonic:', mnemonic);
    console.log('Unused address:', address.address);
  } catch (e) {
    console.error('Something went wrong:', e);
  } finally {
    client.disconnect();
  }
}

createWallet();
Mnemonic: thrive wolf habit timber birth service crystal patient tiny depart tower focus
Unused address: yXF7LsyajRvJGX96vPHBmo9Dwy9zEvzkbh

🚧

Please save your mnemonic for the next step and for re-use in subsequent tutorials throughout the documentation.

What's Happening

Once we connect to Evonet, we output the newly generated mnemonic from client.wallet.exportWallet() and an unused address from the wallet from account.getUnusedAddress().

Next Step

Using the Evonet faucet at http://faucet.evonet.networks.dash.org/, send test funds to the "unused address" from the console output. You will need to wait until the funds are confirmed to use them. There is an Evonet block explorer running at http://insight.evonet.networks.dash.org:3001/insight/ which can be used to check confirmations.