Skip to content

forkcoin01/PIVX-SPMT

 
 

Repository files navigation



SPMT

SPMT: Secure Pivx Masternode Tool is a software to securely manage multiple PIVX masternodes while keeping the collateral safely stored on Ledger Nano S hardware wallets.


Installation

This application does not require installation.
If you are using a binary version, just unzip the folder anywhere you like and use the executable to start the application:

  • Linux: double-click SecurePivxMasternodeTool file inside the app directory
  • Windows: double-click SecurePivxMasternodeTool.exe file inside the app directory
  • Mac OsX: double-click SecurePivxMasternodeTool.app application folder

If you are running SPMT from the source-code instead, you will need Python3 and several libraries installed.
Needed libraries are listed in requirements.txt.
From the SPMT directory, launch the tool with:

python3 spmt.py

To make binary versions from source, PyInstaller can be used with the SecurePivxMasternode.spec file provided.


Setup

NOTE: ⚠️ make sure to have the latest firmware installed on your Nano S device.

Running a masternode usually requires setting up two PIVX full nodes, one -the actual masternode- that runs 24/7 and holds no funds, and another one -the control wallet- that holds the collateral and is used only to send a message (signed with the key of the collateral) to activate the remote node.

SPMT allows the user to store the collateral in a Ledger Nano hardware wallet and connects to the PIVX network (at the moment via an empty PIVX wallet that acts as RPC server) to send the "start" message to the remote node.

The setup of the remote (VPS) is performed in the usual way, described in the knowledge-base guide:
Masternode Setup Guide

For a self-hosted masternode setup with SPMT check the following guide:
Self-hosted MN from scratch (by TheEconomist)


Setting up the RPC server

In order to interact with the PIVX blockchain, the SPMT needs a local PIVX wallet running alongside (any empty pivx-cli wallet will do).

Edit your local pivx.conf inserting rpcuser, rpcpassword, rpcport and rpcallowip.
Example:

server=1
rpcuser=myUsername
rpcpassword=myPassword
rpcport=45458
rpcallowip=127.0.0.1

Configure the RPC server by clicking on the menu


and inserting the same data.

You can leave ip 127.0.0.1 if the wallet is on the same machine as the SPMT.
Otherwise set the IP address of the machine running the Core PIVX wallet.



Connections

If the IP and the credentials of the PIVX wallet are correct, it should connect with SPMT instantly.

Otherwise use the Connect button next to "PIVX RPC server: Local Wallet".
Connect the hardware device to USB and open the PIVX-App on it.

Click the button Connect next to "Hardware Device: Ledger Nano S" to connect to the hardware device.


Once successfully connected, it gives a confirmation message and the light turns purple.



Setting up a Masternode configuration

Click New Masternode (big button below the list) and fill all the informations of the remote node:

  • Name : an alias for the masternode entry
  • IP Address / IP Port : Public IP address and port of the remote masternode
  • MN Priv Key : masternode private key. If you have already seup the remote node, copy here the masternodeprivkey from the pivx.conf file.
    If you don't have one yet, you can generate a new masternode private key clicking on Generate (then copy it to the config file of the remote node).


Insert the PIVX Address holding the collateral (and relative account number). If you have just one account in your Ledger wallet, leave account number to 0.
Then click >> to look for path and public key.


The tool looks for the public key and path of the given address (in batches of 10 paths per scan, asking confirmation to continue if needed).
When found, a notification message is displayed.


If the user already knows the correct spath_id (address number) he can, instead, insert it and click << to look for the corresponding address and public key.

Click Lookup to find the collateral TxHash or click Edit to fill it manually, and then OK.
Click Save to save the configuration and go back to main view.



Import external masternode file

Starting from version v0.3.1 it is possible to "import" external masternodes (with collateral traditionally held on PIVX core wallets, instead of hardware devices), loading the data from an external file formatted as the common masternode.conf of the controller wallets.

To access the feature simply click on Import "masternode.conf" file from the Setup menu and select the file.


These "external masternodes" will appear in orange in the list inside the SPMT.

They can't be started and the spending of rewards is disabled for them. But their status can be checked and they can be used for voting in the governace Tab.


Features

Getting masternode status

Click on Get Status For All Masternodes to inspect the status of all masternode entries.


To inspect the status details click on the little magnifying glass icon.





Starting masternode

Click Start All Masternodes to send a start-message for all masternode entries or click the little rocket icon next to a particular entry to start that one masternode.


Click yes to confirm


Double check the masternode message hash both on screen and on the display of the device.
Then click "yes" (right button) on the ledger nano S.


SPMT presents the decoded message.
Double check it and then click Yes.


After broadcasting the message, SPMT presents a confirmation popup.



Spending masternode rewards

Select the Transfer Rewards Tab to go to the rewards panel (or use the shortcut, money icon, to simultaneously change tab and select the node).


Use the dropdown menu to select the masternode you wish to send rewards from.


Click on Show Collateral if you wish to select and spend it.
Click on Hide Collateral to hide it again.


Select those UTXOs you wish to spend.
The suggested fee is automatically adjusted based on the TX size and the average fee of the last 200 blocks.
Adjust it as preferred.

Then insert the PIVX Destination Address and click on Send


Verify the details of the TX both on screen and on the display of the Nano S.
If everything checks out, click "yes" (right button) on the device.


The transaction is now assembled and signed.
SPMT asks one more time to check the details before broadcasting the transaction (thus spending the selected rewards).
Click `Show Details` to inspect the decoded raw transaction.


Click `Yes` to finally broadcast the transaction to the PIVX network.

Click Show Details to get the TX-id that identify the transaction.
It should appear on the Block Explorers and on the receiving wallet after a few seconds.



Sweeping all masternode rewards

With this feature it is possible to send all rewards from all masternodes in list with a single TX (provided it doesn't get too big).

Click on Sweep All Rewards to open the summary dialog.


Insert the destination address, adjust the fee and click Send


Preparing the TX is an expensive operation. The more rewards included, the more time is needed. A progress bar gives the current status of the signature operation.


Eventually SPMT shows the confirmation dialog


Signing all the inputs is time consuming as well.
If the operation takes too long, the number of inputs is probably too high. try sending separate TXs first.
After some time it prompts the usual message



Governance

Version 0.3.0 of SPMT introduced the ability for masternode owners to interact with the governance of the PIVX DAO (decentralized autonomous organization) directly from within the tool.

To review budget proposals and vote on them, select the Governance Tab.


Reviewing the budget

If the RPC server is connected, the current proposal list will be automatically loaded and displayed.
To reload the list, click on the double arrow icon in the upper right corner.

For each proposal is displayed: name, proposal hash, link, monthly payment, number of payments (remaining and total), network votes (yes / abstains / no) and the number of votes belonging to the user's masternodes.
Each column can be ordered in both ascending and descending order.


In the main list, each row has the "Network Votes" cell's background highlighted to reflect its status:

  • GREEN: Proposal currently passing (number of net yes votes is higher than 10% of the total masternodes count)
  • RED: Proposal currently not passing (number of net yes votes is negative - i.e. there are more 'no' votes than 'yes' votes)
  • YELLOW: Proposal expiring (number of remaining payments is zero)
  • WHITE (no background): Proposal currently not passing (number of 'yes' net votes is positive but less than 10% of the total masternodes count)

To follow the discussion thread of a particular proposal on the PIVX forum click on the Link button.


To inspect the details of a proposal click the little magnifying glass icon.

In the "Proposal Details" dialog the Hash, FeeHash and Payment Address fields are selectable (but of course not editable) so they can be copied and pasted elsewhere if needed.


To view the budget projection for the current cycle, click the list icon on the upper left corner of the Governance Tab


The budget overview shows the time remaining till next superblock as well as the list of proposals currently passing and the total allotted budget.


Casting Votes

Click Select Masternodes... to select the masternode(s) you'd like to vote with.


Then select all proposals you'd like to vote on, clicking on the corresponding row in the table.
The total number of proposals selected is shown in the bottom right corner


Click Vote YES to vote 'yes' for the selected proposals or Vote NO to vote 'no' ('Abstain' option is currently disabled).
A summary is presented. Click Yes to confirm or No to cancel.


The tool presents a popup showing the outcome of the operation.


Adding a random time offset

To enhance the privacy of the masternode owner, the tool gives the ability to add a randomized delay to each vote timestamp.

The offset can be either positive or negative resulting in a vote slip with a timestamp either delayed or anticipated.
To enable the feature, click the checkbox near the little clock icon in the bottom left corner of the Governance Tab.
Set the seconds for the lower bound LB and the upper bound UB.


When voting, with this option enabled, a number of seconds T, is randomly chosen in (-LB, UB) for each vote and added to the current timestamp (i.e. to have only delayed votes, set LB to 0 seconds)

The random time T used for each vote is printed in the console log.


The timestamp of each personal vote can be also reviewed inside the details dialog of a proposal.



Coming soon

  • Proposals submission
  • Lite Connection
  • ...

Credits

A big part of this work was originally inspired by the following Dash projects:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%