整合介绍#

此文档的 PDF 格式 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.

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.

特殊交易#

Dash Core v0.13.x introduced the concept of “Special Transactions”. Please see the Transaction Type Integration Guide for more information.

特殊交易#

该文档的 PDF 版本 PDF

Dash 0.13.0及随后版本实现了 DIP002 特殊交易,它构建了一种新的交易类型来提供线上元数据从而帮助不同的共识机制。存在如下特殊交易类型:

发布

版本

类型

载荷大小

载荷

Payload JSON

交易目的

v0.13.0

3

0

标准交易

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

整合须知:

  1. DIP002 特殊交易 是 Dash Core v0.13.0 的一个基础部分,它引入一个新的交易版本和相关”载荷“到网络。

  2. Integrated Systems must be able to serialize and deserialize these new Transaction Types to accurately encode and decode Raw Transaction data.

  3. 从一个 向下兼容 的角度, 旧交易中包含的 4 字节 (32位) 版本 字段被分为两个字段: 版本类型 (均由两个字节构成)。

  4. Refer to the Special Transactions section of the dash developer reference for additional detail on these data types, e.g. <variable int>.

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

参考 v0.13.0 交易类型整合文档 (PDF) 来获取每个交易类型的可用实例。

即时支付#

本文档的 PDF 版本 PDF.

即时支付是Dash网络提供的交易功能,可以使用户安全接收并花费零确认的交易。在交易向网络广播时,网络会锁定每一笔有效交易。每个安全的交易都写入在随后的区块中,符合标准的区块链规则。

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.

此概念是对中本聪共识的扩展延伸。即时发送功能使收款方能够安全地立刻使用刚收到的交易资金,甚至在该交易还未被写入区块前就可以使用。

接收即时发送交易#

接收一个即时发送交易需要两个条件:

  1. 确认一个交易的”即时发送状态“

  2. 独立地调整区块确认数与”确认状态“。

”即时发送“状态通常可以通过与 dash 进程的直接连接来判断,ZMQ notification,或使用一个外部钱包通知脚本。

直接连接: 即时发送状态能通过使用 JSON-RPC 协议与 Dash 进程直接连接来判断。JSON 返回的交易”即时锁“属性反应了交易的状态,它被包含在如下命令:

ZMQ通知: 无论何时,当交易进入记忆池及交易被锁定在记忆池时,节点会进行ZMQ通知广播。可能的ZMQ通知列表可以在 这里 找到。

以下通知与识别交易及相对的即时锁有关:

  • zmqpubhashtx

  • zmqpubhashtxlock

  • zmqpubrawtx

  • zmqpubrawtxlock

钱包通知: Dash 进程被配置为只要观察到一个与钱包相关的即时发送交易时执行一个外部脚本。在配置文件 dash.conf 添加如下行:

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

This is typically used with a wallet that has been populated with watch-only addresses.

广播即时发送功能的交易信息#

自Dash v0.14.0在网络上创建长效节点仲裁链以来,仲裁链会默认锁定每一个有效交易,用户无需发送附加费用或额外操作。当每个交易输入被确认后,该交易即适用于即时支付。满足条件至少要符合以下一种情况:

  • 先前的交易是指由6个区块确认的交易输入

  • 先前的交易是由更早的即时支付锁确认

  • 包含先前交易的区块由 链锁锁定

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.

其它资源#

下列资源提供即时发送功能的更多信息,以便帮助用户全面地了解它的基础技术。

API 服务#

现有的多种应用程序接口服务可以帮助用户轻松、快捷地享受达世币网络的各项服务,其中包括:

  • 交易广播

  • 汇率

  • 货币兑换

  • 发票生成

应用程序接口的意义在于它可以免除用户为实现区块链交互而运行基础设施的麻烦。其中涉及的机制和流程包括:

  • 向达世币网络公告交易信息。

  • 通过HD钱包生成地址。

  • 通过WebHooks处理支付。

以定价模式和支持的功能为区分标准,市面上可供使用的设备有很多。下表罗列了常见的应用程序接口供应商、主打产品的性能和相关说明文档的链接。

Insight#

../../../_images/insight.png

dashevo/insight-api

开源 REST API 给你提供一个方便强大而简单的读取 Dash 网络和利用它构建你自己服务的方式。开始使用 Insight API 和 Insight UI 区块浏览器的实用手册 <insight-api>

  • 功能:交易的广播和WebSocket通知。

  • 定价:免费/开源

  • 说明文档的链接: dashevo/insight-api

BlockCypher#

../../../_images/blockcypher.png

https://www.blockcypher.com

BlockCypher是简单实用的JSON应用程序接口,可实现与区块链的交互,还可以借助HTTP或HTTPS在api.blockcypher.com域名上进行访问。

BitGo#

../../../_images/bitgo.png

https://www.bitgo.com

BitGo 提供一个简单有力的 RESTful API 和用户 SDK 来为你的应用整合数字货币钱包。同时支持 Dash 即时发送。

  • 功能:多用户签名 HD 钱包,钱包操作,WebSocket 和 WebHook 通知,保管解决方案

  • 价值模型: 每个 API 调用

  • Documentation: https://app.bitgo.com/docs/

ChainRider#

../../../_images/chainrider.png

https://www.chainrider.io

ChainRider是云服务平台,为数字货币的管理和探究提供一套REST应用程序接口。

  • 功能:区块链询问,事件通知,交易广播,支付处理,等。

  • 定价:免费试用,每次API调用时付费

  • Documentation: https://www.chainrider.io/docs/dash/

Blockmove#

../../../_images/blockmove.png

https://blockmove.io

Сryptocurrency wallet, merchant & API provider. Blockmove is a simple and easy way to start accepting payments in cryptocurrency.

  • Features: Non-custodial wallet, HD Wallet, High anonymity, Low fees. Private keys are not stored and are available only to the user.

  • Pricing Model: API - 0.3% for withdrawal transactions. Merchant - 1 year free, then $49/month

  • Documentation: https://docs.blockmove.io

NOWNodes#

../../../_images/nownodes.png

https://nownodes.io/

NOWNodes provides simple, fast, and secure RPC access to Dash-based full nodes. The low latency and high performance is of great use to researchers and businesses such as crypto miners or hardware wallet providers.

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 merchants to withdraw funds in Cryptocurrency or convert to fiat.

  • 合作商:aMember Pro、Arastta、Blesta、BoxBilling、Drupal、Ecwid、Hikashop、Magento、OpenCart、OSCommerce、PrestaShop、Tomato Cart、WooCommerce、Ubercart、XCart及ZenCart

  • 定价:收取0.5%的交易费用(https://www.coinpayments.net/help-fees)

  • 说明文档的链接: https://www.coinpayments.net/apidoc

软件开发工具包资源#

SDKs ( 软件开发包) 用来加速设计和开发一个 Dash 网络产品。这些资源可被用来与一个 API 提供者交互或通过构造交易与执行不同的钱包功能来创建独立应用。

达世币研发者指南#

../../../_images/dash-logo.png

https://dashcore.readme.io/

The Dash Developer Portal 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 and Dash Platform, either from source, from a pre-compiled executable or from Docker Hub.

NodeJS/JavaScript: Dashcore#

../../../_images/bitcore.png

https://bitcore.io

Dashcore是Bitcore的一个分叉。它以一个达世币全节点的方式运行 — 也就是说,应用程序将在P2P网络上直接运行。对于钱包应用的开发来说,研发者需要增加额外的索引,以便查询地址余额、交易历史记录和未经支出的额度。

NodeJS/JavaScript: DashJS#

DashJS allows you to transact on L1 or fetch/register documents on L2 within a single library, including management and signing of your documents.

PHP: Bitcoin-PHP#

Bit-Wasp/bitcoin-php

Bitcoin-PHP 是纯PHP 实现的支持 Dash 的 Bitcoin。

Python: PyCoin#

richardkiss/pycoin

PyCoin 是一个在处理 Bitcoin 与 Dash 时很有用的一系列工具。已在 Python 2.7, 3.6 和 3.7环境下测试。

Java: DashJ#

../../../_images/bitcoinj.png

dashevo/dashj

DashJ是一个适用于达世币协议的库。它可以维护钱包的运行,支持达世币的接收与发送(包括即时发送功能),同时还具备许多其它高级功能,而且还无需建立Dash Core钱包的副本。虽然它要借助Java才能实现各项功能,但它也可以借助Java虚拟机的兼容语言,其中包括Python和JavaScript中的示例。

Objective-C: Dash-Sync#

../../../_images/dash-logo.png

dashevo/dashsync-iOS

Dash-Sync 是一个用于 iOS 的 Objective-C Dash 区块链框架。它实现了所有与 Bitcoin 改进提案 (BIPs) 和 Dash 改进提案 (DIPs)相关的内容。

.NET: NBitcoin#

../../../_images/dash-logo.png

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也提供软件开发工具箱。

自动贩卖机#

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.

价格提示器#

You can add a simple price ticker widget to your website using the simple code snippet generator from CoinGecko.

除了上述应用和服务之外,CoinLib,WorldCoinIndexCryptonator上还提供了具备不同设计和类似功能的组件。此外,DashCentral也提供类似信息的应用程序接口。

二维码#

Many wallets can generate QR codes that are scannable 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.

  • Android版达世币钱包的用户可以点击 申请付款 ,然后点击放大二维码,并截图保存。

  • iOS版达世币钱包的用户可以向左滑动,找到 接收达世币 页面。此时,页面上将显示二维码和达世币地址,用户就可以截图保存图像了。

  • 如需生成任何达世币地址的二维码,用户可以访问 CWA 二维码生成器 页面并复制粘贴地址,以便生成二维码的图像。