.. meta:: :description: Technical guides for merchants using Dash. API and SDK resources. :keywords: dash, merchants, payment processor, API, SDK, insight, blockcypher, instantsend, python, .NET, java, javascript, nodejs, php, objective-c, vending machines .. _integration: ==================== Integration Overview ==================== This documentation is also available as a `PDF `__. `Dash Core `__ is a fork of `Bitcoin Core `__ and shares many common functionalities. Key differences are found in existing JSON-RPC commands which have been customized to support unique functionalities such as InstantSend. The Basics ========== Dash is a Proof of Work network, and similar to Bitcoin, Dash has a mining network but uses a different block hashing algorithm. Dash serves as an improvement of Bitcoin's shortcomings by offering a robust solution for instant transactions, enhancing user privacy, and offering a self-sustainable decentralized governance model. - 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: - `getrawmempool `__ - `getmempoolancestors `__ - `getmempooldescendants `__ - `getmempoolentry `__ - `getrawtransaction `__ - `gettransaction `__ - `listtransactions `__ - `listsinceblock `__ 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 introduced the concept of “Special Transactions”. Please see the `Transaction Type Integration Guide `__ for more information. .. _integration-special-transactions: Special Transactions ==================== This documentation is also available as a `PDF `__. Dash 0.13.0 and higher implement `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 | | | proRegTx | `Masternode Registration `__ | +---------+---------+------+----------------+---------+--------------+-----------------------------------------------------------------------------------------------------------------------------------+ | v0.13.0 | 3 | 2 | | | proUpServTx | `Update Masternode Service `__ | +---------+---------+------+----------------+---------+--------------+-----------------------------------------------------------------------------------------------------------------------------------+ | v0.13.0 | 3 | 3 | | | proUpRegTx | `Update Masternode Operator `__ | +---------+---------+------+----------------+---------+--------------+-----------------------------------------------------------------------------------------------------------------------------------+ | v0.13.0 | 3 | 4 | | | proUpRevTx | `Masternode Revocation `__ | +---------+---------+------+----------------+---------+--------------+-----------------------------------------------------------------------------------------------------------------------------------+ | v0.13.0 | 3 | 5 | | | cbTx | `Masternode List Merkle Proof `__ | +---------+---------+------+----------------+---------+--------------+-----------------------------------------------------------------------------------------------------------------------------------+ | v0.13.0 | 3 | 6 | | | 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 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. Refer to the `Special Transactions `__ section of the dash developer reference for additional detail on these data types, e.g. . 5. :ref:`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. .. _integration-instantsend: InstantSend =========== 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 and re-spent. The network attempts to lock the inputs of every valid transaction when it is broadcast to the network. Every secured transaction is included in a following block in accordance with standard blockchain principles. InstantSend is enabled by the Masternode Network which comprises approximately 5,000 masternode servers. These nodes are differentiated from standard nodes by having proven ownership of 1,000 Dash, making the network `highly resistant to Sybil attacks `__. Masternodes form `Long-Living Masternode Quorums (LLMQs) `__, which are responsible for providing near-instant certainty to the transaction participants that the transaction inputs cannot be respent, and that the transaction will be included in a following block instead of a conflicting transaction. This concept works as an extension to Nakamoto Consensus. InstantSend enables transacted funds to be immediately and securely respent by the recipient, even before the transaction is included in a block. Receiving InstantSend Transactions ---------------------------------- Receiving an InstantSend Transaction introduces two requirements: 1. The ability to determine the “InstantSend Status” of a given transaction. 2. 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 `__ - `gettransaction `__ - `listtransactions `__ - `listsinceblock `__ **ZMQ Notification:** Whenever a transaction enters the mempool and whenever a transaction is locked in the mempool, ZMQ notifications can be broadcast by the node. A list of possible ZMQ notifications can be found `here `__. The following notifications are relevant for recognizing transactions and their corresponding instantlocks: - zmqpubhashtx - zmqpubhashtxlock - zmqpubrawtx - zmqpubrawtxlock **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. .. _is-broadcast: Broadcasting InstantSend Transactions ------------------------------------- Since Dash v0.14.0 established LLMQs on the Dash network, quorums will now attempt to lock every valid transaction by default without any additional fee or action by the sending wallet or user. A transaction is eligible for InstantSend when each of its inputs is considered confirmed. This is the case when at least one of the following circumstances is true: - the previous transaction referred to by the input is confirmed with 6 blocks - the previous transaction is confirmed through an older InstantSend lock - the block containing the previous transaction is `ChainLocked `__ When checking the previous transaction for an InstantSend lock, it is important to do this on mempool (non-mined) transactions. This allows chained InstantSend locking. Additional Resources -------------------- The following resources provide additional information about InstantSend and are intended to help provide a more complete understanding of the underlying technologies. - `InstantSend Technical Information `__ - `InstantSend Developer Documentation `__ - `DIP0010: LLMQ InstantSend `__ - `Product Brief: Dash Core v0.14 Release `__