Proof of Stake Membership

Okay Just before you read this post and judge me of my writing … This is my first Official forum post so please be a bit kind on the Comments :wink:

So I Just wanted to share about our implementation of Proof-of-Stake-Membership in ICFC… thats right Membership based on Proof-of-Stake.

Why Proof-of-Stake Membership

  1. Why Not? Just imagine a membership mechanism where both the DAO and the Users are rewarded for their commitment to the DAO.
  2. Think about where users become the owners where they just prove their loyalty by locking the neurons and the DAO too is safe from tokens becoming volatile.
  3. Isn’t this a win-win for everyone? While users can happily use their Membership to access features, get perks and rewards while the DAO becomes immune to bot activities .
  4. And end of the dissolve delay the users can get to keep their Tokens back while having used all the perks the DAO has to offer .

How does it work?

  1. Well it all starts with the user locking up our tokens (ICFC) in neurons on NNS for the maximum delay (For ICFC its 2yrs 13hrs) in non-dissolving state.
  2. After which the users needs to add their ICFC Principal ID as hot-key in those neurons.
  3. We then fetch this information from the Governance Canister and calculate which tier of membership the user is eligible for.
  4. We currently offer 4 Tiers of Membership each requiring a certain amount of tokens to be staked PS. not necessary for all the tokens to be in a single neuron we will sum up the tokens on the neurons where the hot-key is set.
  5. Same Neurons cant be used to claim membership for different princiapl IDs
  6. We have set a Timer for expiring Monthly and Seasonal memberships. There is a Auto-Renewal Feature too which is implemented for things to be Idempotent.

How did we do it? (This is about to get too technical :slight_smile: )
The complete code is available on our github-repo
But i would like to walk you’ll through some important stuff…

  1. We have written a SNS-Manager a utility code to help us fetch the users-neurons from the Governance canister.
  2. Now comes the important Implementation .

    This function getUserNeurons returns the callers verified neurons, the Membership Tier they are eligible for and the totalStakedTokens (at non-dissolving and max-delay).
  3. Lets break down the function in previous step… … We start with first fetching the users neurons with the help of our SNS-Manager .. This returns us the neurons where the user has set their icfc-princiaplId as hot-key. After which we run the neurons through a utility function called getMembershipType which goes through the users neurons, checks if it is in non-dissolving state and sums the token amount of neurons whose dissolve-delay is set to a minimum of 2 years. This returns a dto consisting of eligibleNeuronIds (considered eligible if followed the constrains of non-dissolving and a min dissolve-delay of 2yrs) along with MembershipType (calculated on the summation of tokens which follow the same constraints).
  4. So once we get the userEligibility(Contains eligibleNeuronIds and MembershipType) from getMembershipType now these eligibleNeurons are passed through a validity check validNeurons (Basically checks with our data to see if these neurons are actively been used by a different user for their membership).
  5. If the neurons fail the validity check then they are returned as InEligible else the proper Eligibility is returned to show the users their neurons which they can use and their Eligibility.
  6. Profile Creation and Membership Claiming uses the same flow to verify the users Memberships.

Now Lets talk about Membership Expiration and Renewals

  1. All the memberhsip claims and the Users current Membership along with the expiration time is stored in the Profile type.
  2. A single Timer is run which triggers a function to checkMembership every 24hrs
  3. The above function goes through our profile canisters and checks through all the profile’s membershipExpiryTime in each canister and if it is past the time then it expires the Profiles membership.
  4. Once the Profile canister updates the Profile data, it informs the backend canister to remove the active neurons the profile used for the membership it had.
  5. After successful removal of neurons from active membership we call claimMembership which automatically does the renewal process for the user.
  6. Full code of the claimMembership can be found here.

And that concludes our approach…

  • I hope you guys liked this Post!
  • Do let me know guys what you’ll think of this feature. And i hope to see many DApps adopting it, as it is a Win-Win strategy for both the Users and the DAO
5 Likes

Soon … I will share about our Idempotent Approach of ICFC Membership Sale. How the tokens are distributed the logic behind the raise(A lot of Timers) … Stay tuned!

2 Likes

John,

This is the DAO implementation you have done for the ICFC: Football Ownership Unleashed game correct.

I think you should make that clear from the beginning, because it is confusing how you use the SNS Manager term.

Still, great job!

Joseph

1 Like

Look at the first bit:

Clearly states it’s for ICFC, couldn’t mention DAO more.

Using the term SNS_Manager with a github linked file is fine John. Great post.

2 Likes

I did think so James, thanks for the confirmation, and a custom DAO is for now the best approach by far as recent events have showed us.