Views: 141

Since its inception, HEX has been the most controversial (and most profitable) project in cryptocurrency. In fact, the rampant anti-HEX sentiment is what led me to look into the project. Without getting all into the many reasons I research crypto tribalism, let me just say that in this specific case, the primary reason I care is because I’m angry that a bunch of LARPers who didn’t do their own research spread FUD, called HEX a scam, and ultimately impacted my (along with many others’) decision not to buy HEX a lot sooner. Essentially, they conned me (and maybe you) out of a lot of money. If only someone had taken the time to read the smart contract, or even the three audits, instead of relying on group think, this all could have been avoided

Let me put it to you another way, if you’d put $1000 into HEX one year ago today (on December 22, 2019), if you hadn’t staked any of it to earn more, your initial investment would be worth $37,504.38 – and that’s with HEX down 50% from it’s previous all-time high. That’s a return of over 3650%

To put things into perspective, let’s look at the gains one would have seen from some other “safer” investments:

– S&P 500 – $1144.87 – 14%

– Bitcoin – $3217.09– 221%

– Ethereum – $4932.50 – 393%

– Chainlink – $6824.97 – 582%

– Tesla – $7490.28 – 649%

So despite what HEX’s critics and naysayers have said about it loudly, publicly and often, the new asset still outperformed everything else by a wide margin. But if HEX is up by over 3000%, is now really a good time to buy? How can it continue to increase in value and outpace everything else?

The answers are simple. HEX is complete – unlike many other cryptocurrencies, whose values are driven by hype and speculation. HEX has been through three independent audits: two for security and one for economics – no other crypto project can say the same. HEX was designed to increase by over 10,000x in 2.5 years, meaning it’s only just begun to rise. While its day-to-day value fluctuates, HEX’s smart contract ensures that the quantity of tokens a staker holds will increase gradually over time. To explain how HEX’s smart contract works, I looked to a document written by OG Hexican Kyle Bahr called HEX Contract in Layman’s Terms

I’m incredibly grateful to Kyle for taking the time to lay this all out. I wouldn’t have been able to rewrite this guide without the work he put in first. In fact, the only reason it’s necessary to rewrite the guide at all is because a lot of the features of the contract are now irrelevant since the launch phase is over. Thus, in order to simplify the entire explanation, I’ve edited and expanded upon Kyle’s important work

Introduction: What is HEX?

HEX is the first blockchain certificate of deposit (CD). Built on the Ethereum blockchain, HEX is an ERC-20 token that virtually lends value from stakers to non-stakers, which causes the value of HEX to go up in USD. HEX is the first smart contract to pass a triple audit, ensuring that its economic and security models are both functional and sustainable. More information and FAQ is available at https://HEX.com

This document aims:

  1. to examine the features and bullet points of the project, and
  2. to verify or explain those features in terms of the smart contract

HEX’s founder, Richard Heart, provided working versions of the code to the community’s telegram channel. This document will provide an objective explanation of what the smart contract will do without advice or editorial comment on any of the contract’s features

For a more detailed explanation of Staking and the gains that can be made, please view Kyle’s companion pieceHEX Staking Deep Dive – though I will warn you, it is not revised to reflect how things have changed since HEX’s launch phase concluded

Staking

When you stake HEX, you implement a function of the smart contract, committing your HEX tokens for a certain period of time. Since HEX is truly a decentralized finance (DeFi) project – the only one of its kind – even though your HEX are locked up when they’re staked, you maintain control of your private keys the entire time. Additionally, you get to choose for how long you want to stake your tokens. You set this time in days. The minimum stake length is 1 day, and the maximum stake is 5555 days. The longer you stake, the more interest and rewards you reap; e.g. “longer pays better”

For example, let’s say I stake 10,000 HEX for 10 days. At the end of the stake, I would get back my original 10k HEX, plus 49 additional HEX that I earned in interest, but during the lockup period (which I chose myself), I wouldn’t be able to access the HEX I had deposited without paying a penalty to Early End Stake (but more on that later). This is the smart contract’s Certificate of Deposit function, also known as the “truth engine” because it keeps stakers honest. If you commit your funds for longer than you’re able to leave them and therefore earn a higher interest rate, you’re penalized for violating the terms you agreed to. Essentially, if you don’t hold up your end of the deal, neither does the HEX smart contract. 

But interest isn’t the only way to earn by staking HEX. Payouts are also awarded to stakers based on the number of T-shares (trillion shares) they hold. Payouts occur when stakers (for whatever reason) early end stake their tokens, and whatever penalties they accrue are dispersed to share holders. To calculate payouts, you divide your shares by the total number of shares. This is an important concept in HEX because it means that accruing T-share bonuses is one method of getting the best payout. In fact, accruing more T-shares for better payouts might even be more economical than starting with more HEX. It’s much easier to get a 40% bonus than it is to buy 40% more HEX (see Longer Pays Better / Bigger Pays Better below)

Share Price

To ensure that longer and larger stakes earn the most interest and pay better over time, a pricing mechanism was built into the contract. Every time a stake is ended, the gains for that stake are calculated in the form of a share price. All future stakers will pay that share price to convert their HEX into shares. Note: HEX’s base unit is the Heart. Hearts are to HEX as Satoshis (sats) are to bitcoin. There are 100,000,000 Hearts per HEX

The share price moves relative to return on investment for a stake. For instance, at launch, the share price was 1 share per Heart. Let’s say someone ended a stake with a 20% gain a few days later. That would translate into a share price of ~1.2 Hearts per share. When that person goes to stake again, his or her Hearts would be divided by 1.2 (up 20% from 1) to determine their number of shares. This is how the contract ensures the value of shares will continue to rise.

The exact formula is:

cappedHearts x stakeReturn x SHARE_RATE_SCALE / ((LPB x shares) / (LPB + extraStakedDays));

Where:

  • “stakeReturn” – the total amount paid out for ending the stake
  • “SHARE_RATE_SCALE” – a scalar to maintain precision in the output
  • “shares” – the number of shares in that stake
  • “LPB” – Longer Pays Better, max bonus at 1820 days
  • “extraStakedDays” – the lesser of 3640 and (stakedDays -1)
  • “CappedHearts” – the lesser of your stakeReturn and the maximum Bigger Pays Better figure 

Essentially, this is a calculation of your gains

This equation was designed so that stakers are only ever able to re-enter a stake with the same number of shares they just cashed in at at best, and most often with fewer shares than they previously had, unless they increase their staked HEX or stake duration. 

Thus, the contract guarantees that longer, bigger stakes will pay better over time because no one can play games to get more shares in the system. This also creates a sense of urgency to stake because the share price (relative to Hearts) will only ever increase

Payout Calculation & Interest

Each day, the contract accumulates a payout pool. The payout pool is filled with the daily inflation of 0.00995% of the total coin supply. This equates to 3.69% annual inflation, which is compounded daily. When you fulfill your commitment and end your stake, the contract calculates your total payout from (your Shares/Total Shares x payout for the day). The contract then mints the HEX and credits them to you. Additional inputs to the payout pool are discussed below

Unstaking Gotchas

Early/Emergency End Stake (EES)

If at any time during a staking commitment, a user wants to terminate their stake, they can. The contract allows users to end their stakes early, but the user pays a penalty to do so. The contract is programmed to calculate the payout for half the days committed and subtract that from the funds returned to the user. A 90 day minimum penalty will be applied

For example, let’s say I stake for 364 days (1 year), but I have to emergency end stake after only 266 days. The contract calculates my payout for ½ of my stake (182 days) and flags that as the penalty. It then returns my Principal + payouts from days 183-266

If a user emergency end stakes before they serve ½ of their committed days (or if their stake is fewer than 179 days – due to the 90 day penalty minimum), the penalty may cut into the principal. The contract calculates the payouts from ½ the days or 90 days (whichever is larger), and subtracts that from the returned funds

For example, If I stake for 364 days and then emergency end stake after only 140 days, several steps determine the number of tokens that will be returned to me

  • The contract calculates my payout for 140 days, then estimates a penalty
  • Because I haven’t fulfilled ½ of my commitment, the contract estimates the difference by applying a ratio of half-committed-days / days-served x payout
  • In this example that’s 182 days / 140 days served. Thus, the penalty is 182/140 x payout
  • My returned HEX equals: Principal + payout – penalty
    • The penalty can be defined as a scaled version of the payout so my net HEX returned will be Principal + (140/140 x payout) – (182/140 x payout)
    • Simplified to Principal – (42/140 x payout)
  • That means I will get back less than I put in. Read that again because it’s important: If you Early/Emergency End Stake before serving ½ of your committed days (OR if you stake for less than 179 days, due to the 90 day minimum penalty), you can lose a portion of your principal

Late End Stake

The system also penalizes users for leaving stakes unattended after they’ve matured. The contract allows for a 14-day grace period with no penalty, after which the HEX returned is reduced by 0.143% per day (1% per week)

For instance, if I stake for 364 days, I can end my stake and collect my HEX with no penalty until day 379. After that, the amount of HEX I receive will be reduced by 0.143% per day. The principal is also included in the penalty, so if I’m 700 days late, I will receive 0 HEX

Stake Example

This simplified example ignores the “Bigger Pays Better” bonus to demonstrate how the contract flow works. For more detailed information, please see Kyle’s HEX Staking Deep Dive

  • John, Annette & Richie all buy 10,000 HEX on the same day
  • John stakes 10,000 HEX for 182 days; Annette stakes 10k HEX for 364 days; and Richie stakes 10k HEX for 1820 days
  • For simple math, let’s assume they’re the only 3 stakers, and they each get a share rate of 1:1
  • The contract converts HEX to shares using the “Longer Pays Better” formula (days/1820), resulting in
  • John: 10,000 x (1 + 182/1820) = 11,000 shares
  • Annette: 10,000 x (1 + 364/1820) = 12,000 shares
  • Richie: 10,000 x (1 + 1820/1820) = 20,000 shares
  • Total shares are 43,000

This same process happens for Annette and Richie as well, when their stakes mature

Stake Related Bonuses/Modifiers

All of the bonuses and modifiers described here are advertised on HEX.com and coded within the smart contract. Kyle validated the math and operator precedence using Solidity documentation to make sure the contract really does what it claims it will. I’ve omitted the bonuses and modifiers that are no longer relevant since the launch phase is now over

Modifies the Payout Pool

Early/Late End Stake

These modifiers aren’t bonuses; they’re penalties incurred by other stakers. As described in the “Unstaking Gotchas” section, certain actions incur penalties. Half of all the penalties that are deducted from stakers’ returns are added to the payout pool for the next round. The penalized HEX go into a combined “penalty” pool. Each day, the penalty pool is drained into the payout pool for the next day and reset. Thus, each day’s payout pool increases by the penalties stakers incurred the day before

For example, let’s say 10,000 total HEX were lost to penalties on day ten. Day eleven’s payout pool would be increased by 5,000 HEX. Then, on day eleven, 15,000 HEX are lost on penalties. Day twelve’s payout pool would have an additional 7500 HEX, and so on and so forth

Modifies Your Stake

The bonuses that modify your stake are how your HEX multiplies to become shares. The bonus for “Longer Pays Better” caps at 2x, meaning 3641 days (or about 10 years). The bonus for “Bigger Pays Better” caps at 10% for 150,000,000 HEX stakes. This means that in a 10 year stake, your shares are equal to triple your tokens. With a 75,000,000 HEX stake, you receive a 5% bonus on top. The total after bonuses is the number used to compute shares

Longer Pays Better

The expression “stake it til you make it” didn’t come from nowhere. It exists because the longer you stake, the more you will make. The formula is (days staked – 1) / 1820. This comes out to 20% per stake year

Bigger Pays Better

Size of stake is also a significant factor for accumulating bonuses. The larger your stake, the more you make. The bonus formula is HEX/150 x 10^7. This caps out at 10% for stakes of 150,000,000 HEX. Note: the percentage is capped, the bonus HEX is not

Example Stakes:

  • 1,000,000 HEX = 0.0667% bonus, or 667 HEX bonus
  • 10,000,000 HEX = 0.667% bonus, or 66,667 HEX bonus
  • 100,000,000 HEX = 6.67% bonus, or 6,666,667 HEX bonus
  • 200,000,000 HEX = 10% bonus, or 20,000,000 HEX bonus

The Origin Address (OA)

HEX’s origin address is the element of HEX that naysayers criticize the most. Certain elements of the OA must remain shrouded in mystery, but here’s what we can tell you:

HEX’s smart contract specifies an ETH address as the Origin Address. The contract pays the Origin Address HEX in a few ways

  • The OA receives ½ of all HEX penalties (the other ½ goes to the payout pool)
  • The OA received a copy of all bonus payments from the launch phase

Conclusion

After reading through this simplified guide to HEX’s smart contract, I hope you’re beginning to see why crypto tribalism matters. Put simply: It’s costing you money. In crypto, as in life, money means freedom. I can’t speak for anyone else, but I’m no longer willing to sacrifice my freedom because a bunch of people who didn’t do their own research said HEX was a scam. Are you? 

HEX, like all other assets, is going to fluctuate in value. If you buy HEX today, the price may be down tomorrow, next week, even next month. The further and faster HEX’s price increases, the further and faster it’s likely to drop. But unlike other crypto assets, HEX has long term price protection built in via its Certificate of Deposit staking function. This makes HEX an ideal investment for anyone who doesn’t want to stare at their computer screen all day looking for patterns to try and trade. Instead, with HEX, you can set it and forget it. That’s perfect for someone like me, who wants to keep focusing on the things I love to do that don’t pay me

For more information about HEX, please visit HEX.com and/or the community’s telegram channel

*A friend who I introduced to HEX recently commented that reviews of MetaMask are atrocious and asked if there’s a better way to stake HEX. There sure is! Early HEX enthusiasts Steph & Firebun developed an app specifically for swapping and staking HEX. Staker App is available on both iOS and Android devices for a nominal fee, and has very positive reviews as well as support from HEX’s founder – Richard Heart – himself. If you’re going to use it, I would love for you to use my referral link (but no pressure). For those not currently on mobile who want to use it, my code is: https://staker.app/invite/7mYn