了解达世币主节点

主节点曾是达世币的专属,但它现在已经像一项技术一样在各个区块链上流行起来了。本章节将为用户介绍主节点的原则、机制和它为达世币网络提供的服务。

简单来说,主节点就是拥有整个达世币区块链的服务器,它确保了达世币网络上完成区块验证等任务时的最基本的性能,同时还提供了匿名发送和即时发送等特色服务。主节点持有人提供的是有偿服务,其中涉及的理念是服务量证明。这是在矿工依据工作量证明来捍卫区块链安全之外的又一理念。主节点通过投票决定预算提案的执行与否。每个主节点有权为递交到预算提案系统上的各项提案投一票(赞成票、反对票或弃权)。

任何个人都可以运行达世币主节点。主节点的目标是提高去中心化程度,从而避免某个人或某一群体掌控大量的主节点。不过,为了防范不必要的主节点或莽撞的持有人,达世币网络要求个人存入1000个达世币用以证明资格,能够持有一个主节点。这笔资金不必绑定在主节点上,但是必须存在达世币网络上并向整个网络公开。一旦持有人将资金提现或支出,主节点将停止运行而关联的区块奖励也将停止支付。

Masternodes are paid by the network for the PrivateSend, InstantSend and governance services they provide. 45% of the block reward is paid out to the masternodes, 45% to miners and 10% to the budget. In practice, half of the reward from a normal block goes to the miner and half to the masternode. Then, every 16,616 blocks (approximately 30.29 days), a superblock is created that contains the entire 10% payout to the budget proposal winners. Masternodes are selected for payment in each block (approximately every 2.6 minutes) from a deterministic masternode list, and moved to the back of the list after payment. As more masternodes are created, the duration between payments increases. If the collateral behind a masternode is spent, or if a masternode stops providing services to the network for more than one hour, it is removed from the list until normal service resumes. In this way, masternodes are given incentive to provide efficient and reliable services to the network.

达世币拥有很多具有完整达世币区块链的服务器,并且这些服务器还能为达世币网络服务,这一点非常重要。得益于区块奖励机制,达世币不存在主节点数量不足的风险,并且研发人员还能以此为依托推行新的去中心化功能。这正是达世币的真正优势所在 - 达世币区块链以奖励机制确保主节点 24x7 为网络服务,同时达世币还能有效地实现扩容并以更高效的方式部署各项服务。更多的主节点就意味着更强大、更安全的达世币网络。

As of November 2018, the Dash network has over 5000 masternodes located in over 45 countries and hosted on over 140 ISPs. The block reward is approximately 3.34 Dash, so the selected masternode receives 1.67 Dash per payment or approximately 6 Dash per month. The block reward decreases by 7.14% approximately once per year, so the annual earnings for a masternode owner is approximately 7% of the collateral, and will decrease over time as calculated here. See this tool to calculate real-time payment rates, and this site for various real-time statistics on the masternode network.

DIP003 Masternode Changes

Dash 0.13.0 implements DIP003, which introduces several changes to how a Dash masternode is set up and operated. A list of available documentation appears below:

Important concepts and changes:

  • It is possible to upgrade an existing masternode in-place without starting a new server and without moving your 1000 DASH collateral.
  • A masternode was previously “started” using the masternode start-alias command based on a masternode.conf file. Under DIP003, this file is no longer used, and masternodes are “registered” instead of “started”. Masternodes begin offering services when a ProRegTx special transaction containing a particular key is written to the blockchain.
  • As before in masternode.conf, the ProRegTx references the transaction id (txid) and index holding the collateral. The IP address and port of the masternode are also defined in this transaction.
  • The ProRegTx contains 2 Dash addresses (also called public keys) and one BLS public key, which represent 3 different roles in the masternode and define update and voting rights. The keys are:
    1. ownerKeyAddr: This is a Dash address (public key) controlled by the masternode owner. It is different from the address used for the collateral. Because the owner uses the private key associated with this address to issue ProUpRegTx transactions, it must be unique for each masternode.
    2. operatorPubKey: This is the BLS public key of the masternode operator. Only the operator is allowed to issue ProUpServTx transactions. Because the operator key is used during live masternode operation to sign masternode-related P2P messages, quorum-related messages and governance trigger votes, the BLS key must be unique for each masternode.
    3. votingKeyAddr: This is a Dash address (public key) used for proposal voting. Votes signed with this key are valid while the masternode is in the registered set.
  • Masternode payments were previously sent to the address holding the collateral. Under DIP003, the owner should specify a different address to receive payments in the ProRegTx. The owner may optionally specify a non-zero percentage as payment to a separate masternode operator, if applicable.
  • The masternode configuration can later be updated using ProUpServTx, ProUpRegTx and ProUpRevTx transactions. See Updating Masternode Information in DIP003 and Updating Masternode Information in this documentation for more details.
  • All functions related to DIP003 will only take effect once Spork 15 is enabled on the network. Until then, it is necessary to set up the masternode following the old process and then work through the upgrade procedure. In this state, the masternode will continue to function in compatibility mode, and all DIP003 related functions, such as payments to a separate address or percentage payments to operators, will not yet have any effect. The ownerKeyAddr and votingKeyAddr must also be identical until Spork 15 is enabled.

The process of setting up or upgrading a masternode is as follows:

  1. Set up your server and operating system
  2. Install the Dash software and synchronize the blockchain
  3. Generate a BLS key pair and enter the private key on the masternode
  4. Prepare a ProRegTx transaction
  5. Sign the ProRegTx transaction
  6. Submit the signed ProRegTx transaction

Step 1 can be omitted if you have an existing server. Steps 2 and 3 require direct access to the masternode. Steps 3 and 4 require access to a Dash Wallet (or DMT). Step 5 requires access to the wallet actually holding the collateral. Step 6 requires a Dash balance to pay the transaction fee.

主节点 vs. 挖矿

和比特币及其它加密数字货币一样,达世币以包含所有交易的分布式帐本为基础,这些帐本也称区块链。达世币和比特币区块链由于共识机制的存在得到了保障,这种共识机制被称作工作量证明(PoW)。矿工通过专用的设备来解决难题,在难题解决后,他们有权向区块链添加新的区块。如果运行软件的其他用户认为难题已经得到了恰当的解决,那么新的区块将会被添加到区块链上,而矿工也将得到区块奖励。

和比特币相比,达世币有所不同,因为它拥有一个双层网络。第二层级的网络由主节点(也称全节点)提供支持,从而具备财务隐私(匿名发送)、即时交易(即时发送)、去中心化管理以及预算提案系统。正因为第二层级非常重要,因此主节点将从区块奖励中分得一部分。具体来说,区块奖励的划分如下所示:45%分给矿工,45%分给主节点持有人,剩余的10%则划拨给预算提案系统(由超级块按月创建)。

主节点系统也称服务量证明(PoSe),因为主节点的实质正是为网络提供关键的服务。事实上,整个达世币网络都由主节点监督,它们有权驳回由矿工创建的不合格的区块。如果矿工尝试占有全部的区块奖励或运行旧版的达世币软件,那么主节点网络就会孤立该区块,使它无法添加到区块链上。

简而言之,矿工组成了网络的第一层级,为用户提供资金的发送和接收服务并防止双花支付的发生。主节点则构成了网络的第二层级,为达世币与众不同的性能提供支持。主节点不参与挖矿活动,因此挖矿的设备并不能充当主节点。要想持有主节点,用户必须持有1000达世币作为”保证金”。这笔保证金始终由持有人全权掌控,并且可以被持有人自由支配。换言之,保证金不会以任何方式予以锁定。不过,一旦保证金被转移或支付,对应的主节点将会下线并停止接收区块链奖励。

有关支付的逻辑

Masternode paymentss in Dash version 0.13.0 are entirely deterministic and based on a simple list sort algorithm. For documentation of version 0.12.0 payment logic, see the legacy masternode payment documentation. Dash version 0.13.0 implements DIP003 and defines two sets of masternodes.

  1. The full set, which contains all registered masternodes that have not spent their collateral funding transactions.
  2. The valid set, a subset of the full set which contains all masternodes which are not marked as Proof of Service (PoSe) banned.

Each masternode in the set of valid masternodes is identified by the block at which it was last paid. If it has never received payment or was banned for failing to meet the PoSe requirements, then the block at which it was first registered or at which PoSe was restored is used instead. The list is sorted in ascending order, and the first entry is paid. If this results in more than one masternode, then the hash of the masternode ProRegTx is sorted to break the tie.

仲裁连的选取

InstantSend transactions in Dash version 0.13.0 are secured using a consensus of deterministically selected masternodes. This set of masternodes is informally termed a quorum and must be in a majority agreement, at least six out of ten, for a successful lock of the transaction inputs. Multiple quorums are self-selected for each input in an InstantSend transaction using the mathematical distance between the hash of each input and of the set of masternode funding transactions.

接收到即时发送交易锁定申请的各个主节点需要比较主节点交易与锁定申请的哈希值。在证实输入资金未经支出后,距离该哈希值最远的十个主节点将公告对交易锁定的确认。

所有的即时发送输入都必须至少拥有6个成熟的确认,否则,交易将被驳回。

主节点的相关要求

  • 用户必须存入1000个达世币作为保证金才能有资格运营主节点。用户可以借助Poloniex、Bittrex、Kraken、LiveCoin和Shapeshift等交易平台获取达世币。
  • 运行Linux的服务器或虚拟专用服务器。最新版的指南使用的是Ubuntu 16.04 LTS。推荐用户使用Vultr、DigitalOcean或其它性能优越的虚拟专用服务器。通常情况下,只需达到平均规格的服务器就能满足需求了,但达世币的发展将对服务器的性能提出更高的要求。
  • 专用IP地址通常随服务器/虚拟专用服务器一起提供。
  • 额外付出的时间(和精力):主节点曾经需要复杂的设置,但是dashman等工具现在已经大大简化了设置过程。

除了1000达世币的保证金之外,主节点还在硬件方面提出了最低要求。以12.1版本为例,主节点对硬件的最低要求包括:

  最低配 推荐
CPU 1x 1 GHz 1x 2 GHz
RAM 2 GB 4 GB
Disk 20 GB 40 GB
Network 400 GB/mth 1 TB/mth

达世币的带宽使用约为每个月300-500 GB,并且这一数字还将随着网络的发展而增长。

Dash Evolution

The exact hardware requirements for Dash Evolution masternodes have yet to be determined, although some pointers can be taken from the roadmap and this blog post. It should be possible to run Dash masternodes on normal VPS servers until the block size reaches approximately 20 MB, after which custom hardware such as GPUs and eventually ASICs may be required.