Dash Core

Dash Core Developer Documentation

Welcome to the Dash Core developer documentation. You'll find guides and documentation to help you start working with Dash Core as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Guides

Testing Applications

Dash Core provides testing tools designed to let developers test their applications with reduced risks and limitations.

Testnet

When run with no arguments, all Dash Core programs default to Dash's main network (mainnetmainnet - The original and main network for Dash transactions, where duffs have real economic value.). However, for development, it's safer and cheaper to use Dash's test network (testnettestnet - A global testing environment in which developers can obtain and spend duffs that have no real-world value on a network that is very similar to the Dash mainnet.) where the duffsduffs - Denominations of Dash value, usually measured in fractions of a dash but sometimes measured in multiples of a duff. One dash equals 100,000,000 duffs. spent have no real-world value. Testnet also relaxes some restrictions (such as standard transaction checks) so you can test functions which might currently be disabled by default on mainnetmainnet - The original and main network for Dash transactions, where duffs have real economic value..

To use testnet, use the argument -testnet with dash-cli, dashd or dash-qt or add testnet=1 to your dash.conf file as described earlier. To get free duffs for testing, check the faucets listed below. Some are community supported and due to potentially frequent Testnet changes, one or more of them may be unavailable at a given time:

Testnet is a public resource provided for free by members of the community, so please don't abuse it.

Regtest Mode

For situations where interaction with random peerspeers - A computer that connects to the Dash network. and blocksblocks - One or more transactions prefaced by a block header and protected by proof of work. Blocks are the data stored on the block chain. is unnecessary or unwanted, Dash Core's regression test moderegression test mode - A local testing environment in which developers can almost instantly generate blocks on demand for testing events, and can create private duffs with no real-world value. (regtest mode) lets you instantly create a brand-new private block chainblock chain - A chain of blocks with each block referencing the block that preceded it. The most-difficult-to-recreate chain is the best block chain. with the same basic rules as testnet---but one major difference: you choose when to create new blocks, so you have complete control over the environment.

Many developers consider regtest mode the preferred way to develop new applications. The following example will let you create a regtest environment after you first configure dashd.

> dashd -regtest -daemon
Dash Core server starting

Start dashd in regtest mode to create a private block chain.

## Dash Core
dash-cli -regtest generate 101

Generate 101 blocks using a special RPC which is only available in regtest mode. This takes less than a second on a generic PC. Because this is a new block chain using Dash's default rules, the first blocks pay a block rewardblock reward - The amount that miners may claim as a reward for creating a block. Equal to the sum of the block subsidy (newly available duffs) plus the transactions fees paid by transactions included in the block. of 500 dash. Unlike mainnetmainnet - The original and main network for Dash transactions, where duffs have real economic value., in regtest mode only the first 150 blocks pay a reward of 500 dash. However, a block must have 100 confirmationsconfirmations - A score indicating the number of blocks on the best block chain that would need to be modified to remove or modify a particular transaction. A confirmed transaction has a confirmation score of one or higher. before that reward can be spent, so we generate 101 blocks to get access to the coinbase transactioncoinbase transaction - The first transaction in a block. Always created by a miner, it includes a single coinbase. from block #1.

dash-cli -regtest getbalance
500.00000000

Verify that we now have 500 dash available to spend.

You can now use Dash Core RPCs prefixed with dash-cli -regtest.

Regtest wallets and block chain state (chainstate) are saved in the regtest subdirectory of the Dash Core configuration directory. You can safely delete the regtest subdirectory and restart Dash Core to start a new regtest. (See the Developer Examples Introduction for default configuration directory locations on various operating systems. Always back up mainnet wallets before performing dangerous operations such as deleting.)

Devnet Mode

Overview

Developer networks (devnets) have some aspects of testnet and some aspects of regtest. Unlike testnet, multiple independent devnets can be created and coexist without interference. Each one is identified by a name which is hardened into a "devnet genesis" block, which is automatically positioned at height 1. Validation rules will ensure that a nodenode - A computer that connects to the Dash network. from devnet=test1 never be able to accept blocks from devnet=test2. This is done by checking the expected devnet genesis blockgenesis block - The first block in the Dash block chain..

The genesis block of the devnet is the same as the one from regtest. This starts the devnet with a very low difficultydifficulty - How difficult it is to find a block relative to the difficulty of finding the easiest possible block. The easiest possible block has a proof-of-work difficulty of 1., allowing quick generation of a sufficient balance to create a masternodemasternode - A computer that provides second-tier Dash functionality (InstantSend, PrivateSend, decentralized governance). Masternodes are incentivized by receiving part of the block reward, but must hold 1000 Dash as collateral to prevent sybil attacks..

The devnet name is put into the sub-version of the version message. If a node connects to the wrong networknetwork - The Dash P2P network which broadcasts transactions and blocks., it will immediately be disconnected.

Configuration

To use devnet, use the argument -devnet=<name> with dash-cli, dashdor dash-qt or add devnet=<name> to your dash.conf file as described earlier.

Devnets must be assigned both -port and -rpcport unless they are not listening (-listen=0). It is possible to run a devnet on a private (RFC1918) network by using the -allowprivatenet=1 argument.

Example devnet start command:

> dashd -devnet=mydevnet -rpcport=18998 -port=18999 -daemon
Dash Core server starting

You can now use Dash Core RPCs prefixed with dash-cli -devnet=<name>.

📘

Devnet-exclusive Options

Devnets can use 3 devnet-specific options to enable quickly mining large amounts of Dash. This enables quick establishment of test masternodes, etc. The following dash.conf excerpt shows these configuration options in use:

# First 1000 blocks mined with the lowest difficulty (like regtest)
# and first 500 blocks mined with a block subsidity multiplied by 10
# This allows immediate MN registration (DIP3 activates on block 2)
minimumdifficultyblocks=1000
highsubsidyblocks=500
highsubsidyfactor=10

Management

Devnet wallets and block chain state (chainstate) are saved in the devnet-<name> subdirectory of the Dash Core configuration directory. You can safely delete the devnet-<name> subdirectory and restart Dash Core to start a new devnet. (See the Developer Examples Introduction for default configuration directory locations on various operating systems. Always back up mainnet wallets before performing dangerous operations such as deleting.)

Eventually, there may be many public and/or private devnets that vary in size and function. Providing the correct devnet name and the seed node of the network will be all that is required to join.

An old devnet can be easily dropped and a new one started just by destroying all nodes and recreating them with a new devnet name. This works best in combination with an automated deployment using something like Ansible and Terraform. The Dash Network Deploy tool provides a way to do this (currently a work-in-progress at an early development stage).

Updated 4 months ago



Testing Applications


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.