#Polygon #Architecture #Explained #Blockchains
The Polygon Network has garnered formidable popularity in recent times as a blockchain scalability platform. Scalability is one of the pressing concerns for modern blockchain networks, which are ushering in an era of new developments. For example, Ethereum blockchain has become the top choice for developing dApps and DeFi platforms. Why do you need to think of Polygon architecture now? The answer is evident in the constantly growing number of DeFi applications on Ethereum blockchain.
As one of the reliable layer 2 aggregators for Ethereum-supported networks, Polygon has introduced some revolutionary changes. However, it is also important to figure out how Polygon delivers the desired value advantages in scalability. The following discussion helps you discover the details of the architecture of Polygon to understand the blockchain scalability platform more closely.
Want to learn blockchain technology in detail? Enroll Now in Certified Enterprise Blockchain Professional (CEBP) Course
What is Polygon?
The first thing you need in an explanation for Polygon blockchain architecture is the definition of Polygon itself. It is basically a decentralized Ethereum scaling platform that helps developers in creating scalable decentralized applications. Interestingly, Polygon has garnered a lot of attention for its ability to reduce transaction fees without any compromises in security.
It is also important to notice the facility of better on-chain building capacities, which help developers in building applications with low gas fees. Above everything else, Polygon is the first candidate for improving the functionalities of Ethereum blockchain through drastic improvements in transaction speeds and network scalability.
Furthermore, Polygon architects have also planned the integration of two new roll-ups on the layer 2 scaling platform. One of the rollups would help in running application over existing Ethereum blockchain, thereby speeding up the transactions. Another rollup would focus on distribution of multiple off-chain exchanges, which can facilitate single trades.
Fundamentals of Polygon Architecture
The discussion on Polygon architecture & design would obviously focus on the fundamentals before diving deeper into the details. It is important to note that Polygon is a blockchain scalability platform offering hybrid Plasma and Proof of Stake side chains. The most striking aspect of the architecture of Polygon Network points to its design. The design of Polygon Network includes a generic validation layer separated from different execution environments.
Some examples of the execution environments include comprehensive EVM side chains, plasma side chains, and another new layer 2 solutions such as Optimistic Rollups. The easiest way to find a description of Polygon architecture explained in simple terms would emphasize the Polygon PoS network. You can find a three-layered architecture as the basic explanation for the architecture of Polygon Network. The three layers are,
- Ethereum layer
- Heimdall layer
- Bor layer
The Ethereum layer basically features a collection of contracts on the Ethereum blockchain network. The second layer, i.e., Heimdall includes a collection of Proof of Stake Heimdall nodes working in parallel to the Ethereum main network. It plays a crucial role in monitoring the staking contracts on the Ethereum layer.
The Heimdall layer also works on committing checkpoints in Polygon Network to the Ethereum blockchain. Another significant layer in the Polygon architecture, i.e., Bor layer, includes a collection of Bor nodes responsible for Bor nodes. The foundations of the Bor layer have been developed on Go Ethereum, while Heimdall has been developed on Tendermint protocol.
Developers could also use the Plasma side chain of Polygon Network to facilitate particular state transitions. It helps in addressing common state transition precedents for ERC-20 and ERC-721 tokens as well as asset swaps. In the case of arbitrary transitions, the Proof of Stake functionalities can serve the desired advantages. The hybrid design of Polygon’s architecture serves as a promising highlight for flexibility in using Proof of Stake or Plasma side chains.
Users can activate the Proof of Stake mechanism on Polygon by deploying staking management contracts on Ethereum. Subsequently, you should also deploy a collection of incentivized validators executing Heimdall and Bor nodes. The architecture of Polygon presently supports Ethereum as its first base chain.
However, the network has also planned on introducing support for more base chains. Polygon aims to deliver support for additional base chains with the objective of creating an interoperable and decentralized layer 2 blockchain network following community consensus and suggestions.
The basic overview of Polygon architecture & design shows a brief outline of what it is made of. Let us dive deeper into the details of each layer to find out their individual roles in the Polygon Network.
Excited to learn the basic and advanced concepts of ethereum technology? Enroll Now in The Complete Ethereum Technology Course
The Ethereum layer basically points to the set of smart contracts employed on Ethereum blockchain. It is one of the important requirements for activating the Proof of Stake or PoS mechanism for Polygon. The staking management contracts take responsibility for a major share of functions driving the Polygon Network. Some of the important functions enabled by staking contracts include,
- Earning the staking rewards for validating state transitions on Polygon.
- Flexibility for anyone in staking MATIC tokens for staking contracts in the Ethereum main blockchain alongside joining as a validator.
- Features for imposing penalties and slashes for malicious activities like double signing or validator downtime.
- The staking contracts also help in saving Polygon Network checkpoints on the Ethereum blockchain.
- The PoS mechanism is a critical aspect of Polygon blockchain architecture as it works to resolve the data unavailability issues in Polygon side chains.
The Heimdall layer is the second entry in the three-layer architecture of Polygon Network. It is one of the core elements in the Polygon Network and performs many important functions. Heimdall layer helps in managing validators and selection of block producers and spans. In addition, it also works on managing the state-sync mechanism among Ethereum, Polygon, and other important aspects of the system. Heimdall layer uses Cosmos SDK alongside a forked variant of the Tendermint protocol, also referred to as Peppermint. Here is an overview of the important highlights of the Heimdall layer.
The Encoder or Pulp is essential for verifying transactions of the Heimdall layer on the Ethereum blockchain. It leverages RLP encoding for creating special transactions such as checkpoints. The RLP-based or pulp encoding serves better functionalities in comparison to the basic amino encoding. The Pulp encoding component of Heimdall layer in Polygon architecture leverages a prefix-based encoding mechanism for simpler solutions to interface decoding.
Transactions in the Heimdall layer include metadata include in the messages and contexts responsible for initiating state changes in a module. The messages and context are triggered through the Handler of the module. Users can create transactions when they want to interact with a specific application or introduce any state changes.
It is important to note that the message of every transaction must feature a signature with the private key related to the suitable account before broadcasting it to the network. In addition, you must also include a transaction in a block and validate it, followed by approval of the network through consensus.
Get familiar with the terms related to ethereum with Ethereum Flashcards
One of the most striking components for Polygon architects in the Heimdall layer obviously refers to StdTx. It helps in creating your own blockchain application on Polygon network. Interestingly, the StdTx does not require fees for every transaction. Polygon features support a limited range of transaction variants. It is also important to note that end users would not deploy any type of contract on Heimdall, thereby validating the fixed fee model.
The important types in the Heimdall layer also serve as an integral highlight for a description of Polygon’s architecture. You can find three types in the Heimdall layer such as PubKey, HeimdallAddress, and HeimdallHash. The HeimdallAddress type basically refers to an address on the Heimdall layer with a length of 20 bytes.
HeimdallAddress also uses the common library of Ethereum for defining the Address. PubKey refers to the public key employed in Heimdall, which is uncompressed and compatible with ECDSA. The final type, i.e., HeimdallHash, offers representation for the hash in Heimdall layer and leverages the hash of Ethereum.
Validators are an essential part of Polygon architecture explained in detail as they are responsible for a larger share of work on the Heimdall layer. The Heimdall layer could change validators once a block is completed with the EndBlocker. Heimdall layer provides the description of the checkpoint numbers in between which the validator will be active.
With the EndBlocker functionality, Heimdall could procure all the active validators alongside updating the existing validator set in the concerned state. Validators serve the important function of running Heimdall nodes alongside enabling the Bor node for recording checkpoints on Ethereum blockchain.
The next crucial aspect in Polygon’s architecture points towards checkpoints. Checkpoints offer representation for the snapshots of Bor chain state. It must be verified by over two-thirds of the validator set before submitting the checkpoint on the staking management contracts on Ethereum main blockchain.
The other significant details in checkpoints refer to the RootHash and AccountRootHash. RootHash is basically the Merkle hash of the Bor block hashes from the starting block to the end block. The AccountRootHash is basically the hash of the information pertaining to validator account, which users must transfer to the Ethereum blockchain with each checkpoint.
The Polygon architecture & design also relies heavily on validator key management in the Heimdall layer. Validators can utilize two keys for managing all validator activities on the Polygon Network. The two keys are the signer key and the owner key. The signer key is actually the address you use for signing the Heimdall blocks and checkpoints alongside other signing activities. Private Key of the signer key would stay on the validator node for better signing. At the same time, it could not work on managing stakes, rewards, or operations associated with delegations.
On the other hand, the owner key is actually the address that helps in staking, re-staking, and modifying the signer key. The owner key also helps in withdrawing rewards alongside managing parameters pertaining to delegation. It is important to safeguard the private key of owner key by all means. In most cases, you have to store the signer key and owner key separately on different wallets. The owner key takes control over the staked funds, and the isolation of responsibilities offers a better tradeoff between ease of use and security.
The final component in the Heimdall layer of Polygon blockchain architecture works on checking and validating transactions. Following the verification, you can check the sender’s balance and deduct the necessary fees for including successful transactions. Ante Handler component also works on management and verification of signature in any incoming transaction.
Start learning Blockchain with World’s first Blockchain Skill Paths with quality resources tailored by industry experts Now!
The Bor layer is the third layer in the Polygon Network’s three-layer architecture and focuses primarily on block production. The Bor node is also referred to as the Block Producer implementation. If you look closely, the Bor node is actually the side chain operator featuring EVM compatibility.
As of now, the Bor layer is a fundamental Geth implementation with custom changes in the consensus algorithm. However, developing the implementation from scratch has helped in maintaining it as a lightweight resource. Block producers are sorted from the Validator set alongside shuffling by leveraging older Ethereum block hashes.
As the block producer layer in Polygon architecture, the Bor layer maintains synchronization with Heimdall for selecting producers and verifiers. All the interactions for Polygon users happen through the Bor layer. Interestingly, Bor layer also features EVM compatibility, thereby offering the flexibility for accessing Ethereum developer applications and tools. Block producers on the Bor layer are basically a committee assembled from the pool of Validators according to their stakes. The periodic selection and shuffling of block producers are also significant highlights of the Bor layer.
The most prominent highlight in the functionalities of the Bor layer points to the Genesis contracts. Bor layer relies largely on the three in-built contracts, referred to as genesis contracts, available on the genesis block. The Genesis contracts include the Bor validator set, MATIC ERC20 token contract, and state receiver contract.
The next important aspect in the Bor layer of Polygon refers to span management. Span refers to the logically defined block set for which you can choose a specific set of validators from available validators.
The crucial highlight in the operations of Polygon architecture & design also refers to the fee model. In the case of normal transactions, Bor layer collects fees in the form of MATIC tokens and distributes them among block producers. MATIC serves as the primary token for paying gas fees for Polygon transactions as well as staking purposes. Interestingly, the fee model is a supporting factor for efficiency of Bor layer, which has an exceptional transaction speed of almost 2 to 4 seconds.
Want to learn the basic and advanced concepts of Ethereum? Enroll in our Ethereum Development Fundamentals Course right away!
The architecture of Polygon Network focuses largely on the three important layers Ethereum layer, Heimdall layer, and Bor layer. Polygon Network leverages Proof of Stake and Plasma side chains for distinct purposes through its architecture. Most important of all, the polygon blockchain architecture reveals considerable information about the basic structure of transactions on Polygon.
You can learn how Heimdall layer or the validator nodes serve as the most comprehensive part of Polygon Network. At the same time, features introduced by staking management contracts on Ethereum layer and the block producer functionalities of Bor layer strengthen the Polygon network. Learn more about Polygon Network and the best practices for using it right now.
Join our annual/monthly membership program and get unlimited access to 25+ professional courses and 55+ on-demand webinars.