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

DIP003 Masternode Changes

Important concepts and changes:

  • It is possible to upgrade an existing masternode in-place without starting a new server and without moving your 2500 PYRK 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 Pyrk 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 Pyrk 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 Pyrk address (public key) used for proposal voting. Votes signed with the corresponding private 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 Pyrk 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 Pyrk Wallet (or DMT). Step 5 requires access to the wallet actually holding the collateral. Step 6 requires a Pyrk balance to pay the transaction fee.

Masternodes vs. mining

Pyrk, like Bitcoin and most other cryptocurrencies, is based on a decentralized ledger of all transactions, known as a blockchain. This blockchain is secured through a consensus mechanism; in the case of both Pyrk and Bitcoin, the consensus mechanism is Proof of Work (PoW). Miners attempt to solve difficult problems with specialized computers, and when they solve the problem, they receive the right to add a new block to the blockchain. If all the other people running the software agree that the problem was solved correctly, the block is added to the blockchain and the miner is rewarded.

Pyrk works a little differently from Bitcoin, however, because it has a two-tier network. The second tier is powered by masternodes (Full Nodes), which enable financial privacy (PrivateSend), instant transactions (InstantSend), and the decentralized governance and budget system. Because this second tier is so important, masternodes are also rewarded when miners discover new blocks. The breakdown is as follows: 45% of the block reward goes to the miner, 45% goes to masternodes, and 10% is reserved for the budget system (created by superblocks every month).

The masternode system is referred to as Proof of Service (PoSe), since the masternodes provide crucial services to the network. In fact, the entire network is overseen by the masternodes, which have the power to reject improperly formed blocks from miners. If a miner tried to take the entire block reward for themselves or tried to run an old version of the Pyrk software, the masternode network would orphan that block, and it would not be added to the blockchain.

In short, miners power the first tier, which is the basic sending and receiving of funds and prevention of doublespending. Masternodes power the second tier, which provide the added features that make Pyrk different from other cryptocurrencies. Masternodes do not mine, and mining computers cannot serve as masternodes. Additionally, each masternode is “secured” by 2500 PYRK. Those PYRK remain under the sole control of their owner at all times, and can still be freely spent. The funds are not locked in any way. However, if the funds are moved or spent, the associated masternode will go offline and stop receiving rewards.

Payment logic

Masternode payments in Pyrk 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. Pyrk 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, identified by its registration transaction ID, is associated with 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 service was restored is used instead. The list is sorted in ascending order by this block height and ProRegTx hash (as a tie breaker in case two masternodes were registered in the same block), and the first entry is selected for payment.

Pyrk 0.13 Upgrade Procedure

It is highly recommended to first read at least the list of changes before continuing in order to familiarize yourself with the new concepts in DIP003. This documentation describes the upgrade procedure in two steps:

  1. Update the masternode software
  2. Register the DIP003 masternode

Step 1 should be done immediately as soon as Pyrk 0.13.0 is released. Once miners have updated and DIP003 has activated on the network, it will become possible to complete Step 2 and register a DIP003 masternode. After enough masternodes have completed this step, Spork 15 will be enabled and all new network functions will take effect.

Masternode Software Update

Begin by updating the Pyrk software on your masternode.

Manual update

To update Pyrk manually, log in to your server using ssh or PuTTY. If your crontab contains an entry to automatically restart Pyrkd, invoke crontab -e and comment out the appropriate line by adding the # character. It should look something like this:

# * * * * * pidof pyrkd || ~/.pyrk/pyrkd

Then stop Pyrk running:

~/.pyrk/pyrk-cli stop

Visit the GitHub releases page and copy the link to the latest x86_64-linux-gnu version. Go back to your terminal window and enter the following command, pasting in the address to the latest version of Pyrk Core by right clicking or pressing Ctrl + V:

cd /tmp
wget https://github.com/pyrk/pyrk/releases/download/v0.13.0/pyrk-0.13.0-x86_64-linux-gnu.tar.gz

Extract the compressed archive and copy the new files to the directory:

Restart Pyrk:

~/.pyrk/pyrkd

You will see a message reading “Pyrk Core server starting”. We will now update Sentinel:

cd ~/.pyrk/sentinel/
git checkout master
git pull

Finally, uncomment the line to automatically restart Pyrk in your crontab by invoking crontab -e again and deleting the # character.

The Pyrk software on the masternode is now updated. Since Pyrk 0.13 also updates the protocol version, it is necessary to issue a masternode start command from an updated Pyrk Core wallet to keep your masternode in the payment list during the transition period. See the legacy documentation for more details. After your masternode software is updated, it is necessary to wait until enough miners upgrade for DIP003 to activate before you can continue with the DIP003 masternode registration process below. You can track DIP003 activation progress in our telegram room.

Masternode Registration from Pyrk Core

This documentation describes the procedure to register an existing masternode for the DIP003 masternode list if the collateral is held in the Pyrk Core software full wallet. It is not possible to issue the registration transactions if DIP003 is not yet active. The commands are shown as if they were entered in the Pyrk Core GUI by opening the console from Tools > Debug console, but the same result can be achieved on a masternode by entering the same commands and adding the prefix ~/.pyrk/pyrk-cli to each command.

Generate a BLS key pair

A public/private BLS key pair is required for the operator of the masternode. If you are using a hosting service, they will provide you with their public key, and you can skip this step. If you are hosting your own masternode, generate a BLS public/private keypair as follows:

bls generate

{
  "secret": "565950700d7bdc6a9dbc9963920bc756551b02de6e4711eff9ba6d4af59c0101",
  "public": "01d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127"
}

These keys are NOT stored by the wallet and must be kept secure, similar to the value provided in the past by the masternode genkey command.

Add the private key to your masternode configuration

The public key will be used in following steps. The BLS secret key must be entered in the pyrk.conf file on the masternode. This allows the masternode to watch the blockchain for relevant Pro*Tx transactions, and will cause it to start serving as a masternode when the signed ProRegTx is broadcast by the owner (final step below). Log in to your masternode using ssh or PuTTY and edit the configuration file on your masternode as follows:

nano ~/.pyrk/pyrk.conf

The editor appears with the existing masternode configuration. Add this line to the end of the file, replacing the key with your BLS secret key generated above:

masternodeblsprivkey=565950700d7bdc6a9dbc9963920bc756551b02de6e4711eff9ba6d4af59c0101

Do not delete your old masternodeprivkey, since this is still needed while the network is in transition to the new list. Press enter to make sure there is a blank line at the end of the file, then press Ctrl + X to close the editor and Y and Enter save the file. We now need to restart the masternode for this change to take effect. Enter the following commands, waiting a few seconds in between to give Pyrk Core time to shut down:

~/.pyrk/pyrk-cli stop
sleep 5
~/.pyrk/pyrkd

We will now prepare the transaction used to register a DIP003 masternode on the network.

Prepare a ProRegTx transaction

First, we need to get a new, unused address from the wallet to serve as the owner address. This is different to the collateral address. It must also be used as the voting address if Spork 15 is not yet active. Generate a new address as follows:

getnewaddress

yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz

Then either generate or choose an existing second address to receive the owner’s masternode payouts. It is also possible to use an address external to the wallet:

getnewaddress

ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy

You can also optionally generate and fund a third address to pay the transaction fee. If you selected an external payout address, you must specify a fee source address. Either the payout address or fee source address must have enough balance to pay the transaction fee, or the final register_submit transaction will fail.

The private keys to the owner and fee source addresses must exist in the wallet submitting the transaction to the network. If your wallet is protected by a password, it must now be unlocked to perform the following commands. Unlock your wallet for 5 minutes:

walletpassphrase yourSecretPassword 300

We will now prepare an unsigned ProRegTx special transaction using the protx register_prepare command. This command has the following syntax:

protx register_prepare collateralHash collateralIndex ipAndPort ownerKeyAddr
  operatorPubKey votingKeyAddr operatorReward payoutAddress (feeSourceAddress)

Open a text editor such as notepad to prepare this command. Replace each argument to the command as follows:

  • collateralHash: The txid of the 2500 Pyrk collateral funding transaction
  • collateralIndex: The output index of the 2500 Pyrk funding transaction
  • ipAndPort: Masternode IP address and port, in the format x.x.x.x:yyyy
  • ownerKeyAddr: The new Pyrk address generated above for the owner/voting address
  • operatorPubKey: The BLS public key generated above (or provided by your hosting service)
  • votingKeyAddr: The new Pyrk address generated above, or the address of a delegate, used for proposal voting
  • operatorReward: The percentage of the block reward allocated to the operator as payment
  • payoutAddress: A new or existing Pyrk address to receive the owner’s masternode rewards
  • feeSourceAddress: An (optional) address used to fund ProTx fee. payoutAddress will be used if not specified.

Note that the operator is responsible for specifying their own reward address in a separate update_service transaction if you specify a non-zero operatorReward. The owner of the masternode collateral does not specify the operator’s payout address.

Example (remove line breaks if copying):

protx register_prepare
  2c499e3862e5aa5f220278f42f9dfac32566d50f1e70ae0585dd13290227fdc7
  1
  140.82.59.51:9999
  yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz
  01d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127
  yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz
  0
  ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy

Output:

{
  "tx": "030001000191def1f8bb265861f92e9984ac25c5142ebeda44901334e304c447dad5adf6070000000000feffffff0121dff505000000001976a9149e2deda2452b57e999685cb7dabdd6f4c3937f0788ac00000000d1010000000000c7fd27022913dd8505ae701e0fd56625c3fa9d2ff47802225faae562389e492c0100000000000000000000000000ffff8c523b334e1fad8e6259e14db7d05431ef4333d94b70df1391c601d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127ad8e6259e14db7d05431ef4333d94b70df1391c600001976a914adf50b01774202a184a2c7150593442b89c212e788acf8d42b331ae7a29076b464e61fdbcfc0b13f611d3d7f88bbe066e6ebabdfab7700",
  "collateralAddress": "yPd75LrstM268Sr4hD7RfQe5SHtn9UMSEG",
  "signMessage": "ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy|0|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|54e34b8b996839c32f91e28a9e5806ec5ba5a1dadcffe47719f5b808219acf84"
}

Next we will use the collateralAddress and signMessage fields to sign the transaction, and the output of the tx field to submit the transaction.

Sign the ProRegTx transaction

Now we will sign the content of the signMessage field using the private key for the collateral address as specified in collateralAddress. Note that no internet connection is required for this step, meaning that the wallet can remain disconnected from the internet in cold storage to sign the message. In this example we will again use Pyrk Core, but it is equally possible to use the signing function of a hardware wallet. The command takes the following syntax:

signmessage collateralAddress signMessage

Example:

signmessage yPd75LrstM268Sr4hD7RfQe5SHtn9UMSEG ycBFJGv7V95aSs6XvMewFyp1AMngeRHBwy|0|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|yc98KR6YQRo1qZVBhp2ZwuiNM7hcrMfGfz|54e34b8b996839c32f91e28a9e5806ec5ba5a1dadcffe47719f5b808219acf84

Output:

IMf5P6WT60E+QcA5+ixors38umHuhTxx6TNHMsf9gLTIPcpilXkm1jDglMpK+JND0W3k/Z+NzEWUxvRy71NEDns=

Submit the signed message

We will now create the ProRegTx special transaction to register the masternode on the blockchain. This command must be sent from a Pyrk Core wallet holding a balance, since a standard transaction fee is involved. The command takes the following syntax:

protx register_submit tx sig

Where:

  • tx: The serialized transaction previously returned in the tx output field from the protx register_prepare command
  • sig: The message signed with the collateral key from the signmessage command

Example:

protx register_submit 030001000191def1f8bb265861f92e9984ac25c5142ebeda44901334e304c447dad5adf6070000000000feffffff0121dff505000000001976a9149e2deda2452b57e999685cb7dabdd6f4c3937f0788ac00000000d1010000000000c7fd27022913dd8505ae701e0fd56625c3fa9d2ff47802225faae562389e492c0100000000000000000000000000ffff8c523b334e1fad8e6259e14db7d05431ef4333d94b70df1391c601d2c43f022eeceaaf09532d84350feb49d7e72c183e56737c816076d0e803d4f86036bd4151160f5732ab4a461bd127ad8e6259e14db7d05431ef4333d94b70df1391c600001976a914adf50b01774202a184a2c7150593442b89c212e788acf8d42b331ae7a29076b464e61fdbcfc0b13f611d3d7f88bbe066e6ebabdfab7700 IMf5P6WT60E+QcA5+ixors38umHuhTxx6TNHMsf9gLTIPcpilXkm1jDglMpK+JND0W3k/Z+NzEWUxvRy71NEDns=

Output:

9f5ec7540baeefc4b7581d88d236792851f26b4b754684a31ee35d09bdfb7fb6

Your masternode is now upgraded to DIP003 and will appear on the Deterministic Masternode List after the transaction is mined to a block. You can view this list on the Masternodes -> DIP3 Masternodes tab of the Pyrk Core wallet, or in the console using the command protx list valid, where the txid of the final protx register_submit transaction identifies your DIP003 masternode. Note again that all functions related to DIP003 will only take effect once Spork 15 is enabled on the network. You can view the spork status using the spork active command.