{"id":70788,"date":"2018-07-16T16:58:31","date_gmt":"2018-07-16T16:58:31","guid":{"rendered":"https:\/\/wp.dash.org\/uncategorized\/dash-devnets\/"},"modified":"2021-09-23T15:02:32","modified_gmt":"2021-09-23T15:02:32","slug":"dash-devnets","status":"publish","type":"post","link":"https:\/\/wp.dash.org\/blog\/dash-devnets\/","title":{"rendered":"Dash Devnets"},"content":{"rendered":"
Dash developer networks explained<\/p>\n
With the release of Dash Core 12.3, Dash added support for a great new feature \u2014 named devnets. Devnets are developer networks that combine some aspects of testnet<\/a> (the global and public testing network) and some aspects of regtest<\/a> (the local-only regression testing mode that provides controlled block generation). Unlike testnet, multiple independent devnets can be created and coexist without interference. Each one is identified by a name which is hardened into a \u201cdevnet genesis\u201d block that is automatically positioned at height 1. Validation rules ensure that a node from devnet=test1 cannot accept blocks from devnet=test2. This is done by checking the expected devnet genesis block. Additionally, the devnet name is put into the sub-version of the version message so a node connecting to the wrong network will immediately be disconnected.<\/p>\n Eventually, there will be many public and\/or private devnets that all 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.<\/p>\n As you can guess from the description, devnets are primarily useful as a development tool. They provide significantly more flexibility than testnet since they can be created for specific purposes and operated in controlled settings. We expect that devnets will be used in situations that require the ability to do things like test code base \/ protocol changes that are incompatible with mainnet\/testnet, fully control block generation on a live network, and restrict network access to specific parties.<\/p>\n Examples for this include:<\/p>\n Devnets have already been utilized by Dash developers to test possible future enhancements on devnet networks containing 3000+ nodes.<\/p>\n Fortunately, devnets are easy to configure. The steps below will describe the process of setting up a devnet. The devnet name in the instructions (\u201cdashblog\u201d) is a currently active devnet that should remain accessible for the next few weeks.<\/p>\n Configuring a new devnet consists of starting Dash Core with several configuration (config file or command line) options enabled. The primary parameters are:<\/p>\n An example Dash Core configuration file for a devnet named \u201cdashblog\u201d is shown below (it also defines the RPC user and password):<\/p>\n To start the devnet defined in the configuration file, run dashd with the Dash will also create a dedicated subfolder inside the default Dash data directory. This subfolder is specific to the devnet and won\u2019t conflict with other Dash networks. It contains all the usual data needed by Dash, for example the blockchain data and the wallet data.<\/p>\n The A devnet consisting of a single node is not very interesting, so multiple nodes are started using the same parameters. These nodes can be run on the same network or distributed across the internet.<\/p>\n After starting multiple nodes with the same devnet parameters, an initial The command for connecting to another devnet peer is:<\/p>\n Alternatively, a known peer can be defined in the Dash Core configuration file as shown below:<\/p>\n Once a peer has been successfully connected to, it should reconnect automatically in the future. As additional nodes are added to a devnet, the <\/a> Once the devnet is successfully bootstrapped and multiple nodes are able to communicate with each other, it is ready to be used. Blocks are generated using the This example cron would create 1 new block every 5 minutes:<\/p>\n Otherwise, running the At this point, you\u2019re ready to begin using the devnet for its intended purposes. You can send transactions, set up masternodes, do PrivateSend mixing, etc. Use of masternode-dependent features like InstantSend and Privatesend will require setting up masternodes on your devnet. The process is identical to mainnet\/testnet masternode setup<\/a>; however, you will need to generate coins via the Now go have some fun and let us know what interesting use cases you discover!<\/p>\n A repository containing a couple basic Linux shell scripts for setting up a devnet can be found here \u2014 https:\/\/github.com\/thephez\/dash-devnet-setup<\/a>. The repository also contains an example configuration file<\/a> that can be used to connect to the \u201cdashblog\u201d devnet used as the example.<\/p>\n","protected":false},"excerpt":{"rendered":"Dash developer networks explained What are devnets? With the release of Dash Core 12.3, Dash added support for a great new feature \u2014 named devnets. Devnets are developer networks that combine some aspects of testnet (the global and public testing network) and some aspects of regtest (the local-only regression testing mode that provides controlled block…","protected":false},"author":59,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[290],"tags":[225,222,220],"class_list":["post-70788","post","type-post","status-publish","format-standard","hentry","category-blog","tag-blockchain","tag-cryptocurrency","tag-dash"],"acf":[],"yoast_head":"\nWhy are devnets useful?<\/h2>\n
\n
How can I create a devnet?<\/h2>\n
Start Dash Core with devnet parameters<\/h3>\n
\n
devnet<\/code> \u2014 Defines the name of the network<\/li>\n
port<\/code> \u2014 Port to listen for P2P connections (default: 19999<\/em>)<\/li>\n
rpcport<\/code> \u2014 Port to listen for RPC connections (default: 19998<\/em>)<\/li>\n<\/ul>\n
devnet=dashblog
port=19999
rpcport=19998<\/span>rpcuser=myuser
rpcpassword=mypassword<\/span>sporkaddr=yXDzZ3eu3GCAHcTCZvgFVkL16qguZJmtww<\/span># FYI, this is not the correct spork key for the dashblog devnet, this just serves as an example
sporkkey=cTwYCkbKw4EneV6aNG4XAJ6qNGr7zrQEp1NRFSRKf8Ay5BhRBbSX<\/span><\/pre>\n-conf<\/code> option set to the full path of your configuration file:<\/p>\n
dashd -conf=\/home\/user\/.dashcore\/mydevnet.conf<\/code><\/p>\n
sporkaddr<\/code> and
sporkkey<\/code> options define the keys required to issue sporks in the devnet. These are represented in the same form as normal Dash addresses and exported private keys. Just use the
getnewaddress<\/a><\/code> and
dumpprivkey<\/a><\/code> RPC APIs with a devnet or regtest node to generate keys for your own devnet.<\/p>\n
Establish an initial connection<\/h3>\n
addnode<\/a><\/code> command must be run to establish connections between the nodes for the first time. This is because the DNS seed discovery mechanism used for mainnet\/testnet does not apply to the ad hoc nature of devnets.<\/p>\n
dash-cli -conf=\/home\/user\/.dashcore\/mydevnet.conf addnode \u201cdevnet.thephez.com:19999\u201d \u201cadd\u201d<\/code><\/p>\n
# Also include the general devnet options from above here
...<\/span># Hard-coded first node
addnode=devnet.thephez.com:19999<\/span><\/pre>\ngetaddr<\/a><\/code>\/
addr<\/a><\/code> P2P messages will enable nodes to discover other peers on the network in the same way that mainnet and testnet do.<\/p>\n
Use the devnet<\/h3>\n
generate<\/a><\/code> RPC (the same controlled way as a regtest network). This can be done by manually calling the RPC or in an automated way (e.g. cron, etc.) depending on the development environment requirements.<\/p>\n
*\/5 * * * * dash-cli -conf=\/home\/user\/.dashcore\/mydevnet.conf generate 1<\/code><\/p>\n
generate<\/a><\/code> command manually will accomplish the same thing:<\/p>\n
dash-cli -conf=\/home\/user\/.dashcore\/mydevnet.conf generate 1<\/code><\/p>\n
generate<\/a><\/code> RPC (described above) to get the masternode collateral. The network size is only limited by the resources you have available. If you run into unexpected issues, you can reset the devnet by shutting down all nodes, deleting their data directories (
~\/.dashcore\/devnet-<devnetname><\/code> by default), and restarting them.<\/p>\n
References<\/h2>\n