整合介绍#

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

其它资源#

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