Inspiration

SmartStake was born from a desire to provide the community with a staking platform that overcomes the shortcomings observed in currently available staking solutions.

Drawbacks of traditional staking:

a) Involves transferring NFTs to a third-party smart contract, which conflicts with the principle of "not your keys, not your coins." This approach poses risks, as if the third party is compromised or acts unethically, the NFTs may be permanently lost. Users are faced with a dilemma between safeguarding their NFTs through cold storage or opting for staking.

b) Staking and unstaking NFTs individually can be laborious and time-consuming. Moreover, both actions typically incur transaction fees, making it less practical when dealing with a large number of NFTs.

c) Staking rewards are distributed on a per-NFT basis, necessitating a potentially lengthy and expensive process to claim the rewards. In some cases, the transaction fees required to access the rewards can surpass the value of the rewards themselves, resulting in an unfavorable cost-benefit ratio.

In-wallet staking addresses the security concerns and can even mitigate the time concerns to some degree, but as staking is on-chain there are still substantial costs involved which increase with the number of NFTs staked. It doesn't eliminate the need to go through the process of staking again for newly acquired NFTs. It also introduces a new problem not present with traditional staking in that transferring an NFT to another wallet or selling it can result in the loss of all accumulated rewards.

Aside from the drawbacks already mentioned, both staking methods are inflexible and limited. Changes to the tokenomics in response to market conditions, community feedback, or changing project directions are difficult to accommodate due to the logic being coded into a smart contract. The information that can be drawn upon to calculate rewards is also limited to that which can be provided to the smart contract.

What it does

SmartStake's design elegantly addresses all these issues by using three simple principles:

1) Instead of staking individual NFTs, with SmartStake you stake wallets. All NFTs from the staked collection in the staked wallet(s) automatically generate rewards.

2) Rewards are calculated off-chain, allowing the rewards logic to be changed quickly and easily as needed. A greater range of data can be used in the reward calculations. And rewards can also be calculated far more frequently than on-chain methods, at no cost.

3) Claiming rewards is likewise done on a per-wallet basis. This is the only on-chain transaction in the process. The transaction cost is minimal and does not increase with the number of NFTs staked. Furthermore, by linking wallets one transaction can claim rewards for all linked wallets at once. Again, at no extra cost.

How we built it

SmartStake leverages a substantial amount of pre-existing development on the Theta Rarity platform.

Theta Rarity already provides functionality for user accounts, user authentication and wallet linking. The staking pages build on this functionality by allowing users to stake any of their linked wallets. This has the added benefit of allowing the staking of NFTs in wallets the user doesn't have direct control over, such as ThetaDrop wallets linked with ThetaPass.

Theta Rarity also runs a guardian node which tracks all NFT movements, so we know where every NFT is at any moment. This makes it relatively straightforward to calculate the rewards for each wallet based on the NFTs in that wallet at any moment. In the current implementation, rewards are accumulated once per hour, though this can easily be changed depending on the requirements of individual collections.

It's when claiming rewards that we had to get tricky. Because rewards are calculated off-chain, we couldn't rely on a smart contract to mint the tokens. The process of claiming rewards involves two steps:

1) The user who wants to claim their token rewards submits a transaction to a specially designed smart contract. This transaction has a cost associated with it (1 TFuel, in addition to minimal gas fees). The smart contract transfers the TFuel payment to the owner of the TNT-20 token contract and emits a special event on the blockchain.

2) A script that run on the guardian server observes the event. In response, it looks up the wallet that is claiming the tokens and the number of accumulated unclaimed tokens for that wallet (and any linked wallets). It then mints the requisite number of tokens to the original wallet address. The gas fees associated with this minting step are covered by the initial TFuel payment.

Challenges we ran into

Developing SmartStake presented several challenges that required careful consideration and innovative solutions. Balancing the need for a user-friendly experience with robust security measures demanded a meticulous approach. While our final solution seems simple, there are many moving parts involved, and substantial trial and error involving different approaches was needed before we settled on the current implementation.

The biggest challenge revolved around optimizing the staking process for efficiency and cost-effectiveness. We aimed to minimize transaction fees and reduce the time required for staking and unstaking individual NFTs, particularly when users held a large number of tokens.

By making it easy to transfer or sell staked NFTs, it can be argued that the solution as presented does not encourage long term holding. There are several reasons why the creator of an NFT collection might want to set up staking rewards, and encouraging long term holding is just one. That said, it is our position that such behaviour is better encouraged by crafting the reward algorithm to benefit longer term holders, rather than forcing it upon them by such things as draconian lock-up periods or even just by making the process of unstaking difficult or costly.

We anticipate that the most substantial hurdles lie ahead, and intriguingly, they may not primarily stem from technical complexities but rather be rooted in matters of perception and reception.

Accomplishments that we're proud of

Our proudest accomplishment to date is in partnering with Theta Dragons as our inaugural staking partner. SmartStake is already being used to provide staking rewards to Theta Dragons holders.

In more general terms, we are immensely satisfied to have been able to successfully address and overcome all the shortcomings we documented earlier. In particular:

Security: As there are only two smart contracts — a standard TNT-20 token contract and a very simple contract used for claiming — attack vectors are minimized. As NFTs never leave the owner's wallets, even in a worst case scenario, users' NFTs are completely safe.

Time Saving: Staking time is proportional to the number of wallets, not the number of NFTs. Even the time needed to stake a wallet is reduced as no on-chain transaction is needed. No additional time needs to be spent on staking when additional NFTs in a staked collection are acquired. And claiming time is reduced to a single transaction for all staked wallets and NFTs.

Cost Saving: The cost to stake is nil. The cost to claim rewards for any number of NFTs in any number of wallets is approximately 1.1 TFuel, making it extremely cost effective.

Straightforward: As rewards are accumulated every hour, there is minimal loss of rewards should the NFT be transferred to another wallet or sold. It is even possible to set up the rewards algorithm so that the owner of an NFT listed in a marketplace smart contract will continue to accumulate rewards until the moment of sale (this option is configurable, and can be turned on or off).

Flexibility is achieved by keeping the rewards algorithm off-chain, which allows changes to be made simply and quickly when needed, and enables the use of a much wider range of data inputs when calculating rewards.

Community feedback

We timed the launch of SmartStake to coincide with the original Hackathon submission deadline. However, as that deadline was extended by a week it's given us the opportunity of reporting on how the product has performed in practice during the first week of its launch, and whether it met our expectations.

Feedback received from the community suggests that it has not just met expectations, it has nailed them! Here are some of the comments received from community members.

"Staking system is literally amazing" "Easiest staking ever" "Totally agree, most impressive!" "staking is F**n rad" "Thank you ... for making a staking protocol that i dont have to spend tfuel on!" "arguably the easiest staking I have done" "Definitely so much better than pressing button after button ... For hours"

After one week over 2,500 dragons are being staked, which is 75% of the total number! Over 400,000 $FIRE tokens have been minted already and another nearly 700,000 are still to be claimed. Together, that is more than 0.1% of the maximum token supply. A great start!

What's next for SmartStake

At this point we feel it's important to note that none of the above discussion is intended to be a commentary on any existing staking product. Each collection has different needs from their staking, and SmartStake will not be the right solution for everyone.

Presently, SmartStake is perfect for NFT creators who want a straightforward stake-and-earn mechanic for their collections, and don't necessarily have the technical expertise to create it in-house.

With SmartStake, we can work with creators to determine their requirements, advise on tokenomics, create the smart contract for their TNT-20 token, implement the rewards algorithm, and add it to the Theta Rarity site where it's immediately accessible.

SmartStake would be especially beneficial for NFT collections on ThetaDrop, as there's no need for owners to withdraw their NFTs from that platform to stake them (although they could – that is up to them!). Using ThetaPass, NFTs in the owner's ThetaDrop wallet can still be staked, and rewards claimed to one of their linked wallet addresses.

Initially, we hope to attract more NFT creators whose requirements align with the solution we're offering.

Beyond that, we will be adding an API integration to the staking functionality that will allow creators to integrate SmartStake on their own websites without having to build their own staking infrastructure. The flexibility of the rewards algorithm will ensure that any required functionality could be supported, and creators can focus their efforts on the user experience instead.

+ 13 more
Share this project:

Updates