How to Bootstrap a Blockchain With Polygon Supernets
There are a number of reasons why a Web3 project might choose to build on a network other than Ethereum. Whether it’s experimenting with innovative features not available on the mainnet, tailoring the network to a specific use case or simply having more control over its fees, the answer in one word is customization.
Polygon Edge was announced in May 2021 to anticipate that very demand. Edge is a customizable blockchain stack written in Golang that developers can use to build and launch networks fine-tuned specifically for their needs. Last month, Polygon unveiled Supernets to even further abstract the process of building application-specific blockchains.
This is how to bootstrap Ethereum-compatible blockchains with Polygon Supernets.
Having custom blockchain networks allows teams to configure essential parameters, such as which consensus is used, what is the block limit for transactions, who are the trusted participants in the network (validators), and much more.
Answering these questions is the easy part. Implementing the actual blockchain logic is where it becomes tricky. Diving into building a blockchain layer from scratch involves focusing on several key aspects:
This sounds like a lot of work - and it is. Polygon Supernets makes the process straightforward, so that teams can focus on what’s really important – their actual product.
Architecture of Polygon Supernets
By now it’s clear that blockchain clients have a lot of moving parts – Polygon Supernets is no different – it additionally offers modularity when it comes to all major components of the stack.
It all starts at the base networking layer, which utilizes libp2p – a modular, extensible, and fast networking framework that provides a great foundation for some of the advanced features of Polygon Supernets. Nodes discover and interact with each other through the networking layer, which allows them to participate in complicated processes such as block syncing and consensus.
The blockchain layer is in charge of coordinating block additions and state transitions with other modules of Polygon Supernets to make sure the data is verified and committed to the chain.
Local to each node, the TxPool module is the central place for handling transactions. Any transaction that gets added manually to the node, or gets received from other nodes in the network will be processed and handled accordingly here.
Finally, dApp developers and node operators have front-row seats when interacting with a Polygon Supernets blockchain. By utilizing the standardized JSON-RPC layer, Web3 frameworks can easily interact with the underlying blockchain. Node operators can use simple commands to interact with the Polygon Supernets node, which relies on gRPC under the hood, making the UX fast and enjoyable.
Blockchain Deployment 101
It’s easy to get up and running with a custom blockchain network using Polygon Supernets. There are 3 steps:
1. Generate the secrets data
Each node has pairs of keys it needs to successfully communicate and participate with other nodes. These include the node’s validator private key and the networking private key. Private keys need to be generated on each node.
2. Genesis configuration
The genesis block is where all chains start. Users need to generate a genesis configuration that their blockchain will use. This is the point where they specify which consensus mechanism is used, what is the block limit, which accounts have pre-mined balances, and more. The full list of available options can be found in the documentation.
3. Start the node
Now that everything is configured, all systems are ready for launch. When starting the node, users can specify additional runtime parameters. The full list of supported parameters can be found in the documentation.
After all of the nodes are started, they will attempt to form a fully-meshed network and start producing blocks.
Here are some interesting features offered by Polygon Supernets, that are out of the scope for this article:
IBFT PoA / PoS switching
Polygon Supernets offers chains the ability to seamlessly switch between PoA and PoS IBFT consensus modes, without needing to reset the chain beforehand.
Backup / Restore functionality
Backing up and restoring chain data is a must. Lengthy chains can take a long time to sync on new nodes, so having a backup ready for restore just exponentially speeds up this process – all without having to turn off a single node, as this is offered on the fly.
Integration with Hashicorp Vault / Amazon SecretsManager
Sometimes sensitive data such as private keys shouldn’t be kept on disk. Polygon Supernets offers the ability to store and manage private keys on Hashicorp Vault or Amazon SecretsManager.
When trying to figure out the throughput of a custom blockchain, it can be difficult to pick the right tools for stress testing the network. Polygon Supernets offers a baked-in load bot feature that spams transactions to the blockchain and reports back with the performance results.
Upcoming development efforts are focused on implementing a cross-chain bridge solution, which would allow custom blockchains to interact between each other. Another area of focus will be Proof of Stake, with new features and improvements such as governance and delegated staking underway. Additionally, the Polygon Supernets team is considering adding support for additional runtimes in the future, as the current EVM implementation is plug and play.
Polygon began development of Supernets about two years ago, working closely with the Trapesys team. There are now over 35 teams ranging from government organizations to gaming companies using Supernets. Polygon also announced plans to invest $500 million in projects interested in building on the Supernet chain.
For more information regarding Polygon Supernets, dig into the documentation, check out the GitHub repository and join the Polygon Supernets Discord. Keep up with the latest on the Polygon ecosystem on our blog.
Let’s bring the world to Ethereum!