How to Stake Hydra on Linux

Hydra employs PoS (Proof of Stake) consensus mechanism, which is different from Bitcoin's PoW (Proof of Work). The mining process in PoS system is called staking.

Basic requirements for staking:

  1. Run a Hydra fullnode, and keep online (Since Hydra is using PoS, we don't need any mining machine, just PC or even Raspberry Pi can run a fullnode);

  2. Have some Hydra in the wallet (fullnode)(Any amount of Hydra can be used for staking, more Hydra means higher possibility to stake).

If you have no Hydra yet, please get some from market before you doing following staking settings.

Currently, Hydra Core wallet is the only wallet that support Hydra PoS staking. Note that other wallets like mobile wallet and Hydra Electrum are not able to stake for the time being.

Two ways to stake:

  • Method 1:Staking with hydrad, using command line, suitable for Linux/OSX/Windows/Raspberry Pi users who are familiar with command line tools.

  • Method 2:Staking withhydra-qt wallet, with GUI, suitable for common users.

Either way works in the same way for staking, so you can choose either method you like.

Method 1:Staking withhydrad (command line)

1. Run hydrad

To run hydrad, please refer to "How to deploy Hydra node".

Follow the guidance to run hydrad:

./hydrad -daemon

Staking is default on for hydrad, so no need for other options if you only want to stake.

2. Send some HYDRA to your wallet

First you can generate a new address with:

./hydra-cli getnewaddress

This will generate a new address with Prefix 'H'. You can send some HYDRA to this new generated address for staking. You can generate as many addresses as you like, and send arbitrary HYDRA as you like for staking.

Note:The coin should wait for 2,000 blocks before being able to stake, i.e. about 17 hours to MATURE..

After the Hydra node syncing to the latest block, you can check current balance with ./hydra-cli getbalance or get utxo list with./hydra-cli listunspent.

Please do following steps after your coin is mature.

3. Check staking info

Check current staking info with:

./hydra-cli getstakinginfo

You might get the result like this:

{
  "enabled": true,
  "staking": true,
  "errors": "",
  "currentblocksize": 1000,
  "currentblocktx": 0,
  "pooledtx": 5,
  "difficulty": 5683612.564280176,
  "search-interval": 46,
  "weight": 53206430,
  "netstakeweight": 2278172497819029,
  "expectedtime": 5480654870
}

enabled means if your wallet have enabled staking, it should be true by default. staking means if your wallet is currently staking (mining). weight stands for the amount of HYDRA that is staking right now, with unit 10^-8HYDRA, here in the example, we have 0.532HYDRA staking. expectedtime stands for the expected time that you will get a reward, the unit is second.

4. How to stake if the wallet is encrypted?

If your wallet is not encrypted, you can skip this section. However, for security, we recommend you encrypt your wallet. (How to encrypt?)

Hydra wallet can be encrypted with encryptwallet. However, staking will be stopped when it is encrypted. For example, ./hydra-cli getstakinginfo for a encrypted wallet:

{
  "enabled": true,
  "staking": false,
  "errors": "",
  "currentblocksize": 1000,
  "currentblocktx": 0,
  "pooledtx": 94,
  "difficulty": 5788429.670171153,
  "search-interval": 0,
  "weight": 53206430,
  "netstakeweight": 2438496688951881,
  "expectedtime": 0
}

See staking turns to false, which means wallet is not staking.

You can use walletpassphrase to unlock wallet for staking:

./hydra-cli walletpassphrase "" 99999999 true

The meaning of the arguments can be found in the documents "How to encrypt?".

After unlocking, you can double check getstakinginfo, it should look the same with previous unlocked result, staking become true.

Method 2: Staking with hydra-qt wallet (official PC wallet)

How to use Hydra-qt tutorial? please refer to Hydra qt wallet tutorial. Current supported platform: Mac/Linux/Windows.

1. Open Hydra qt wallet

Launch the wallet.

2. Send some HYDRA to your wallet

If you already have some Hydra in your wallet, you might skip this step.

If not, please send some Hydra to your wallet first. (How to receive?).

Note:The coin should wait for 2,000 blocks before being able to stake, i.e. about 17 hours to MATURE..

Make sure to activate staking in the "stake" tab of your wallet.

3. Check staking status

The flash sign at the bottom of wallet shows staking info :

Solid black flash means it is staking now. For more information, you can put your mouse on the flash, e.g.:

  • Staking: if it is staking;

  • Your weight is: How many Hydra are able to used for staking, unit is Hydra;

  • Network weight is: How many Hydra are staking in the network, unit is Hydra;

  • Expected time: expected time to get reward, unit is Day.

Hollow flash means it is not staking

Possible reasons for not staking:

  • 1.There is no coins of no mature coins (more than 2,000 confirmations/blocks) -- Solution: send some Hydra to the wallet and wait for 2,000 blocks (about 17 hours);

  • 2.Wallet is locked/encrypted -- Solution: unlock the wallet for staking. (How to unlock?)

No flash sign means staking is disabled

  • 3.Staking is disabled -- Solution: enable staking in the hydra.conf (-staking=true)(How to set hydra.conf?)

About block reward

HYDRA's block rewards are distributed in an incremental inflationary model.

The inflation formula works as follow:

[inflation rate%] x [total coin supply] / blocks per year

"inflation rate%" being the changeable parameter that can be casted with a community vote and will be limited within a 0% - 25% range.

This technically means that, with 18,585,933 HYDRA coins as a total initial supply and the default 128 second block time (246,375 blocks per year), the calculation would look as follows: /based on a 0 gas fees for the particular sample blocks and a 20% inflation rate/

● block 1 (0.2 x 18,585,933)/246,375 = 15.08751537290715 HYDRAs per block as a reward and a new total supply of 18,585,948.08751537

● block 2 (0.2 x 18,585,948.08751537 )/246,375 = 15.08752762050969 HYDRA block reward (and the cumulative increase continuing to grow)

  • Once a stake is successful, you will get the reward immediately e.g. a 15.08 HYDRA

  • The staked coins (UTXO) will be locked for 2,000 blocks, during this period, it cannot be spent nor be used to stake.

How to disable staking?

Staking is by default enabled for Hydra wallet. If you need to disable staking for some reason (for example exchanges are always recommended to disable staking), you might following anyone of the 3 ways below:

1 Add -staking=false when running Hydra node:

./hydrad -staking=false -daemon

For qt wallet, it is like:

./hydra-qt -staking=false

2 Add config staking=false in hydra.conf;(How to set hydra.conf?)

3 Encrypt wallet, since encrypted wallet will automatically stop staking.(How to unlock?)

Getting information through the cli

General wallet information balance/staking

You can view your Coin balance and amount currently staked with the following command:

./hydra-cli getwalletinfo

Retrieving your LOC token balance through the cli:

This is slightly involved, first we'll need to find out the HEX equivalent of our address. We can do this through the cli with this command:

./hydra-cli gethexaddress <YOURADDRESS>

We can then call the contract with the "getbalance" identifier appended, which is 70a08231and replacing the last part <YOURHEXADDRESS> with your own hex address here:

./hydra-cli callcontract 4ab26aaa1803daa638910d71075c06386e391147 70a08231000000000000000000000000<YOURHEXADDRESS>

Finally convert the "output" section of the response from hex to decimal to arrive at your LOC balance. Keep in mind to adjust for 8 decimal places. echo $((0x))

echo $((0x<YOUROUTPUT>))

Below is a full example:

Time until expected block creation

To see expected time enter the following command:

./hydra-cli getstakinginfo

Note below the section "expectedtime".

The "expectedtime" can be converted to human readable format using the following command (replace 1254588 with your expectedtime value:

date -u -d "@1254588" "+%d days %H hours %M minutes"

Last updated