Technischer Guide

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-Dienste

Diese Dokumentation ist auch als englischsprachiges PDF verfügbar.

Mehrere API-Dienste können dazu verwendet werden, eine der folgenden Funktionen des Dash-Netzwerks mit einer Plattform zu verbinden:

  • Transaktionsübermittlung
  • Kurse
  • Währungsumtausch
  • Anfrageerstellung

API-Dienste werden im Normalfall verwendet, damit auf eine eigene Infrastruktur zum Zugriff auf die Blockchain verzichtet werden kann. Dazu gehören Mechanismen wie:

  • Transaktion erstellen und an das Netzwerk übermitteln
  • Adresserstellung über HD-Wallets
  • Zahlungsverarbeitung über WebHooks

Es gibt mehrere Arten, auf derartige Funktionen zuzugreifen, wobei diese sich hauptsächlich in der Preisgestaltung und in der Reichweite der Möglichkeiten unterscheiden. Die folgende Liste an API-Diensten versucht die Unterschiede herauszustellen und verweist auf weiterführende Dokumentationen zu den einzelnen Diensten.

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 bietet eine RESTful JSON API, um mit der Blockchain zu interagieren. Der Zugriff ist über HTTP oder HTTPS durch die Adresse api.blockcypher.com möglich.

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

Durch die GoCoin-Plattform kann Dash mithilfe eines simplen Plugins akzeptiert werden. Dieses kann in die meisten der großen Shop-Plattformen integriert werden. GoCoin bietet seine Dienste auch Unternehmen an, die an einem hohen Maß an Privatsphäre interessiert sind. Alle Transaktionsrisiken werden von GoCoin getragen.

  • Funktionen: Abrechnung, Währungsrechner, WebHook Rückmeldung. GoCoin sichert die Private Keys der Händler. Kryptowährungen können entweder ausgezahlt oder in Fiat umgewandelt werden.
  • Integrationen: WooCommerce, Magento, Prestashop, VirtueMart, ZenCart, OpenCart, OSCommerce, UberCart, nopCommerce, WHMCS, NATS4, Shopify
  • Preisgestaltung: 1% der Transaktion (https://gocoin.com/fees)
  • Dokumentation: https://gocoin.com/docs

CoinPayments

../_images/coinpayments.png

https://www.coinpayments.net

CoinPayments ist ein Zahlungs-Gateway, der neben Dash mit verschiedenen Kryptowährungen kompatibel ist. PlugIns sind für viele verschiedene Software-Anbieter verfügbar. CoinPayments kann selbst einen Checkout gestalten, aber auch in einen bestehenden Checkout integriert werden.

  • Funktionen: Abrechnung, Währungsrechner, WebHook Rückmeldung. GoCoin sichert die Private Keys der Händler. Kryptowährungen können entweder ausgezahlt oder in Fiat umgewandelt werden.
  • Integrationen: aMember Pro, Arastta, Blesta, BoxBilling, Drupal, Ecwid, Hikashop, Magento, OpenCart, OSCommerce, PrestaShop, Tomato Cart, WooCommerce, Ubercart, XCart, ZenCart
  • Preisgestaltung: 0,5% der Transaktion (https://www.coinpayments.net/help-fees)
  • Dokumentation: https://www.coinpayments.net/apidoc

SDK-Ressourcen

Diese Dokumentation ist ebenfalls als englischsprachiges PDF verfügbar.

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

Der Dash Developer Guide soll alle Informationen bereitstellen, die notwendig sind, um Dash zu verstehen und darauf basierende Applikationen zu schaffen. Um diese Dokumentation am besten zu verwenden ist es empfehlenswert die aktuelle Version der Dash Core Wallet installiert zu haben.

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 ist die umfassendste Bitcoin Library für die .NET-Plattform und wurde dahingehend geupdated, dass Dash unterstützt werden kann. Alle wichtigen Bitcoin Improvement Proposals (BIPs) und Dash Improvement Proposals (DIPs) sind integriert. Zudem kann auf alle Dash-Grundlagen zugegriffen werden, wodurch einfache Applikationen darauf aufbauen können.

BlockCypher

../_images/blockcypher.png

https://www.blockcypher.com

Auch BlockCypher bietet SDKs an.

GoCoin

../_images/gocoin.png

https://gocoin.com

InstantSend

Diese Dokumentation ist ebenfalls als englischsprachiges PDF verfügbar.

InstantSend ist ein Feature des Dash-Netzwerks, welches Transaktionen mit 0 Bestätigungen erlaubt, die von Händlern und Dienstleistungsanbietern gefahrlos akzeptiert werden können. Diese Transaktionen werden durch das Masternode-Netzwerk gesichert, wobei der Mechanismus das Risiko von „Double Spend“ eliminiert, da bereits transferierte Guthaben auf Protokollebene gesperrt werden.

InstantSend-Transaktionen vs. normale Transaktionen

Aus Integrationsperspektive gibt es nur wenige Unterschiede zwischen Transaktionen mit InstantSend und solchen ohne. Beide Typen werden gleich geformt und signiert. Der wichtigste Unterschied findet sich in der Gebührenstruktur und den Anforderungen einer InstantSend-Eingabe.

  1. Fee Structure: InstantSend utilizes a “per-input” fee of 0.0001 DASH per Input.
  2. Inputanforderungen: Alle Inputs einer InstantSend-Transaktion müssen mindestens 6 mal bestätigt worden sein.

Sollte eine Transaktion diesen Anforderungen nicht entsprechen, wird sie als normale Transaktion durchgeführt.

InstantSend-Transaktionen empfangen

InstantSend-Transaktionen werden auf die gleiche Art und Weise gehandhabt wie normale Transaktionen. Sie werden also typischerweise durch JSON-RPC, Insight API oder ein internes Benachrichtigungsskript bzw. einen Benachrichtigungsdienst auf Serverebene konfiguriert.

  1. JSON-RPC: Die folgenden RPC-Befehle beinhalten Informationen, die sich auf InstantSend beziehen. In der Antwort findet sich ein „InstantLock“-Feld, welches den Status einer Transaktion wiedergibt. Dieser true/false (boolesche) Wert zeigt an, ob InstantSend stattgefunden hat oder nicht.

    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: Durch die Insight API können InstantSend-Transaktionen erkannt werden und per WebSocket an den Client weitergeleitet werden. Die API kann zudem manuell dazu verwendet werden Transaktionsinformationen wie den InstantSend-Status abzufragen.

    1. Web Socket: https://github.com/dashevo/insight-api#web-socket-api
    2. Transaction API: https://github.com/dashevo/insight-api#instantsend-transactions
  3. Mitteilungsskript: Der Dash Core Daemon kann so konfiguriert werden, dass ein externes Skript mitteilt, wenn eine InstantSend-Transaktion beobachtet werden konnte. Dies wird dadurch konfiguriert, dass die folgende Zeile zu der Datei dash.conf hinzugefügt wird:

    instantsendnotify=/path/to/concurrent/safe/handler %s

    Nur Adressen, die in eine Wallet importiert wurden, werden hierdurch auf InstantSend-Transaktionen hin überprüft.

InstantSend-Transaktionen übermitteln

InstantSend-Transaktionen werden fast genauso wie normale Transaktionen verfasst und übermittelt. Wenn die Transaktion den InstantSend-Gebühren entspricht und die Eingabevoraussetzungen erfüllt sind, kann sie mit JSON-RPC oder Insight API übermittelt werden.

  1. JSON-RPC: Durch den RPC-Befehle „SendRawTransactions“ kann eine Transaktion mit InstantSend übermittelt werden. Für diesen Befehl ist es wichtig, dass die beiden optionalen Parameter „true“ ausgeben.

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

    Weitere Informationen: https://dash-docs.github.io/en/developer-reference#sendrawtransaction

  2. Insight API: InstantSend-Transaktionen können mit der Hilfe von Insight API übermittelt werden. Dafür ist es lediglich notwendig die Transaktion mit diesem Befehl zu versenden:

    Weitere Informationen: https://github.com/dashevo/insight-api#instantsend-transaction

Zusätzliche Ressourcen

Die folgenden Ressourcen bieten weitergehende Informationen über InstantSend und sind dafür gedacht ein besseres Verstehen der zugrundeliegenden Technologie zu ermöglichen.

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.

Preisticker

Ein einfaches Preisticker-Widget kann mit der Hilfe von CoinGecko in jede Seite implementiert werden.

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.