How does a stake work, step by step?
- Start.
stakeStart(newStakedHearts, newStakedDays)locks an amount for 1 to 5,555 days (HEX.sol:1321-1340, limits:711-714). The staked HEX is burned from your wallet (:1337), so it is not part oftotalSupply()while staked. - Lock from the next day. A stake begins on the next full HEX day, so all stakes follow one calendar (
:1532-1540). - End.
stakeEnd(stakeIndex, stakeId)computes principal + payout − penalty and mints the result back to you (:1410-1494, mint at:1484). - Good accounting. Anyone may call
stakeGoodAccountingon a finished stake of another address (:1349-1402). It marks the stake as served so the late penalty stops growing; the owner still ends it later to collect.
Nobody’s balance is moved to you at any step: staking burns your own HEX, ending mints new HEX by formula.
What are shares and T-shares?
When a stake starts, it receives shares: (stakedHearts + bonusHearts) × 100,000 / shareRate (:1526-1527, scale :737). The daily payout is split by shares, not by HEX amount.
“T-share” does not appear in the contract. It is the community and interface unit for 10¹² (one trillion) shares; the contract stores raw share counts.
How do the length and size bonuses work?
| Bonus | Rule | Maximum | Code |
|---|---|---|---|
| Longer Pays Better (LPB) | +20 % per 364 extra days (extra days = stake days − 1) | +200 % at 3,641 days | :724-728, :1657-1660 |
| Bigger Pays Better (BPB) | grows linearly with the amount staked | +10 % at 150 million HEX | :730-734, :1662-1664 |
Both bonuses are added as extra “bonus Hearts” before shares are calculated (:1666-1667). A stake longer than 3,641 days earns no further length bonus, but it still collects the daily payout for every additional day up to 5,555.
Why do shares get more expensive over time?
The share rate — the price of a share in HEX — can only rise (:1833-1837). When a stake ends with a profit, the contract sets the rate to the level at which re-staking that stake’s full return for the same length would buy the same number of shares (:1812-1838); the rate is capped at 2⁴⁰ − 1 (:739-741).
The effect (our reading): later stakers get fewer shares per HEX than earlier ones, which rewards early and long commitment. CoinFabrik’s economics audit (October 2019) tested whether a long stake pays better than repeatedly re-staking short ones and confirmed it for realistic parameters, noting only an edge case with a single staker and an artificially low share rate.
Where does the daily payout come from?
Every day the contract books a payout pool of allocSupply × 10000 / 100448995, where allocSupply is circulating plus staked HEX (:1241, :1182, :1278). The code comment derives this as 3.69 % per 364 days, compounded daily (:1226-1240). The pool is only recorded in the daily data; the HEX is minted to each staker when the stake ends (:1484).
- The whole payout goes to active stakes in proportion to their shares (
:1581-1584). A stake’s payout is the sum ofday payout × stake shares / all sharesover its served days (:1571-1584). - Half of each penalty paid by other stakers is added to the next day’s payout (
:1253-1256); the other half goes to the Origin Address. - There is no price, oracle or external call in this calculation — it is arithmetic over the contract’s own state (
:1222-1257).
What happens if I end a stake early?
An early end (“emergency end stake”) costs the payout of a penalty window (:1720-1775):
- The window is half the committed days, rounded up, but at least 90 days (
:1733-1737, minimum:716). - If you served longer than the window, the penalty equals what the stake earned during its first window days (
:1746-1759). - If you served fewer days than the window, the average daily payout you earned is scaled up to the full window (
:1765-1773) — so the penalty can exceed the payout and eat into principal. Ending on the first locked day uses an estimated daily payout × window (:1739-1743). - The penalty cannot make the return negative: in the worst case the whole stake return is lost (
:1706-1716). In the code, “stake return” means principal plus payout — so a large enough penalty takes the principal as well. - Ending a stake that has not started yet (still in its pending day) returns the principal with no penalty and no payout (
:1457-1465).
| Committed length | Penalty window |
|---|---|
| 30 days | 90 days (minimum) |
| 180 days | 90 days |
| 365 days | 183 days |
| 1,000 days | 500 days |
| 5,555 days | 2,778 days |
The window follows from the rule “half, rounded up, at least 90”. hex.com/security advises not to end a stake early unless you fully understand the penalty.
What happens if I end a stake late?
After the end date there are 14 days of grace (:718-719). From then on the penalty grows by 1/700 of the stake return — principal plus payout — per day (:721-722, :1777-1795), so about 714 days after the end date the whole stake, principal included, is gone. Calling stakeGoodAccounting (by you or anyone) stops this clock.
Where do penalties go?
Every penalty is split 50 : 50 (:1797-1810): half is minted to the Origin Address, half is added to the next day’s payout for all active stakers. Stakers who keep their commitment therefore receive part of what rule-breakers lose.
What was Big Pay Day?
BIG_PAY_DAY is defined as the day after the claim phase (:677-678): contract day 352, which is 2020-11-19. On that day all Bitcoin from the launch snapshot that had never been claimed was converted to HEX and split, together with an adoption bonus, among the stakes active over that day (:1586-1592). It was a one-time event of the launch year.
How do I stake?
Use the official interface go.hex.com on the chain where your HEX is. A stake made on Ethereum lives on Ethereum, a stake made on PulseChain lives on PulseChain — see HEX vs. HEX(eth). Choose the length carefully: both ending early and ending late cost a penalty.