Integration Overview¶
This documentation is also available as a PDF.
Dash Core v0.13.x is a “fork” of Bitcoin and shares many common functionalities. Key differences relate to existing JSON-RPC commands which have been customized to support unique functionalities such as InstantSend.
- General Information: Dash is a “Proof of Work” network and is
similar to Bitcoin.
- Block Time: ~2.6 Minutes per Block
- Github Source: https://github.com/dashpay/dash
- Latest Release: https://github.com/dashpay/dash/releases
- JSON-RPC Interface: The majority of commands are unchanged from Bitcoin making integration into existing systems relatively straightforward. Note that the following commands have been modified to support InstantSend:
- Block Hashing Algorithm: Dash uses the “X11” algorithm in place of SHA256 used in Bitcoin. It’s important to note, however, that this only affects the hashing of the Block itself. All other internals utilize SHA256 hashes (transactions, merkle root, etc) which allows for most existing libraries to work in the Dash ecosystem.
- Special Transactions: Dash Core v0.13.x introduces the concept of “Special Transactions”. Please see the Transaction Type Integration Guide for more information.
v0.13.0 Integration Notes¶
This documentation is also available as a PDF.
Dash 0.13.0 implements DIP002 Special Transactions, which form a basis for new transaction types that provide on-chain metadata to assist various consensus mechanisms. The following special transaction types exist:
Release | Version | Type | Payload Size | Payload | Payload JSON | Transaction Purpose |
---|---|---|---|---|---|---|
v0.13.0 | 3 | 0 | n/a | n/a | n/a | Standard Transaction |
v0.13.0 | 3 | 1 | <variable int> | <hex> | proRegTx | Masternode Registration |
v0.13.0 | 3 | 2 | <variable int> | <hex> | proUpServTx | Update Masternode Service |
v0.13.0 | 3 | 3 | <variable int> | <hex> | proUpRegTx | Update Masternode Operator |
v0.13.0 | 3 | 4 | <variable int> | <hex> | proUpRevTx | Masternode Revocation |
v0.13.0 | 3 | 5 | <variable int> | <hex> | cbTx | Masternode List Merkle Proof |
v0.13.0 | 3 | 6 | <variable int> | <hex> | qcTx | Quorum Commitment |
Integration notes:
- DIP002 Special Transactions are a foundational component of Dash Core v0.13.0 and introduce a new Transaction Version and related “Payload” to the network.
- Integrated Systems must be able to serialize and deserialize these new Transaction Types in order to accurately encode and decode Raw Transaction data.
- From a backwards compatibility
perspective, the 4 byte (32-bit)
version
field included in Legacy Transactions has been split into two fields:version
andtype
(each consisting of 2 bytes). - Refer to the Special Transactions section of the dash developer reference for additional detail on these data types, e.g. <variable int>.
- InstantSend
status and Payload JSON (e.g.
proRegTx
) is included in the JSON-RPC response, please note that this data is not part of the calculated hash and is provided for convenience.
See the v0.13.0 transaction types integration documentation (PDF) for worked examples of each transaction type.
InstantSend Overview¶
This documentation is also available as a PDF.
InstantSend is a feature provided by the Dash network that allows for zero-confirmation transactions to be safely accepted by Merchants and other service providers. All InstantSend Transactions are secured for 25 blocks by the “Masternode Network” at the moment of broadcast. The transaction is mined into the next block in accordance with standard blockchain principles.
InstantSend is enabled by the Masternode Network which comprises approximately 4,800 masternode servers. These nodes are differentiated from standard nodes by having proven ownership of 1,000 Dash. One responsibility that is appointed to this special type of server is to perform “Transaction Locking”, also known as InstantSend.
This concept works as an extension to network consensus. When an “InstantSend” transaction occurs the network goes through an extra validation process which examines the following two properties of the transaction:
- Input Maturity: the network will require all inputs to have at least 6 confirmations.
- Input Composition: the number of inputs in use dictates fee
requirements.
- 1 - 4 inputs: per-kB fee of 0.00001 DASH using Automatic InstantSend.
- 5+ inputs: per-input fee of 0.0001 DASH is required.
Assuming the Input Maturity and Input Composition requirements are met, the network will “lock” the inputs related to this transaction for 25 blocks. Transactions carrying 4 or fewer inputs are referred to as a “simple transaction” and carry no extra fee.
Automatic InstantSend¶
Dash Core v0.13.x introduces the process of Automatic InstantSend. Any transaction which is classified as a “simple transaction” will automatically be broadcast as an InstantSend transaction when using standard transaction broadcast endpoints.
InstantSend vs. Standard Transactions¶
The term “InstantSend” is used to describe a standard transaction that has been provided additional assurances by the Masternode Network. As a result, and from an integration perspective, there is no technical difference between the two types of transactions.
The most notable difference relates to the way that confirmation policy is applied within an integrated system. The receiving system must be aware of InstantSend Status in order to safely apply transaction confirmation policies that are enabled using this technology.
Receiving InstantSend Transactions¶
Receiving an InstantSend Transaction introduces two requirements:
- The ability to determine the “InstantSend Status” of a given transaction.
- The ability to adjust “Confirmation Status” independently of block confirmation.
InstantSend Status is typically determined through direct connection with the dash daemon, ZMQ notification, or through the usage of an external wallet notification script.
Direct Connection: InstantSend Status can be identified through direct connection with the Dash daemon using JSON-RPC protocol. The “instantlock” attribute of the JSON response reflects the status of the transaction and is included in the following commands:
- getrawmempool
- getmempoolancestors
- getmempooldescendants
- getmempoolentry
- getrawtransaction
- decoderawtransaction
- gettransaction
- listtransactions
- listsinceblock
Wallet Notification: The Dash Core Daemon can be configured to execute an external script whenever an InstantSend transaction relating to that wallet is observed. This is configured by adding the following line to the dash.conf file:
instantsendnotify=/path/to/concurrent/safe/handler %s
This is typically used with a wallet that has been populated with watch-only addresses.
Broadcasting InstantSend Transactions¶
Automatic InstantSend introduces two requirements into the system being integrated:
- The ability to evaluate the number of inputs in a given transaction.
- The ability to apply an increased fee-level in cases of 5+ inputs.
In many cases an integrated system will already contain logic intended to keep transaction fees to a minimum by optimizing input usage. If this is true, and it can be assumed that only “simple transactions” are being formed, no additional development effort is required.
In cases where this is not possible or will be unknown, the integrated system should be able to calculate a fee based on the number of inputs being used to form the transaction. This per-input fee of 0.0001 DASH must be applied in order for the transaction to be successfully broadcast as an InstantSend. In these cases, it’s important to note that the “instantsend” flag must be set as “true” when issuing the sendrawtransaction command, e.g.:
sendrawtransaction "hexstring" false true
Additional Resources¶
The following resources provide additional information about InstantSend and are intended to help provide a more complete understanding of the underlying technologies.
API Services¶
This documentation is also available as a PDF.
Several API services exist to facilitate quick and easy integration with the Dash network for services including:
- Transaction broadcasting
- Exchange rates
- Currency conversion
- Invoice generation
API Services are typically leveraged to eliminate that requirement of running your own infrastructure to support blockchain interactions. This includes mechanisms such as:
- Forming and Broadcasting a Transaction to the network.
- Address generation using HD Wallets.
- Payment Processing using WebHooks.
There are a variety of options for supporting these methods, with the key differentiator being the pricing model included and supported features. The following list of API Providers attempts to outline these key features/differentiators and also includes a link to related documentation.
Insight¶
https://github.com/dashevo/insight-api
The open-source Insight REST API provides you with a convenient, powerful and simple way to read data from the Dash network and build your own services with it. A practical guide to getting started with the Insight API and Insight UI block explorer is available here.
- Features: Transaction Broadcast, WebSocket Notifications.
- Pricing Model: Free / Open Source
- Documentation: https://github.com/dashevo/insight-api
BlockCypher¶
BlockCypher is a simple, mostly RESTful JSON API for interacting with blockchains, accessed over HTTP or HTTPS from the api.blockcypher.com domain.
- Features: Transaction Broadcast, HD Wallet / Address Generation, WebSocket and WebHook Callbacks as well as Payment Forwarding. BlockCypher does not handle Private Keys.
- Pricing Model: Per API Call, 5000 Requests -> $85.00 per month (https://accounts.blockcypher.com/plans)
- Documentation: https://www.blockcypher.com/dev/dash/
BitGo¶
BitGo provides a simple and robust RESTful API and client SDK to integrate digital currency wallets with your application. Support for Dash InstantSend is available.
- Features: Multi-Signature HD Wallets, Wallet Operations, WebSocket and WebHook Notifications, Custody Solutions
- Pricing Model: Per API Call
- Documentation: https://www.bitgo.com/api/v2/
ChainRider¶
ChainRider is a cloud service providing a set of REST APIs for digital currency management and exploration.
- Features: Blockchain queries, Event Notifications, Transaction Broadcast, Payment Processing, etc.
- Pricing Model: Free trial, pay per API call
- Documentation: https://www.chainrider.io/docs/dash
GoCoin¶
The GoCoin platform makes taking Dash as easy as installing a plugin. Payment processing is already implemented for every major shopping platform. GoCoin is focused on helping merchants in privacy-related niches and specific industries, and handles all transaction risk for all payments from your customers.
- Features: Invoicing, Exchange Rates, WebHook Callbacks. GoCoin holds Private Keys on their server allowing the merchant to withdraw funds in Cryptocurrency or convert to Fiat.
- Integrations: WooCommerce, Magento, Prestashop, VirtueMart, ZenCart, OpenCart, OSCommerce, UberCart, nopCommerce, WHMCS, NATS4, Shopify.
- Pricing Model: 1% Processing Fee (https://gocoin.com/fees)
- Documentation: https://gocoin.com/docs
CoinPayments¶
CoinPayments is an integrated payment gateway for cryptocurrencies such as Dash. Shopping cart plugins are available for all popular webcarts used today. CoinPayments can help you set up a new checkout, or integrate with your pre-existing checkout.
- Features: Invoicing, Exchange Rates, WebHook Callbacks. CoinPayments holds Private Keys on their server allowing merchant to withdraw funds in Cryptocurrency or convert to Fiat.
- Integrations: aMember Pro, Arastta, Blesta, BoxBilling, Drupal, Ecwid, Hikashop, Magento, OpenCart, OSCommerce, PrestaShop, Tomato Cart, WooCommerce, Ubercart, XCart, ZenCart
- Pricing Model: 0.5% Processing Fee (https://www.coinpayments.net/help-fees)
- Documentation: https://www.coinpayments.net/apidoc
SDK Resources¶
This documentation is also available as a PDF.
SDKs (Software Development Kits) are used to accelerate the design and development of a product for the Dash Network. These resources can either be used to interface with an API provider or for the creation of standalone applications by forming transactions and/or performing various wallet functions.
Dash Developer Guide¶
https://dash-docs.github.io/en/developer-guide
The Dash Developer Guide aims to provide the information you need to understand Dash and start building Dash-based applications. To make the best use of this documentation, you may want to install the current version of Dash Core, either from source or from a pre-compiled executable.
- Documentation: https://dash-docs.github.io/en/developer-guide
NodeJS/JavaScript: Dashcore¶
Dashcore is a fork of Bitcore and operates as a full Dash node — your apps run directly on the peer-to-peer network. For wallet application development, additional indexes have been added into Dash for querying address balances, transaction history, and unspent outputs.
- Platform: NodeJS / Javascript
- Documentation: https://bitcore.io/api/lib
- Repository lib: https://github.com/dashevo/dashcore-lib
- Repository node: https://github.com/dashevo/dashcore-node
- See also: Insight API
PHP: Bitcoin-PHP¶
https://github.com/snogcel/bitcoin-php
Bitcoin-PHP is an implementation of Bitcoin with support for Dash using mostly pure PHP.
- Platform: PHP
- Documentation: https://github.com/Bit-Wasp/bitcoin-php/blob/master/doc/Introduction.md
- Repository: https://github.com/snogcel/bitcoin-php
Python: PyCoin¶
https://github.com/DeltaEngine/pycoin
PyCoin is an implementation of a bunch of utility routines that may be useful when dealing with Bitcoin and Dash. It has been tested with Python 2.7, 3.6 and 3.7.
- Platform: Python
- Documentation: https://pycoin.readthedocs.io/en/latest/
- Repository: https://github.com/DeltaEngine/pycoin
- See also: JSON-RPC Utilities
Java: DashJ¶
https://github.com/HashEngineering/dashj
DashJ is a library for working with the Dash protocol. It can maintain a wallet, send/receive transactions (including InstantSend) without needing a local copy of Dash Core, and has many other advanced features. It’s implemented in Java but can be used from any JVM compatible language: examples in Python and JavaScript are included.
- Platform: Java
- Documentation: https://bitcoinj.github.io/getting-started
- Repository: https://github.com/HashEngineering/dashj
- Example application: https://github.com/tomasz-ludek/pocket-of-dash
Objective-C: Dash-Sync¶
https://github.com/dashevo/dashsync-iOS
Dash-Sync is an Objective-C Dash blockchain framework for iOS. It implements all most relevant Bitcoin Improvement Proposals (BIPs) and Dash Improvement Proposals (DIPs).
- Platform: iOS
- Repository: https://github.com/dashevo/dashsync-iOS
.NET: NBitcoin¶
https://github.com/MetacoSA/NBitcoin
NBitcoin is the most complete Bitcoin library for the .NET platform, and has been patched to include support for Dash. It implements all most relevant Bitcoin Improvement Proposals (BIPs) and Dash Improvement Proposals (DIPs). It also provides low level access to Dash primitives so you can easily build your application on top of it.
- Platform: .NET
- Documentation: https://programmingblockchain.gitbooks.io/programmingblockchain/content/
- Repository: https://github.com/MetacoSA/NBitcoin
- See also: JSON-RPC Utilities
BlockCypher¶
BlockCypher also offers client SDKs.
- Platform: Ruby, Python, Java, PHP, Go, NodeJS
- Repositories: https://www.blockcypher.com/dev/dash/#blockcypher-supported-language-sdks
Vending Machines¶
Community member moocowmoo has released code to help merchants build their own vending machine and set it up to receive Dash InstantSend payments. The Dashvend software can also be used to create any sort of payment system, including point-of-sale systems, that can accept InstantSend payments.
Price Tickers¶
You can add a simple price ticker widget to your website using the simple code snippet generator from CoinGecko.
Similar widgets with different designs are available from CoinLib, WorldCoinIndex and Cryptonator, while an API providing similar information is available from DashCentral.
QR Codes¶
Many wallets are capable of generating QR codes which can be scanned to simplify entry of the Dash address. Printing these codes or posting the on your website makes it easy to receive payment and tips in Dash, both online and offline.
- In Dash Core, go to the Receive tab, generate an address if necessary, and double-click it to display a QR code. Right click on the QR code and select Save Image to save a PNG file.
- In Dash for Android, tap Request Coins and then tap the QR code to display a larger image. You can screenshot this to save an image.
- In Dash for iOS, swipe to the left to display the Receive Dash screen. A QR code and address will appear. You can screenshot this to save an image.
- To generate a QR code from any Dash address, visit CWA QR Code Generator and simply paste your Dash address to generate an image.