Technical Guides

Dash Wallet Integration

This documentation is also available as a PDF.

Dash Core is a fork of Bitcoin and the majority of functionality included in the Dash Core Daemon can be integrated in a similar manner. Key differences relate to customizations to existing JSON-RPC commands to support unique functionalities such as InstantSend. These differences, as well as more general information, are summarized below.

  1. General Information: Dash is a “Proof of Work” blockchain with attributes similar to that of Bitcoin.

    1. Block Time: ~2.6 Minutes per Block
    2. Blockchain Confirmations: 6 Confirmations (or 1 in the case of InstantSend)
    3. Github Source: https://github.com/dashpay/dash
    4. Release Link: https://github.com/dashpay/dash/releases
  2. JSON-RPC Interface: The majority of Bitcoin JSON-RPC commands are unchanged making integration into existing systems relatively straightforward. For a complete listing of RPC commands see the Developer Guide.

    It’s worth noting that several key Transaction-related JSON-RPC commands have been modified to support InstantSend through the addition of an “InstantLock” field and are listed below:

    1. GetTransaction
    2. ListTransactions
    3. ListSinceBlock
  3. 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.

  4. Supporting Libraries: Due to the aforementioned differences in Hashing Algorithm only minor adjustments are required before using Bitcoin libraries on the Dash network. The most popular libraries have already been ported to Dash which has enabled support for most major programming languages. These resources are outlined in the SDK Resources section of this document.

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 will 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:

  1. 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.
  2. Integrated Systems must be able to serialize and deserialize these new Transaction Types in order to accurately encode and decode Raw Transaction data.
  3. From a backwards compatibility perspective, the 4 byte (32-bit) version field included in Legacy Transactions has been split into two fields: version and type (each consisting of 2 bytes).
  4. 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.

Legacy transaction structure:

{
  "txid": <string>,
  "size": <int>,
  "version": 2,
  "locktime": 0,
  "vin": [],
  "vout": [ … ]
}

Updated transaction structure:

{
  "txid": <string>,
  "size": <int>,
  "version": 3,
  "type": <int>,
  "locktime": 0,
  "vin": [ … ],
  "vout": [ … ],
  "extraPayloadSize": <variable int>,
  "extraPayload": …
}

See the Special Transactions developer documentation for additional detail on these data types, e.g. <variable int>. See the v0.13.0 transaction types integration documentation (PDF) for worked examples of each transaction type.

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
  • Tỷ giá giao dịch
  • 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

../_images/insight.png

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.

BlockCypher

../_images/blockcypher.png

https://www.blockcypher.com

BlockCypher is a simple, mostly RESTful JSON API for interacting with blockchains, accessed over HTTP or HTTPS from the api.blockcypher.com domain.

ChainRider

../_images/chainrider.png

https://www.chainrider.io

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

../_images/gocoin.png

https://gocoin.com

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

../_images/coinpayments.png

https://www.coinpayments.net

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 services.

Dash Developer Guide

../_images/dash-logo.png

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.

NodeJS/JavaScript: Bitcore (Dashcore)

../_images/bitcore.png

https://bitcore.io

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.

PHP: Bitcoin-PHP

https://github.com/Bit-Wasp/bitcoin-php

Bitcoin-PHP is an implementation of Bitcoin with support for Dash using mostly pure PHP.

Python: PyCoin

https://github.com/richardkiss/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.

Java: DashJ

../_images/bitcoinj.png

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.

.NET: NBitcoin

../_images/dash-logo.png

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.

BlockCypher

../_images/blockcypher.png

https://www.blockcypher.com

BlockCypher also offers client SDKs.

GoCoin

../_images/gocoin.png

https://gocoin.com

InstantSend

This documentation is also available as a PDF.

InstantSend is a feature provided by the Dash network that allows for 0-confirmation transactions to be safely accepted by Merchants and other service providers. Secured by the Masternode Network, this mechanism eliminates the risk of a “Double Spend” by locking transaction inputs for a given transaction at a protocol level.

InstantSend Transactions vs. Standard Transactions

From an integration perspective there are only minor differences between an InstantSend Transaction and a Standard Transaction. Both transaction types are formed in the same way and are signed using the same process; the key difference is the fee structure and input requirements for InstantSend.

  1. Fee Structure: InstantSend utilizes a “per-input” fee of 0.0001 DASH per Input.
  2. Input Requirements: All inputs for an InstantSend transaction must have at least 6 confirmations.

In the event that a given transaction does not meet both criteria it will revert to a standard transaction.

Receiving InstantSend Transactions

InstantSend transactions are handled in the same way as a Standard Transaction, typically through JSON-RPC, Insight API, or an internal notification script / service that is configured at a server level.

  1. JSON-RPC: The following RPC commands will include InstantSend-related information. Within the response you’ll find an “InstantLock” field the status of a given Transaction. This true/false (boolean) value will indicate whether an InstantSend has been observed.

    1. GetTransaction: https://dash-docs.github.io/en/developer-reference#gettransaction
    2. ListTransactions: https://dash-docs.github.io/en/developer-reference#listtransactions
    3. ListSinceBlock: https://dash-docs.github.io/en/developer-reference#listsinceblock
  2. Insight API: Insight API can be used to detect InstantSend transactions and to push notifications to clients using WebSockets. The API can also be manually polled to retrieve Transaction information including InstantSend status.

    1. Web Socket: https://github.com/dashevo/insight-api#web-socket-api
    2. Transaction API: https://github.com/dashevo/insight-api#instantsend-transactions
  3. Script Notify: 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

    Note that only addresses imported to the wallet will be monitored for InstantSend Transactions.

Broadcasting InstantSend Transactions

InstantSend Transactions can be constructed and broadcast using an approach similar to Standard Transactions. Provided the InstantSend Fee Structure and Input Requirements are met, an InstantSend can be broadcast using JSON-RPC or Insight API as a Raw Transaction.

  1. JSON-RPC: The “SendRawTransaction” RPC command can be utilized to broadcast a raw transaction using InstantSend. When utilizing this command be sure to set both optional parameters as “true”

    sendrawtransaction "hexstring" ( allowhighfees instantsend ) sendrawtransaction "hexstring" true true

    More Information: https://dash-docs.github.io/en/developer-reference#sendrawtransaction

  2. Insight API: Raw Transactions can also be broadcast as an InstantSend using Insight API. In this case all that is required is to POST the raw transaction using the /tx/sendix route.

    More Information: https://github.com/dashevo/insight-api#instantsend-transaction

Additional Resources

The following resources provide additional information about InstantSend and are intended to help provide a more complete understanding of the underlying technologies.

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 ticket widget to your website using the simple code snippet generator from CoinGecko.

Similar widgets with different designs are available from CoinLibWorldCoinIndex 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.