Part 2: Guide To Launching Your Own Blockchain With AppChains
March 28, 2023
9 min read
Ankr AppChains is enhancing scalability and UX across Web3 by offering every decentralized application the opportunity to run on its own blockchain. This article is the second installment in a series designed to make it as easy as possible for dApp developers to launch their own AppChain with every step in the process explained.
In Part 1, project teams building AppChains used the AppChain Configurator to choose custom infrastructure needs, met with Ankr’s engineering team to create a blueprint for their chain, and created a testnet to assess the functionality of their new ecosystem.
Part 2 will cover one of the most important and exciting aspects of creating AppChains: launching your mainnet.
Launching Your AppChain Mainnet
The beauty of AppChains is that Ankr’s team will handle all engineering and infrastructure needs for launching your mainnet. The following is a list of some of the processes that will go into creating your live AppChain and what is happening behind the scenes.
Finalizing the Codebase
Before launching the mainnet, it is a crucial step for Ankr’s engineering team to finalize the codebase and rigorously test your code to ensure it functions as expected and meets all of the project's requirements. Any changes or updates to the code will be completed and thoroughly evaluated on the testnet while fixing any bugs. Ankr’s team will ensure your project code is stable and secure and any problems have been fixed. Security is an extremely important element in every aspect of Ankr AppChains; making sure vulnerabilities are eliminated before they could ever become an issue is part of our security SOPs.
Customizing the Genesis Config File & Parameters
During this process, Ankr’s team will take some time with you to finalize the parameters that will be playing essential functions in the ecosystem. Writing your genesis block is very important as this block is hardcoded into the node software as a foundation for the blockchain. The genesis configuration file may include the following items:
Chain ID: A numerical Identifier for your specific sidechain or subnet.
Genesis Validator Set: A list of addresses for your validators that will be included initially in the blockchain launch.
Project treasury: Your treasury reward distribution scheme allows you to dictate which addresses will receive a percentage of the project’s treasury assets during the launch. The project treasury is a fund that accumulates a portion or cut of the validation rewards, which are formed from the transaction execution costs. The project treasury can use these assets for system needs, such as covering the costs of infrastructure.
Epoch Length: The length of a blockchain “epoch” is specified as a predetermined period of time or number of blocks produced on the network. An epoch is a variable used in the calculation of important blockchain events, such as gas consumption, rewards claiming periods, duration of validator penalties, and so on. Ankr’s team will suggest an optimal epoch length that works best with your project and the mother chain environment.
Validator Penalty Thresholds: This threshold will determine the number of missed blocks it will take for a validator to lose their rewards for the current epoch. A validator may sometimes miss blocks due to network hiccups or going offline. It is part of the incentive scheme to keep the network stable and protected from malicious intent.
Undelegate/Unstake Period: This period is the number of epochs that should pass before users are able to claim their rewards. Ankr’s team will consult on the most appropriate amount of time that will keep the network stable and protected from malicious actors.
Minimum Stake of Validators & Users: The minimum amount of tokens that can be staked with a chosen validator. This amount should be low enough to allow the largest number of people to stake while still encouraging them to delegate a significant amount of value. Ordinary users may not have enough tokens or hardware power to create a validator, but they can still stake with a validator and receive a portion of that validator's rewards. This is called delegated staking.
Initial Token Allocations: A token allocation scheme determining which address will receive tokens when the AppChain instance goes live. These addresses are usually testnet faucets, system funds, and other necessary system tools.
Hammering Down Consensus Rules
The consensus algorithm determines how participants in the network reach agreement on the validity of transactions and the addition of new blocks. There are several consensus algorithms used in blockchain networks, including Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and others. Each algorithm has its pros and cons, and the choice depends on the specific requirements of the blockchain. As a part of finalizing how your blockchain reaches consensus, our engineers will use your inputs to carry out specifications for the following:
Block Size: The block size is determined by the design and consensus rules of the specific blockchain protocol being used. Some blockchains have a fixed block size, while others allow for dynamic adjustments. Ankr’s team will consult on the block size that will allow for the best throughput and blockchain performance.
Block Time: Block time (the average time it takes to produce a new block) is a crucial parameter in blockchain design because it directly impacts the speed at which transactions are confirmed and the overall throughput of the network. Different blockchain networks strike a balance between security, decentralization, and performance by adjusting their target block times according to their design goals and user requirements.
Validation rewards: The reward system is an essential parameter to incentivize participants to maintain the network's security and validate transactions. It's crucial to design a reward mechanism that balances fairness, security, and economic sustainability. We will cover a breakdown of this in the next section.
Implementing Network Incentive Parameters
AppChains will need definitions for gas fees, validator rewards percentages, and all other parameters that go into rewards and incentives schemes. Before launching the mainnet they will need to be finalized.
Gas fees: On most AppChains, the validators will generate rewards based on the gas paid for the block they produced. The gas will be taken from transactions that were processed within that block. The rewards are spread between validators and delegators based on the commission rate (AKA delegation fee) that is chosen by the AppChain client with advice from the Ankr team. The gas fees will need to strike a balance between being low enough to provide a good UX when making transactions via the application and high enough to encourage network participation for validation and staking.
Validator Reward Percentage: This percentage is the amount that a validator will earn for its efforts. For example, let’s say a specific AppChain validator has a stake of 1k TOKEN and has 10k TOKEN delegated to it, with a commission set at 10%. Let’s say the block the validator produced collected 1 TOKEN as gas (spread between the validator and its delegators). Here the validator would receive the self-stake/total stake multiplied by the total gas within the block and then adds the 10% of delegator rewards. 1/11 * 1 TOKEN + (10/11 * 1 TOKEN * 0.10)
Staker Reward Percentage: The delegator, on the other hand, will be rewarded: delegator-stake/total-stake multiplied by the total gas from the block. 10/11 * 1 TOKEN - (10/11 * 1 TOKEN * 0.10)
The above is just an example of how validation fees can be split. AppChain clients may need an entirely different scheme to fit their use case.
Prepping & Deploying Network Infrastructure
The next step is to deploy the network infrastructure that will support the mainnet and propagate the chain in more places, providing the decentralization factor. This includes setting up the nodes that will be used to run the blockchain. The infrastructure provided by Ankr is robust and scalable to handle traffic as it grows. As Ankr’s team is exceptionally knowledgeable in deploying bare-metal infrastructure, the team will account for any of your specific needs in location, bandwidth, and memory.
Full (RPC) nodes: Your project will go live on mainnet with a minimum of 2 full (RPC) nodes responsible for storing a complete history of the blockchain’s data and providing a connection for your application (and any desired external applications) to interact with your blockchain. The AppChain team will ensure your RPC infrastructure will be robust, secure, and reliable, with easy RPC API access to provide extremely low latency responses for fast application experiences.
Validator nodes: With a minimum of 4 validators running, your AppChain mainnet will be able to handle all transactions coming through the network in its early and intermediate stages. If necessary, the team will be able to deploy more validators as your application use grows.
Pressing Play: Launching the Mainnet
Once the codebase is finalized, the network infrastructure is in place, and the consensus rules have been established and tested, it is time to launch the mainnet. Mainnet launches are carefully planned and executed by the Ankr team to ensure successful project launches. Once the project is ready, it can announce to the community and provide clear instructions on how to begin using the app and interact with the blockchain.
Providing Support to Users
Soon, as project users begin interacting with your app on the mainnet, it is important to provide support and guidance to ensure a positive user experience. This includes providing clear instructions on how to use the blockchain, addressing any issues that users may encounter, and providing regular updates on the network's performance and security. These items are all available with Chainscanner, the user interface of Ankr AppChains.
Monitoring the Network
After launching the mainnet, it is important to monitor the network closely. This includes tracking the number of transactions, monitoring network performance and security, and addressing any issues that arise promptly. Ankr has a dedicated team in place to manage the network and address any issues that arise. Ankr also has monitoring systems in place to keep an eye on your node and network health at all times, with alerting systems to notify projects and engineers of any issues.
Once the mainnet and your application are live, your project will officially be running on its own application-specific blockchain. As you can see, the pieces are coming together, providing the best of distributed ledger technology for your users that can evolve the Web3 user experience beyond anything we’ve seen yet. Stay tuned for the final article in this series that will finish out the process of launching your own AppChain!