Understanding how Staking works
This article aims in providing further technical insight into the mechanics behind staking so that users can learn how to optimize their staking balance for maximum efficiency.
Like Bitcoin, Hydra is based on the UTXO model which means a given wallet balance represents the total combined value of all UTXOs within that wallet. Having multiple UTXOs gives you the ability to perform parallel operations, particularly because of the independence each such UTXO carries (a UTXO is similar to what a cash bill is in a physical wallet, you can use different bills for different transactions simultaneously). This also includes staking operations.
If you are curious to see how your current balance is broken into UTXOs and you are using the GUI version of the Hydra client, you can go to Settings -> Wallet -> "Enable coin control features"
When you click on the "Send" tab, this will unlock the "Coin Control Features" button.
After you click on "Inputs" the GUI will show you a list of all of your UTXOs which you are in control of with your wallet. The actual purpose of this feature is to give you better control when you send outward transactions, as you can define yourself which UTXO to be used, but it is also very useful for optimizing your staking setup as it provides a user-friendly way for you to analyze your wallet UTXO structure.
Notice how in the above screenshot, an approximate wallet balance of 1289 HYDRA is actually held in 4 separate UTXOs.
The first UTXO having a balance of 1254 and the remaining ones, having 13, 12 and 10. Each UTXO also has its own separate maturity count (on the right side). You will see that the first one has 790 confirmations as maturity.
As a rule of thumb, when you receive a transfer, the amount is always received as a single UTXO. This means you can also send transactions to yourself to consolidate smaller UTXOs. By using the coin control features, you can choose which UTXOs you might want to consolidate
- When staking is enabled, each individual UTXO will compete for becoming the next block producer, and the probability of each UTXO is equivalent to its proportion to the combined total network weight.
- 2,000 blocks maturity (approx 17.7 hours) is required for a UTXO to be eligible and start staking, before reaching that maturity, you will have a zero probability for producing a block even if your staking is enabled
- Once a UTXO becomes the block producer, it will immediately generate a reward and will become locked 2,000 blocks
- If a UTXO is more than 200 HYDRA in quantity and becomes the block producer, the protocol will automatically split that amount into 2 equal parts. This is an automatic and immutable setting that optimizes the staking probability and ensures that the user's balance doesn't get locked out too soon due to an "overkill" UTXO. This also means that even if you don't do anything, your balance will get self-optimized over a few weeks period of time (depending on what kind of amount you are holding). The split is done automatically without any cost to you.
- Holding 200 HYDRA per UTXO gives you maximum theoretical efficiency. You can either wait for this to happen on its own, or you can alternatively send multiple transactions of 200 HYDRA to your own self (at the expense of approx $0.2 per transfer)
- When a UTXO becomes the block producer and gets locked for 2,000 blocks, you will not be able to spend the amount until these 2,000 blocks pass (you will see your balance as "staked")
- When a UTXO is released from the 2,000 blocks staking lockdown, it will automatically be eligible to become the block producer. In theory, you could have a UTXO become the block producer on the 1st block after the 2,000 lockdown maturity ends.
Important: The explorer and your wallet show the total amount that is locked out due to staking with the "staking" tag. Don't let that confuse you, as that doesn't mean the rest of the wallet is not participating in the staking process. This is the amount of HYDRA that has recently been a block producer and therefore is still in the process of completing the 2,000 block maturity lockdown that follows block producing.
In this particular case, 3,560 HYDRA out of the total 59,319 is unavailable because the UTXOs behind this amount had become block producer(s) within the last 2,000 blocks and are still locked.The remaining 55,759 HYDRA are actively competing in the staking. The small lockdown % is a sign the UTXOs are probably sufficiently optimized since if it was a single UTXO, the whole amount would show as "staking" and therefore unavailable.
Tip 1) If you receive a large balance in one transaction and you plan to enable staking, you can break it into smaller ones which could help you speed up the UTXO quantity optimization process. You can either break them down into 200 HYDRA or you could also break them into 1000 HYDRA and leave the rest to the system to do on its own.
Alternatively, if you don't mind waiting a bit for your wallet to self optimize, you can just leave it as it is and the system will do that job for you for free.
Tip 2) Over time your wallet can become stuffed with too small transactions (e.g. transactions less than 15 HYDRA). You can consolidate these UTXOs into bigger ones to improve performance. To do so, it only takes sending a transaction to yourself. You can also use the "inputs" tab after enabing "Coin control features" to manually select which UTXOs you want to consolidate (as otherwise the system might choose a bigger UTXO in order to save on the transaction costs. Please keep in mind that the UTXO model calculates the transaction fees based on the size of a transaction (and each UTXO increases the transaction size). So for example a 200 HYDRA transaction consisting of 100 UTXOs of 2 HYDRA each, will count as 100 transfers of a single UTXO, regardless of the amount that is being sent.
Example: 1 UTXO with 10,000 HYDRA has the exact same probability to validate a block as a wallet holding 10 UTXOs with 1,000 HYDRA each. Since they both amount to the same 10,000 in total and therefore have the same staking weight.
The difference in efficiency comes from the staking downtime that arises after you mine the block. If you have a single UTXO with 10,000 HYDRA, all HYDRA will have to re-mature for 17 hours after validating a block and won't be staking for that time period.
On the other hand, if you have 10x 1,000 HYDRA, validating a block will only disable 1,000 HYDRA from staking (for 17 hours) while the remaining 9,000 will continue to stake in the meantime.
So the efficiency gain comes from the reduced downtime.