I see quite some confusion among Hexicans on how to end a stake. One would expect this to be the easiest and most comprehensible contract function, yet it appears guidance is needed. Ending a stake is one of several aspects that makes the HEX blockchain certificate of deposit technically different from bank certificates of deposits you may have used in the past.
Just like any interaction with the HEX smart contract, ending a stake is performed trough any of the several HEX contract frontends.
Smart contracts have no automatism
First of all, one needs to understand the basics on how blockchain technology and smart contracts work. What is most relevant here, is understanding that a smart contract is just code written on the blockchain. This code does nothing unless someone calls it using a blockchain network transaction. Therefore, the stake can’t end by itself. Someone needs to pay the Ethereum network miners a fee to run the code and reach consensus on the outcome.
In the HEX contract, there are two options on who can do this. The stake owner is the only one who can mint HEX by ending a stake at any point, either using the Emergency End Stake (EES) function when the stake is not yet mature, or the End Stake (ES) function when the stake is mature. Both functions are actually the same contract call. The difference is only in stake maturity. This call requires the same key that created the stake in the first place.
Meanwhile, anyone can run a Good Accounting (GA) contract call, as any ethereum network key can do that, however this function does not mint coins and only applies to mature stakes.
A mature stake will not accrue any more interest after the maturation day, regardless when and how it is concluded.
Emergency End Stake (EES)
Never break your contract obligations! This general rule is good for any contract you have ever signed in your life, but is particularly true for smart contracts, because these are self enforcing. The penalty for doing EES can be up to 100% of the stake, depending on how far the stake is from maturity, and how much interest it accrued in relation to the principal.
The EES function mimics the penalties one has to pay when breaking the legacy certificate of deposit contract at a bank. The difference is that the penalties for breaking the HEX contract early are extreme. However, at the end of the day, half of the penalty is credited to the staker class as interest, while the other half is minted into circulation trough the Origin Address. The immediate minting increases the inflation basis, thus again rewarding the staker class, but this indirect effect rewards also any new stakers, not just the ones staked on the day of EES.
As a rule of thumb, a stake can be 100% penalized (nuked) when the EES is performed on a short stake (less than 180 days), or in the first half of any stake length, or on a stake that received a huge interest in the first half of its length, such as the BPD bonus interest. For more details, consult The HEX Contract in Layman’s Terms, or the Hex.wiki website, or best of all, let the Staker.app calculate the penalty for you.
Sometimes using EES may actually be reasonable. A lot of Hexicans applied EES a few days before BigPayDay (BPD) to their stakes set to mature just after it. This way they paid a minimal penalty, but could restake longer just before BPD to receive more shares and thus a higher BPD bonus interest, as well as a higher interest in general due to a higher share ratio and longer staking.
Otherwise, EES is commonly performed by stakers who can’t handle the frustration from volatility, or from “fear, uncertainty and doubt” (FUD). When price pumps or dumps, or someone creates FUD, a lot of so called weak hands decide to EES, sometimes even nuking the stakes. In such periods, the interest can rise substantially. This makes HEX the first cryptocurrency that may be profitable during fast price depreciations.
EES is not available for autostaked HEX freeclaimed from a Bitcoin address.
End Stake (ES)
End stake (ES) is the proper way to conclude a stake. Once a stake matures, the stake owner has 14 days to conclude it without any penalties. Ending the stake can be done later too, but then late end stake penalty applies. Running ES burns HEX shares, and then mints the principal with the interest directly into the Ethereum network address that held the stake.
There is no custody in HEX, as one stakes and mints to the same address with its key: Do not lose your keys! No keys, no stake.
Good Accounting (GA)
There may be reasons one may want to mint HEX at some later time without paying the late end stake penalty. Good Accounting (GA) burns shares of a mature stake and thus prevents penalization. HEX can be minted any time later with the ES contract call.
This may be useful in some jurisdictions where minting coins is subject to taxation. It may be used for postponing the minting to the next taxation year.
But clearly the most useful aspect of GA is the ability to burn shares of any mature stake by anyone, not just the stake owner. This may be useful in some situations when the stake owner can’t get ahold of his key on time. The stake owner could also not have access to the network and can ask someone else to run GA for them.
GA is also useful to collect the late end stake penalties from expiring stakes (the backuphex.com HEX frontend offers an easy way to run GA on any expiring stake). For example, someone with a significant share ratio may be incentivized to run GA on expiring stakes on the day before their stakes mature in order to collect their share of penalties. Even though a network fee needs to be paid, it is certainly quite profitable for HEX sharks and whales to do so.
Late end stake penalty
All active stakes have HEX shares assigned to them. Shares are a crucial element of HEX fundamentals, as all interest is based on them. They literally are shares of the staking system in the sense that all interest is credited daily to a stake based solely on its share ratio (the ratio between the shares in a stake and the total shares in the system).
When a new stake is launched, the contract burns the staked HEX (principal) and at the same time creates shares to be locked in the stake. These shares are then burned when either ES, EES, or GA is applied. This is very important for the staker class, because due to lack of automatism, a mature stake still holds its shares embezzled. While shares in a mature stake do not accrue interest anymore, they reduce the share ratio of every other stake in the system by keeping the total shares inflated.
To prevent stakers from embezzling shares and reducing interest to other stakers by not ending a stake when they signed they would, the contract enforces a late endstake penalty. After two weeks of grace period, a penalty is applied that causes the expiring stake to bleed for 1% each week (0.143% per day). This means that after 2 years the penalty takes the entire stake. This penalty is only distributed once the stake owner runs ES, or anyone runs GA on it. Similarly to EES, half of late end stake penalty is then distributed to the staker class, while the other half is immediately minted in circulation trough the Origin Address.
Ending a stake by any method requires significantly more gas than creating one, as it is much more computationally intensive. Miners need to calculate the accrued interest for each day up to maturation. Consequently, the longer the stake, the more gas is consumed to conclude it.
The HEX contract runs on the Ethereum network which is still in development and thus not yet scalable on its base level. This means it has periods of high congestion, particularly when crypto markets are in bull run. Gas price is auction based, which means the users will offer higher gas fees in times of congestion, because miners prioritize transactions with higher fees.
A staker has two weeks to end a stake, so generally there is no particular hurry to end the stake immediately. The network fee can therefore be reduced by using a lower gas price and letting the transaction pend for a day or more. Because the network congestion varies strongly from hour to hour, it easily happens that an ES transaction gets approved overnight even at the lowest gas price. In case your transaction does not get approved in time, you will have to speed it up.
You can use the gas information on hex.vision to estimate the lowest still functional gas price. Edit only the gas price before approving the transaction and do not modify the gas limit. The unused gas is returned to you anyway, but the transaction will fail when the gas limit is set lower than what is needed. Nevertheless, the miners will take the fee for the computation they performed before running out of gas.
Disclaimer: None of the above is meant to be a financial advice. Never rely on a single source of information and do your own research before any investment. Don’t trust, verify!
If you found any of the above useful and want to give a tip, please use the Ethereum address: 0x4BaE10B7B20A4f92670f03474dbDD6716D2C143f