polygon – Finematics https://finematics.com decentralized finance education Thu, 29 Apr 2021 19:32:18 +0000 en-GB hourly 1 https://wordpress.org/?v=5.8.1 https://finematics.com/wp-content/uploads/2017/09/cropped-favicon-32x32.png polygon – Finematics https://finematics.com 32 32 Polygon PoS Chain – A Commit Chain And Not A Sidechain? https://finematics.com/polygon-commit-chain-explained/?utm_source=rss&utm_medium=rss&utm_campaign=polygon-commit-chain-explained&utm_source=rss&utm_medium=rss&utm_campaign=polygon-commit-chain-explained https://finematics.com/polygon-commit-chain-explained/#respond Thu, 29 Apr 2021 19:32:17 +0000 https://finematics.com/?p=1335

So what is a commit chain? How is it different from a sidechain? And what makes Polygon Commit Chain a commit chain rather than a sidechain? We’ll answer all of these questions in this article. 

Let’s start with understanding what exactly a sidechain is. 

Sidechain 

A sidechain, in essence, is a separate blockchain that can be used as one of the ways of scaling a Layer 1 blockchain such as Ethereum or Bitcoin. As the name suggests, a sidechain runs in parallel or “on the side” of the main chain. 

Sidechains have their own consensus mechanisms usually in the form of Proof-Of-Stake, Delegated-Proof-Of-Stake or Proof-Of-Authority. 

Sidechains allow users to send their tokens from the main chain and receive them on the sidechain. Once the funds are transferred to the sidechain they can be used within the sidechain ecosystem. Similarly, users can withdraw their tokens from a sidechain back to the main chain. The whole process is called a 2-way peg or a 2-way bridge. Thing to note is that once the user tokens are on the sidechain then they are completely reliant on the consensus mechanism of the sidechain

Initially, all scaling solutions such as sidechains, Plasma and rollups were classified as Layer 2 solutions as they are built on top of Layer 1. 

After a while, the Ethereum community started differentiating between scaling solutions fully secured by the Ethereum main chain – Layer 2 and other scaling options with their own consensus mechanisms – sidechains. At the moment, pretty much all scaling solutions are classified as either one or the other. 

When it comes to Polygon Commit Chain, it is worth differentiating it from a sidechain as it has a lot of extra features that rely on the security of the main Ethereum layer.

Let’s review them one by one. 

Permissionless Validators on Ethereum

Many sidechains use a consensus mechanism that limits the number of entities able to verify the chain. For example, in a Delegated-Proof-Of-Stake (DPoS) there are usually 21 validators who are chosen by the token holders and only these validators are able to validate the state of the blockchain. Similarly, in a Proof-Of-Authority (PoA) model the chain initiator chooses authorities to run the chain. This excludes most participants and creates a situation where only a selected few are responsible for making sure the transactions are validated correctly.  

In Polygon PoS Chain anyone can join the network and start validating the state of the blockchain. This is important as it allows any participants to become validators and check by themselves that all transactions are processed correctly. 

Validators on Polygon PoS Chain have to stake their MATIC tokens and run a full node. 

MATIC tokens are staked on the Ethereum main chain. This is also where the set of all validators is maintained. If a validator starts acting in a malicious way, for example, by double signing or having a significant downtime their stake is slashed.  

This is also a good time to introduce 2 core components of the Polygon PoS Chain architecture – Heimdall Chain and Bor Chain.

Heimdall & Bor

Heimdall works in conjunction with the Stake Manager contract deployed on the Ethereum mainnet to coordinate validator selection and updating validators.

Since staking is actually done on the Ethereum smart contract, we don’t have to rely on validator honesty and instead inherit Ethereum chain security for this key part. Even if a majority of validators collude and start acting maliciously, the community can come together and redeploy the contracts on Ethereum to fork out, i.e. slash the malicious validators, and the chain can continue to operate as intended. 

Heimdall is also responsible for checkpointing – more on this later in the article. 

Bor is the block producer layer of the PoS Chain architecture that is responsible for aggregating transactions into blocks. 

Bor block producers are a subset of the validators that are periodically shuffled by the Heimdall validators. Block producers are selected to validate blocks only for a set number of blocks, also called “span”. After this time period, the selection process is triggered again. 

Let’s have a closer look at the process of selecting block producers

  1. Let’s suppose we have 3 validators in the pool, and they are Alice, Bill and Clara.
  2. Alice staked 100 MATIC tokens whereas Bill and Clara staked 40 MATIC tokens each.
  3. Validators are given slots according to their stake, as Alice has 100 MATIC tokens staked, and there are 10 tokens per slot (maintained by validator’s governance), Alice will get 5 slots in total. Similarly, Bill and Clara get 2 slots in total.
  4. All the validators are given these slots [ A, A, A, A, A, B, B, C, C ]
  5. Using the historical Ethereum blocks as a seed we shuffle this array.
  6. After shuffling the slots using the seed we get this array [ A, B, A, A, C, B, A, A, C]
  7. Now depending on Producer count(maintained by validator’s governance), we pop validators from the top, for eg if we want to select 5 producers we get the producer set as [ A, B, A, A, C]
  8. Hence the producer set for the next span is defined as [ A: 3, B:1, C:1 ].
  9. Using this validator set and Tendermint’s proposer selection algorithm we choose a producer for every sprint on Bor.

This model allows anyone to participate in securing the network with any amount of MATIC tokens. It also doesn’t sacrifice the speed of transaction as not all validators have to validate blocks all the time. 

Let’s go back to the other important function of Heimdall – checkpointing. 

Checkpointing 

Checkpoints are important as they provide finality on the Ethereum chain.

Heimdall layer allows for aggregating blocks produced by Bor into a single Merkle root and periodically publishing it to the Ethereum main chain. This published state is also called a checkpoint hence the whole process is known as checkpointing. 

Checkpoint proposers are initially selected via Tendermint’s weighted round-robin algorithm. A further custom check is implemented based on the success of checkpoint submission. This allows Polygon PoS Chain to decouple from Tendermint proposer selection and provides it with abilities like selecting a proposer only when the checkpoint transaction on the Ethereum mainnet succeeds or submitting a checkpoint transaction for previous blocks if the checkpoint transaction failed. 

Submitting a checkpoint on Tendermint is a 2-phase commit process. A proposer, selected via the above-mentioned algorithm, sends a checkpoint with their address in the proposer field and all other proposers validate it.

The next proposer then sends an acknowledgement transaction to prove that the previous checkpoint transaction has succeeded on the Ethereum mainnet. Every Validator set change will be relayed by the validator node on Heimdall which is embedded onto the validator node. This allows Heimdall to remain in sync with the Polygon contract state on the Ethereum mainchain at all times.

The Polygon PoS Chain contract deployed on the main chain is considered to be the ultimate source of truth, and therefore all validation is done via querying the Ethereum main chain contract.

Checkpoints also provide “proof of burn” in the withdrawal of assets. 

Speaking about withdrawals, let’s have a look at another important element of the PoS chain – the two-way Ethereum Bridge.

Two-way Ethereum Bridge

Typical two-way bridges rely on a small set of authorities which are often not even staked, nor part of the sidechains’s validators set – basically bridges are often operated, i.e. controlled by several PoA signers. This is a significant security concern.,. 

Polygon provides 2 separate ways for moving assets between Ethereum and Polygon – Plasma Bridge and the PoS Bridge.

Plasma Bridge provides increased security guarantees due to the Plasma exit mechanism. However, there is a 7-day withdrawal period associated with all exits/withdrawals caused by certain restrictions in the Plasma architecture. 

The PoS Bridge doesn’t have this restriction and it is secured by a robust set of validators that we discussed earlier in this article. The state of these validators is maintained on the Ethereum mainnet and they are secured by all the funds staked in the system – around $500M at the time of writing this article. To the best of our knowledge, the PoS bridge is the only bridge secured by the whole validator set of a bridged chain; bridges are normally secured by a small set of PoA signers, as already mentioned earlier. 

As we can see, Polygon PoS Chain offers a lot of extra security measures based on the Ethereum main chain and it is not just a mere sidechain. Perhaps, a commit chain is a better name for it. 

So what do you think about Polygon Commit Chain? Do you think it’s valuable to differentiate it from a sidechain?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

]]>
https://finematics.com/polygon-commit-chain-explained/feed/ 0
Polygon (Matic) – Ethereum’s Internet Of Blockchains https://finematics.com/polygon-matic-explained/?utm_source=rss&utm_medium=rss&utm_campaign=polygon-matic-explained&utm_source=rss&utm_medium=rss&utm_campaign=polygon-matic-explained https://finematics.com/polygon-matic-explained/#respond Sun, 14 Mar 2021 17:33:58 +0000 https://finematics.com/?p=1285

So what is Polygon, previously Matic, all about? How will it help with scaling Ethereum? Why does it claim to be Ethereum’s Internet of Blockchains? And why is it sometimes compared to Polkadot and Cosmos? You’ll find answers to these questions in this article. 

Now, let’s see how Polygon came into existence. 

Matic Network

Before the rebranding to Polygon, the project was known as Matic or Matic Network.

Matic was started in 2017 by 3 founders who were active participants in the cryptocurrency community in India and decided to band together and tackle Ethereum’s scaling problems. 

The team worked on 2 main solutions:

Plasma Chains – a layer 2 scaling solution based on Matic’s implementation of Plasma and a PoS Chain – a Proof-Of-Stake Ethereum sidechain. 

The token behind Matic Network – MATIC – was distributed through the Binance Launchpad’s initial exchange offering in April 2019 and the team was able to raise $5.6M. 

After over 2.5 years of work, The Matic Network Mainnet went live in mid-2020 and quickly started attracting more and more attention. This was supercharged by the increasing gas fees on Ethereum that showed an urgent need for finding robust scaling solutions.  

Polygon Rebranding

At the beginning of 2021, the Matic team decided to expand the scope of their project and rebranded themselves to Polygon. 

Polygon aims at creating a more generalised scaling solution. 

When it comes to scaling there are 2 main ways of doing it: Layer 2 scaling and sidechains. 

Layer 2 scaling relies on the security of the main layer – the Ethereum blockchain. Plasma, Optimistic rollups and ZK rollups are the most popular options. 

Sidechains rely on their own security models, usually by having a separate consensus mechanism. Matic PoS chain or xDai are good examples here.

If you’re interested in learning more about these different scaling solutions you can check out this article here

Instead of providing one or two scaling solutions, Polygon aims at creating an ecosystem that makes it easy to connect multiple different scaling solutions – everything from sidechains with different consensus mechanisms to Layer 2 options such as Plasma, Optimistic Rollups and ZK rollups. 

We can think about the existing Matic scaling solutions – the PoS and the Plasma chains basically becoming one of many scaling options available in the whole Polygon ecosystem. 

Polygon also provides a framework that makes it easy for new projects to quickly build their own highly-customisable scaling solution if they decide this is the path they want to choose. 

Now, let’s have a closer look at the technology behind Polygon to understand the project a bit better. 

Polygon Architecture

Polygon supports two major types of Ethereum-compatible blockchain networks: stand-alone networks and secured chains – networks that leverage a “security as a service” model. 

Stand-alone chains rely on their own security, for example, they can have their own consensus models such as Proof-Of-Stake or Delegated-Proof-Of-Stake. These kind of networks are fully sovereign which presents them with the highest level of independence and flexibility, but it makes it more difficult for them to establish a reliable security model. For example, PoS requires a high number of reliable validators. This kind of model is usually suitable for enterprise blockchains and already established projects with strong communities. 

Secured chains utilise the “security as a service” model. This can be either provided directly by Ethereum, for example via fraud proofs used by Plasma, or by a pool of professional validators. These validators are run in the Polygon ecosystem and they can be shared by multiple projects – a concept similar to Polkadot’s shared security model. Secured chains offer the highest level of security but sacrifice independence and flexibility. This model is usually preferred by startups and security-focused projects. 

As we’ve probably noticed, the distinction between stand-alone chains and secured chains is even more generic than the usual split between sidechains and layer 2 solutions that we described earlier. This allows Polygon to accommodate pretty much all possible scaling solutions. 

Now, as we know what kind of solutions are supported by Polygon, let’s dive a bit deeper into the architecture. 

Polygon architecture consists of 4 abstract and composable layers. 

The Ethereum Layer. Polygon chains can use Ethereum as their base layer and leverage Ethereum’s high security. This layer is implemented as a set of smart contracts on Ethereum and can be used for things like finality and checkpointing, staking, dispute resolution and messaging between Ethereum and Polygon chains. 

This layer is optional as Polygon-based chains are not obligated to use it.

The next one is the Security Layer. This is another non-mandatory layer that can provide a “validators as a service” function. This function allows Polygon chains to make use of a set of validators that can periodically check the validity of any Polygon chain in return for a fee.  

This layer is usually implemented as a meta blockchain that runs in parallel to Ethereum and is responsible for things like validator management – registering/deregistering, rewards, shuffling and Polygon Chains validation. 

The Security Layer is fully abstract and can have multiple implementations with different characteristics. This layer can also be implemented directly on Ethereum and leverage Ethereum’s miners as validators. 

The next layer is the Polygon Networks Layer. This is the first mandatory layer in the Polygon architecture. This layer consists of sovereign blockchain networks where each network can maintain the following functions: transaction collation, local consensus and block production. 

Last, but not least is the Execution Layer. This layer is responsible for interpreting and executing transactions that are included in Polygon’s chains. It consists of the execution environment and execution logic sublayers. 

The main takeaway when it comes to Polygon’s architecture is that it is deliberately made to be generic and abstract. This allows other applications, that are looking to scale, to choose the best scaling solution that perfectly fits their needs. 

As we know, different applications may want to optimise for different things such as security, transaction speed, transaction cost or sovereignty and to excel in one of them usually means making a sacrifice somewhere else. 

As an example, a DeFi protocol that aims at storing billions of dollars locked in smart contracts probably wants to optimise for security and might be happy with sacrificing sovereignty. A protocol like this would most likely use the Ethereum Layer. 

Another project, let’s say an NFT marketplace, may want to optimise for ultra-low transaction costs and would be ok with making a sacrifice by lowering their security from extremely high to high enough. Such a project could skip the Ethereum Layer and rely on the Security Layer, with a set of shared validators. 

Or maybe a blockchain-based game wants to rely on its own consensus mechanism with ultra-fast block time. In this case, they can entirely skip both the Ethereum and the Security Layer and focus on the Polygon Network Layer. 

As we can see, Polygon can provide multiple options and the teams behind different applications can decide to pick the one that perfectly fits their use cases. It also aims at making it easy to migrate from one scaling solution to another one. This might be needed if the circumstances behind a project change, or if another better scaling solution becomes available.

This architecture also allows for multiple different Polygon-based scaling solutions to communicate with each other. This is super important, as it prevents creating siloed systems. 

At the moment, the only scaling solutions available in the Polygon ecosystem are the Matic PoS chain and the Matic Plasma Chain solutions. The team is also actively working on adding multiple other options such as ZK rollups, optimistic rollups, enterprise chains and other side chains.

Currently, projects launching on Polygon start with the Matic PoS and the Matic Plasma Chains.

Matic PoS Chain And Matic Plasma Chains

Matic Plasma Chains is an Ethereum Layer 2, predicate-based Plasma implementation. Plasma, in essence, is a framework for building scalable decentralized applications.

Plasma allows for offloading transactions from the main chain into child chains which enables fast and cheap transactions. One of the drawbacks of Plasma is a long waiting period for users who want to withdraw their funds from Layer 2. Plasma cannot be used to scale general-purpose smart contracts.

Matic PoS Chain is a permissionless sidechain and runs in parallel to the Ethereum chain. The chain is secured by the Proof-Of-Stake consensus mechanism with its own validators. 

Although Matic PoS Chain has its own consensus mechanism it also relies on Ethereum’s security when it comes to validator staking and checkpoints. 

Matic PoS chain is EVM-compatible, which allows Ethereum-based projects to effortlessly migrate their smart contracts. 

So far, Matic PoS Chain and Matic Plasma Chains were able to onboard over 80 applications, process over 5M transactions and secure over $200M of users’ funds.

Some of the projects that have either already migrated to Matic PoS Chain, launched directly on Matic, or are in the process of migrating include Quickswap – a fork of Uniswap, Sushiswap, Aavegotchi, Polymarket, Polkamarkets and Superfarm.

Besides that, infrastructure projects such as The Graph and Chainlink also decided to expand to Polygon. 

Recently, Polygon also announced a partnership with a big player in the video gaming industry – Atari.

Summary

So far, it looks like Matic’s rebranding to Polygon and the expansion of the scope of the project was a really good idea. 

This is mainly because it becomes clearer and clearer that there will be a spectrum of different scaling solutions available in the future. 

In the new architecture, Polygon can facilitate connections between these different scaling options. 

It also looks like there is a big focus on both optimistic rollups and ZK rollups which Polygon can also add to the multitude of available scaling solutions. 

The main risk here would be if one of these popular scaling technologies gets adopted on its own without integrating with Polygon. But even if this happens, there is a chance that this technology would eventually be integrated into Polygon anyway.  

It will be interesting to track Polygon’s progress when it comes to adding more scaling options and onboarding more and more projects. 

We’ll also have to see how easy it will be to communicate between different scaling solutions with different security guarantees. 

It’s also worth mentioning that Polygon’s whitepaper has direct comparisons to other layer 1 blockchains such as Polkadot, Cosmos or Avalanche that also focus on the interoperability between different blockchains. 

In contrast to these projects, Polygon focuses on the Ethereum ecosystem, with the Ethereum chain being the main hub that connects everything. 

This, of course, has a lot of advantages such as a strong community of users and developers, a well-known programming language – Solidity – and the most popular virtual machine in the cryptocurrency space  – EVM. 

Besides that, Ethereum has a long history of serving as a reliable base chain that handles trillions of dollars in economic activities. Something that took time to develop and is hard to be replicated by a completely new blockchain. 

The power of familiarity with the Ethereum stack cannot be overlooked as shown by the recent rise of Binance Smart Chain. 

So what do you think about Polygon? Will this be the ultimate way of scaling Ethereum? 

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

Finematics is also now participating in Round 9 of Gitcoin Grants based on the quadratic funding mechanism where even the smallest contribution matters. If you’d like to show your extra support, check out this link here.

]]>
https://finematics.com/polygon-matic-explained/feed/ 0