Superstaking

Offline staking: How to set up a Superstaker wallet and operations

I. Superstaking with GUI

1. Run the wallet (Github release v-20.18)

For mainnet start the wallet with

./hydra-qt -superstaking -logevents

For testnet the wallet is launched as

./hydra-qt -testnet -superstaking -logevents

Windows users launch the wallet as usual, just by clicking the icon on the desktop. The following steps are the same for Windows, Linux and MAC.

2. Resync

When the wallet starts with the Superstaker option, it will want to resync. After the wallet starts and begins resyncing the blockchain you should stop resyncing by clicking on the “Connections” icon in the top right corner of the wallet. After doing that check the boxes (if not already checked) “Enable log events”, “Enable super staking” (both needed for superstaking) in the “Settings”>“Options”>”Main” window.

Also check the box “Enable coin control” (optional) in the “Settings”>“Options”>”Wallet” window.

Now close the wallet with the X button in the top right corner and launch it again. The wallet will begin resyncing with the proper settings for Superstaking.

3. Switch on the Superstaker to stake local UTXOs

Click the staking button in the “Stake” tab to slide to the right. The wallet will stake all mature local UTXOs.

4. Set up an address to be used as Superstaker address

On the “Stake”>”Superstaker” window click on the “+” button on the right side to add a new Superstaker. After the Superstaker address is set up, the Superstaker will stake both mature local and mature delegated UTXOs. The minimum value a Superstker can stake is 100 HYDRA, smaller UTXOs on the delegated address will be ignored by the Superstaker.

5. Customize Superstaker settings

On the “Stake”>”Superstaker” window click on the “Configure” button to customize the Superstaker settings. Here you can adjust the Superstaker fee (% from the staking reward when a delegated UTXO wins a reward). Here you can also set up Allow/Exclude lists of Delegator addresses.

6. Split local Superstaker UTXOs

On the “Stake”>”Superstaker” window click on the “Split” button to split in one transaction the local UTXOs of the superstaker according to a set of rules adjusted in the “Split coins for Superstaker” window.

7. Restore

Superstaker configurations are stored in the wallet.dat file. If there are problems with the wallet.dat file the Delegation information and Superstaker information may be recovered using the Restore button on the Delegation and Superstaker pages from a backup wallet.dat file. In this case, the Superstaker wallet will rescan the "state" contract memory for offline staking transactions for the appropriate addresses.

8. View delegations in the Superstaker wallet

Mouse over the "lightning" icon on the left side of the "Super Staking" window. A popup window will show the weight of the delegations at the moment. This is the total weight of all UTXOs from delegated addresses, which meet two conditions: 1. These are mature delegated UTXOs and 2. These UTXOs have not staked and won a block in the recent 2000 blocks. UTXOs that are mature but have been staked by the Superstaker will be treated by the Supertaker as immature for the next 2000 blocks.

A more detailed view by address can be seen by clicking on the "Delegations" small button on the "Super Staking" window.

II. Superstaking with Cli

1. Basic commands

After installing hydrad and hydra-cli , launch with the following parameters:

./hydrad -superstaking -logevents

Optional parameters may be added to change the default fee (of 10%) and minimum UTXO value (of 100 HYDRA), for example as

./hydrad -superstaking -logevents -stakingminfee=12 -stakingminutxovalue=120

For testnet just add the -testnet option when launching

./hydrad -superstaking -logevents -stakingminfee=12 -stakingminutxovalue=120 -testnet

The options -stakingminfee and -stakingminutxovalue will set the default values for the superstaker. NO CUSTOM VALUES are set up with this command. In case you want to launch the wallet with new default values, just stop the wallet and relaunch it with the new values.

On the image below you can see the wallet starting:

If you need you can stop the wallet syncing process with

./hydra-cli stop
or
./hydra-cli -testnet stop

To start again you need to repeat the full command with options

./hydrad -superstaking -logevents
ot
./hydrad -superstaking -logevents -testnet

In case you would not want to output the wallet log on the terminal use the -daemon option

./hydrad -daemon -superstaking -logevents
or
./hydrad -daemon -superstaking -logevents -testnet

Once the wallet syncs the blockchain, get an address to send some HYDRA to. This will be the Superstaker address. Use the command:

./hydra-cli getnewaddress
or
./hydra-cli -testnet getnewaddress

Send for example 2000 HYDRA to this address. The 2000 HYDRA will arrive in a single UTXO, which must be split for the Superstaker operation. Use the splitutxosforaddress command with the default 100 minimum size and 200 maximum size (with -testnet option for testnet):

./hydra-cli -testnet splitutxosforaddress "address" minValue maxValue maxOutputs

With the following command you select a specific address in your superstaking node to be used as Superstaker address:

./hydra-cli addsuperstakeraddress '{"address":"str","stakingminutxovalue":amount,"stakingminfee":n,"allow":["address",...],"exclude":["address",...]}'

At this point, the hydrad daemon wallet is ready for Superstaker operation with address Ta1A8CWhpSfeiXNzFSMy9D1kz9S6UJ2KQe, and delegations can be monitored using the command:

./hydra-cli -testnet getdelegationsforstaker "address"

Logevents must be enabled for getdelegationsforstaker to work.

On the screenshot below there are no delegated addresses with mature UTXOs:

Now the Superstaker has one delegation with mature UTXOs:

In case you want to remove the Superstaker address from the wallet (may be to use a different one or just not intending to use the node for Superstaking), use the following comand:

./hydra-cli removesuperstakeraddress "address"

2. More RPC commands

./hydra-cli setsuperstakervaluesforaddress '{"address":"str","stakingminutxovalue":amount,"stakingminfee":n,"allow":["address",...],"exclude":["address",...]}'

The command setsuperstakervaluesforaddress will set cutom values for the Superstaker address.

./hydra-cli listsuperstakercustomvalues
./hydra-cli listsuperstakervaluesforaddress "address"
./hydra-cli removesuperstakervaluesforaddress "address"

The command removesuperstakervaluesforaddress will remove the custom values and revert to the default values of the Superstaker address.

III. Understanding the superstaking process

When the Superstaker node is set up it needs to have some local and some delegated UTXOs to superstake. When local UTXOs mature they will begin staking . When delegated UTXOs mature, the Superstaker node operator will see them as delegated in the Superstaker wallet. The delegated UTXOs are not shown individually, they appear as a total balance of mature delegated UTXOs in the Superstaker wallet.

When delegating the Delegator “leaves a note” in the smart contract saying that he has delegated his address to a specific Superstaker address. The Superstaker node doesn't have to be online for the delegation process to happen. When the delegation is withdrawn, the Delegator “leaves another note” in the smart contract that he has stopped delegating his address. Here again the Superstaker doesn't have to be online for the delegation withdrawal to happen.

The Superstaker checks the smart contract (reads it) to see if someone delegated to him. If he sees an address delegated to him he checks the UTXOs for that address to know them. The Superstaker cannot send them or split them or do anything with them, but he knows the values and how many UTXOs are there on the address that was delegated to him. Knowing these values and the block number of when the delegation was made, the Superstaker begins to calculate the kernel hashes for those delegated UTXOs (rotates them in the hash guessing cycle).

In case a delegated UTXO wins a block, the Superstaker creates a new block and sends the reward to the Delegator address. For coinbase transaction in the new block is used a random UTXO from the local Superstaker UTXOs and this UTXO has to mature again for 2000 blocks.

After winning a block the delegated UTXO is not staked by any Superstaker for 2000 blocks, and although the maturity of the delegated UTXO is “not reset to zero” (there was no "send" transaction with the delegated UXTO), the Superstakers keep track of the information when the delegated UTXO has won a block and will not stake it for another 2000 blocks. Superstakers will treat it as not mature for 2000 blocks.

IV. Operations

The Superstaker must hold UTXOs to commit to stakes for the delegated UTXOs it is staking. The number of UTXOs (of minimum size 100 HYDRA) is based on Delegated Weight as a percent of overall Network Weight, and good values are 30 UTXOs for staking 1% of Network Weight, 50 UTXOs for 2.0%, 100 UTXOs for 5% and 160 UTXOs for staking 10% of overall Network Weight.

Superstakers should monitor their Wallet weight (UTXO weight minus amount currently staking) and add UTXOs if it drops.

Superstakers and Delegators should make a backup of the wallet.dat file after changes in the offline staking configuration such as adding settings (for the Superstaker) or adding a Superstaker (for the Delegator). Use the "Back up" function on the GUI or simply save the wallet.dat file on a backup flash drive or another secure location.

Last updated