On December 6th, Matic Network’s very own core Protocol Developers, Vaibhav Chellani, Ashish Rajpurohit, Venkatesh Mankena & Project Manager, Ateeta Sharma joined Matic community group for an AMA centered on the topic–Counter Stake & Staking Process, hosted by our Community Manager, Nirbhik Jangid.
We’d like to thank those who attended and asked insightful questions to the Matic tech team! For those who want to learn more about the staking process for Matic and was unable to attend the AMA, this is for you–
Vaibhav – Hey guys! I am Vaibhav Chellani and I work on the validator and block producer layer of Matic Network, other than that I research on different essential mechanisms which are required by a POS network to work like validator selection, validator replacement and so on. I am a firm believer of the L2 space. I am super excited to share our work of the past few years with everyone
Ashish – Hello everyone, I work on Plasma and Staking implementation and research including Proof of Stake design mechanism at Matic Network. I actively do research on blockchain scaling, cryptoeconomics and game theory.
Ateeta – I am working on the Matic Network’s Staking initiative from product perspective; Economics and incentives and design and planning our testnet event – Counter Stake
Venkatesh – Hey Everyone! This is Venkatesh. I am glad to be here. I have been working on staking and rewards system lately. Looking forward to resolve your queries.
Nirbhik: I understand that Matic was started to solve the longstanding blockchain scalability problem. As a protocol developer, can you briefly describe the value of Matic?
Venkatesh: Matic Layer 2 is an account-based variant of MoreVP (More Viable Plasma). The Plasma framework is used to guarantee the security of assets on the main chain (such as ERC-20 and ERC-721 tokens for Ethereum), while generic transactions are secured by a Proof-of-Stake network, built on top of Tendermint. Matic sidechains are essentially EVM-enabled chains and are conducive to ready deployment of solidity smart contracts, essentially making it an easy tool for Ethereum Developers to use it for scaling their DApps/Protocols.
Matic’s core philosophy is to enable dApps to compete with the user experience that is offered by centralized apps today.
Ethereum is the first basechain Matic Network supports, but Matic intends to offer support for additional basechains, based on community suggestions and consensus, to enable an interoperable decentralized Layer 2 blockchain platform.
Nirbhik: From a protocol developer’s perspective, can you take us through the Matic architecture?
Ashish: Developers can use Plasma for specific state transitions for which Plasma predicates have been written such as ERC20, ERC721, asset swaps or other custom predicates. For arbitrary state transitions, they can use PoS. Or both! This is made possible by our hybrid construction.
To enable the PoS mechanism on our platform, we employ a set of staking management contracts on Ethereum, as well as a set of incentivized validators running Heimdall and Bor nodes.
Heimdall is the PoS validator node that works in consonance with the Staking contracts on Ethereum to enable the PoS mechanism on Matic. We have implemented this by building on top of the Tendermint consensus engine with changes to the signature scheme and various data structures. It is responsible for checkpointing a representation of the Plasma blocks to the main chain in our architecture.
Blocks are produced at the Bor node which is basically the sidechain operator. The sidechain VM is EVM-compatible. Currently, it is a basic Geth implementation with custom changes done to the consensus algorithm. Blocks produced on Bor are validated by Heimdall nodes, and a checkpoint consisting of the Merkle tree hash is committed on Ethereum periodically.
Nirbhik: Can you take us through the entire Matic Network staking design?
Ateeta: Matic Network relies on a set of validators to secure the network. The role of validators is to run a full node; produce blocks, validate and participate in consensus and commit checkpoints on the main-chain. To become a validator, one needs to stake their Matic tokens with staking management contracts residing on the main-chain.
Heimdall reads the events emitted by the staking contracts to pick the validators for the current set with their updated stake ratio, which is used also by Bor while producing blocks.
Delegation is also recorded in the staking contracts and any update in the validator power or node signer address or unbonding requests comes into effect soon when the next checkpoint gets committed.
Rewards are distributed to all stakers proportional to their stake at every checkpoint with an exception being the proposer getting an additional bonus. User reward balance gets updated in the contract which is referred to while claiming rewards.
Stakes are at risk of getting slashed in case the validator node commits a malicious act like double signing which also affects the linked delegators at that checkpoint.
Nirbhik: What is the end-to-end flow for a Matic validator?
Vaibhav: Validators set up their signing nodes, sync data and then stake their tokens on the Ethereum staking contracts to be accepted as a validator in the current set. If a slot is vacant, the validator is accepted immediately. Otherwise, one needs to go through the replacement mechanism to get a slot.
Block producers are chosen from the validator set where it’s the responsibility of the selected validators to produce blocks for a given span.
Nodes at Heimdall validate the blocks being produced, participate in consensus and commit checkpoints on the Ethereum main-chain at defined intervals.
The probability of validators to get selected as the Block producer or Checkpoint proposer is dependent on one’s stake ratio including delegations in the overall pool.
Validators receive rewards at every checkpoint as per their stake ratio, after deducting proposer bonus which is disbursed to the checkpoint proposer.
One can opt-out of the system at any time and can withdraw tokens once the unbonding period ends.
Nirbhik: What is the end-to-end flow for a Matic delegator?
Ashish: This is for the people who are holding Matic tokens but do not wish to run a validator node. They have an option to stake their tokens with any validator of their choice after verifying a validator’s performance and the commission charged. This needs to be done via a transaction on the Ethereum staking contracts.
The tokens get bonded with the next checkpoint being committed on the main-chain. Delegators also have an option to opt out of the system whenever they want and similar to validators, they will also have to wait for the unbonding period to end before withdrawing their stake.
Delegators also have an option to re-delegate their tokens with another validator.
Rewards are accumulated at every checkpoint.
Nirbhik: Where do staked tokens reside? Are they bonded? What is the bonding/unbonding period? Do rewards accumulate during either of these periods?
Venkatesh: Staked tokens reside in the staking management contracts deployed on the main-chain. There is no minimum time period for which one needs to bond their tokens.
Bonding happens with the next checkpoint being committed on the main-chain. One can choose to opt out of the system anytime but will have to wait for unbonding period (~ 21 days) to get over before withdrawing.
Nirbhik: How are staking rewards calculated? How are rewards disbursed? Eg. smart contract, in protocol, by validator tx
Ashish: Staking reward to be given out at every checkpoint is fixed. Which means that if 30% of circulating supply is staked at any given time during the first year, the reward rate for stakers at this target bonding rate will be around 20%. If half of target is staked, then the reward rate doubles to 40%.
Rewards are distributed at every checkpoint. Protocol checks for individual’s stake ratio in the pool and updates the user balance in the staking management contracts which is referred to while claiming rewards.
Nirbhik: What are the risks involved in staking? Are these dynamic? Eg. slashing, missed rewards
Venkatesh: Your funds are at risk of being slashed in the event of extended downtime or double signing. A validator is not removed from the set by the protocol however, bad performance would make the validator node easily replaceable.
Nirbhik: What is the value of Counter Stake Wars for participants and for Matic Network? How will it work? Who do you want to see involved and how can they help?
Vaibhav: The purpose of conducting this public testnet event is to get the final Matic mainnet ready. It will help us to get our network fully robust, fix open issues, identify loopholes if any and simulate the mainnet conditions on test environment first and experiment a bit with data points like proposer bonus or replacement factors etcetera.
Counter Stake will be conducted in stages; Stage 0 is basically the only setup and understanding the network. Stage 1 is where we open staking for public and incrementally release features like rewards, slashing replacement. Here, participants will practice and monitor their uptime before the battle begins in the final stage. Stage 2 is where all participants begin at the same level and in the end, the one with the most stake wins.
More than 3 million mainnet Matic tokens will be shared with participants of Stage 1 and Stage 2. Special bug bounties for our hackers in place!
Nirbhik: What all the challenges you guys have faced while building the staking?
Vaibhav: The architecture that we have at Matic is unique, we have an EVM enabled probabilistic finality chain called BOR and a slow but instant finality chain called Heimdall which send state snapshots to mainchain, so having proper sync between all the layers was a really interesting problem to work on 🙂
Nirbhik: How is our Proof of Stake implementation different from others?
Ashish: Matic Layer 2 is an account-based variant of MoreVP (More Viable Plasma). The Plasma framework is used to guarantee the security of assets on the main chain (such as ERC-20 and ERC-721 tokens for Ethereum), while generic transactions are secured by a Proof-of-Stake network, built on top of Tendermint. Matic sidechains are essentially EVM-enabled chains and are conducive to ready deployment of solidity smart contracts, essentially making it an easy tool for Ethereum Developers to use it for scaling their DApps/Protocols.
Mike (@Mike1945): Launched staking? Could you discuss this further? Let us know step by step to follow the staking?
What percentage of profits do we get if we take staking?
Ateeta: So we just launched our public testnet event where we try staking and the working of the network. Our stages are defined in an incremental manner where you will get to learn how to set up in stage 0 (on-going) then followed by stage 1 where you stake and participate in validation, more like a practise round followed by stage 0 where the battle begins.
For the first year, if 30% of the total circulating supply is staked, you can expect reward rate of about 20%. More reward if less is staked. You can read more on our economics here: https://docs.matic.network/staking/economics/
Mario Boy (@alttire): Can you let us now some most important reasons why someone should invest in Counter Stake ?
Whats advantage in Counter Stake?
Vaibhav: The participants of the Counter Stake will be able to understand how the whole system works before it is released on mainnet and will be able to launch with a tested infra when we go to mainnet, other than that we have More than 3 million mainnet Matic tokens that we plan to share with the validators.
We have started with Stage 0 of the event and are on the second testnet of the stage, a lot of people have been able to join the network successfully! We are planning to run the event for a some-more week till we have tested everything that we can and have worked on multiple attack scenarios.
Jo Mo (@repeater181): Do you plan on developing a staking interface so that it’ll be easier for laymen?
Venky: Yes. We are building a staking interface which will be released in next stages of Counter Stake. This interface will be very intuitive for laymen to check the current state of Validators, Rewards, to do Stake Operations etc.
Sasmita Angelyn (@iyanbgz): Q1: Why did you choose Proof-Of-Stake as the consensus algorithm and how exactly are you going to solve the problem of centralizing the network $MATIC?
Q2: What is the minimum number of tokens needed for staking ? or is it like I can stake/delegate with any number of tokens?
Ashish: A1: In layman’s terms Proof of stake is economically and computationally cheaper to run so that we can bring more validators for a more decentralized network. Apart from that, we are trying to avoid centralization in the system as much as possible with neat designs mechanisms like replacement policy and proportional slashing.
A2: Right now the minimum number of tokens is 1 Matic token for both validator and delegators since for validators there is replacement policy so that other validators can stake higher amount than existing validators to become Matic validator.
Niels (@Niels001): How do we know that the commission asked is fair? And tokens are distributed correctly to token holders?
Vaibhav: The network is intended to be decentralised, we don’t control anything, validators are businesses and the commission is how they remain sustainable, it’s totally up to the validator to decide the percentage.
Ashish: Commission rates are decided by validators and agreed by delegators, so delegators have always option to pick different validator. Since it’s competitive market commission rates will always be in check.
Aura2 Aksia (@Aurha08): Important question as an investor :
DEMAND > supply = Price increases
Demand < supply = Price decrease
My question also related to the demand, which is important for investors
How will demand of $MATIC token increase in the future? What should you do to increase MATIC demand?
Vaibhav: Matic token is used for staking and for transaction fees on the network, we expect massive amounts of token to be locked via staking and with the huge adoption we are gaining transaction fees should also become more relevant.
If you have more queries, please join here: https://discord.gg/XvpHAxZ