Dash Masternode
Masternode setup with Dash Platform services
The purpose of this tutorial is to walk through the steps necessary to set up a masternode with Dash Platform services.
Prerequisites
- Docker (v20.10.0+) and docker-compose (v1.25.0+) installed
- An installation of NodeJS (v16, NPM v8.0+)
The following is not necessary for setting up a local network for development, but is helpful if setting up a testnet masternode:
- Access to a Linux system configured with a non-root user (guide)
Dashmate
Use NPM to install dashmate globally in your system:
npm install -g dashmate
More comprehensive details of using the dashmate tool can be found in the dashmate README.
Local Network
Dashmate can be used to create a local network on a single computer. This network contains multiple nodes to mimic conditions and features found in testnet/mainnet settings.
Dashmate local networks use the regtest network type so layer 1 blocks can be easily mined as needed.
Setup
Run the following command to start the setup wizard, then accept the default values at each step to create a local network:
dashmate setup local
Example output of the setup wizard showing important information:
β Set configuration preset
β Set configuration preset
β Set configuration preset
β Set configuration preset
β Set configuration preset
β Set the number of nodes
β Enable debug logs
β Set the core miner interval
β Create local group configs
βΊ Masternode Reward Shares Private Key: tprv8ZgxMBicQKsPfMKp9kkj3KPokivdyZFzviddYq5uum1pMwtvx7cr4551gg8JsAMD6k8GWm1CJesVp7ZvGSYVD8ujT6hFmbn6wmm2UnA6KWw
β Create local_1 config
β Create local_2 config
β Create local_3 config
β Create local_seed config
β Save configs
β Configure Core nodes
β Configure Tenderdash nodes
Make a note of the key information displayed during setup as they it be required in the future.
Operation
Once the setup completes, start/stop/restart the network via the following commands:
dashmate group start
dashmate group stop
dashmate group restart
The status of the network's nodes can be check via the group status command:
dashmate group status
Testing DAPI
At this point DAPI will respond to requests. Test this by issuing a simple curl request to one of the JSON-RPC endpoints as shown below:
curl --request POST \
--url http://127.0.0.1:3000/ \
--header 'content-type: application/json' \
--data '{
"method":"getBestBlockHash",
"id":1,
"jsonrpc":"2.0",
"params":{}
}'
Mining Dash
During development, it may be necessary to obtain Dash to create and topup identities. This can be done using the dashmate wallet mint
command. First obtain an address to fund via the Create and Fund a Wallet tutorial and then mine Dash to it as shown below:
# Stop the devnet first
dashmate group stop
# Mine 10 Dash to a provided address
dashmate wallet mint 10 --address=<your address> --config=local_seed
# Restart the devnet
dashmate group start
# Stop the devnet first
dashmate group:stop
# Mine 10 Dash to a random address/key
# The address and private key will be displayed
dashmate wallet:mint 10 --config=local_seed
# Restart the devnet
dashmate group:start
Example output of dashmate wallet mint 10 --address=yYqfdpePzn2kWtMxr9nz22HBFM7WBRmAqG --config=local_seed
:
β Generate 10 dash to address
β Start Core
β Use specified address yYqfdpePzn2kWtMxr9nz22HBFM7WBRmAqG [SKIPPED]
β Generate β10 dash to address yYqfdpePzn2kWtMxr9nz22HBFM7WBRmAqG
βΊ Generated 172.59038279 dash
β Wait for balance to confirm
β Stop Core
Using the network
Once the address is funded, you can begin creating identities, data contracts, etc. and experimenting with Dash Platform. The other tutorials in this section will help you get started.
To make the Dash SDK connect to your local network, set the
network
option to'local'
as shown in the code example below.Note: Prior to Platform v0.22, it was also necessary to set the DPNS contract ID; however, system contract IDs are now static so this is no longer necessary as of pull request 192.
const clientOpts = {
network: 'local',
...
};
const client = new Dash.Client(clientOpts);
...
Testnet Masternode Setup
βοΈAdvanced Topic
Running a masternode requires familiarity with Dash Platform services. Improper configuration may impact testing so please exercise caution if running a masternode.
To setup a testnet masternode, please refer to the comprehensive documentation of the process as described here. The following video also details how to complete the process.
Full Platform Node
A full node that with all Platform services can be started by simply running the setup command with the node type setup parameter set to
fullnode
and then starting the node.dashmate setup testnet fullnode dashmate start
Remote Development Network
Connecting to a remote development network
In order to connect to a remote devnet (e.g. one run by Dash Core Group), please use one of the methods described in the Connect to a Devnet section.
For development we recommend using either a local network created via dashmate as described above or using Testnet. While configuring a remote development network is possible using the Dash network deployment tool, it is beyond the scope of this documentation. For details regarding this tool, please refer to the GitHub repository.
Updated about 2 years ago