Optimizing a test network in three key areas can help make sure a blockchain is ready for mainnet deployment. We’ve been doing this for over four years now so we thought we’d share our insights!

Photo: Shutterstock

Distinct from a main blockchain, blockchain testnets enable developers to try out the infrastructure behind a distributed ledger in practice within a sandbox environment. They can run applications, services, and benchmark tests on the testnet to identify software bugs and to see where optimization of the base-layer protocol is needed.

Beta testnets represent an early iteration of a blockchain network. A natural phase in building a functional blockchain network is to deploy a testnet and rigorously test it out before proceeding with further development. The network doesn’t operate with the same balances, blocks, or nodes as the future mainnet.

After the mainnet is launched, the testnet may continue to run in parallel to test protocol updates or to allow developers to test applications before porting them onto the main network; in effect, it acts as an alternative network. Using a beta testnet to assess the stability of a blockchain and updates, or to test out application software during its development can help spot critical code errors early on.

Permissionless networks may use crypto assets, like tokens, for purposes such as economic incentives. The testnet lets developers test code that involves these assets in a safe environment in which they have no economic value; the assets with real market value lie on the mainnet, which may either be running or will run in the future. Running applications on a testnet can make testing less expensive and lower risk.

However, transitioning from a beta testnet version of a blockchain to a production-ready mainnet can be exacting. Launching a mainnet signifies a major leap forward in the development process especially with public ledgers, where data entries are immutable and protocol parameters are strictly coded in; in this sense, network upgrades are strictly voluntary for network participants. It is critical to make sure the software functions correctly and is ready for all its use cases before launch.

The approach I outline in transitioning from a testnet — a beta network — to a mainnet — a production-ready network — extends from the wealth of knowledge and experience gained from leading deployments of real blockchain implementations for over four years in South Korea. I’ve developed a wealth of knowledge around building blockchain systems; from how to optimize the peer-to-peer layer to creating a usable application layer, to about virtually everything regarding successful deployments. Our experience in doing exactly this, repeatedly, for real clients will drive our transition from the Aergo public testnet to the Aergo mainnet.

The testnet development and transition process can be simplified into three phases:

Performance testing Architecture stabilization Usability optimization

Performance Testing

In the context of blockchains, performance has a number of dimensions namely the number of transactions per second, the bandwidth resources needed to transmit data across a network, and the ability to store ledger data at different endpoints.

Testing performance is crucial. It is critical to the development cycle, to ensure the network performs well under the expected workload and to give developers a gauge of the platform’s capabilities. Without performance testing, the network runs the risk of suffering from issues such as not scaling as the number of nodes increases, inconsistencies across different operating systems, and bad overall user experience.

Performance testing is something that played a huge role in our past blockchain implementations. When we built a settlement layer for transactions on a private equity over-the-counter marketplace for a Korean stock exchange, we had to achieve demanding performance requirements. We first deployed a testnet to better understand some of the issues our system initially had with regards to response time, reliability, resource usage, and scalability, and subsequently addressed these concerns before deploying the product.

Since the launch of the Aergo public testnet, results on aergoscan.io boast thousands of transactions per second. We still have a number of performance and parallelism improvements to implement before we’re at our target speed and we will continue to optimize for scenarios with spiking transaction volumes and high computation loads. We are currently working to implement inter-contract parallelism and other advanced performance upgrades. Advances such as parallelism naturally take time, lots of testing, and lots of research.

Network Stabilization

It is important to optimize the stability of any blockchain infrastructure. Stability determines whether the protocol fulfills the necessary reliability, availability, maintainability, security, and software asset management requirements. We run a variety of different stress tests to place the protocol under extreme workloads and see how it handles high transaction volumes. Ultimately, our knowledge of the various drivers and levers of the system design deepens and baseline expectations around the network’s functioning are created. The goal is to make sure you optimize functionality and minimize the risk of network breakdown.

Optimizing for Usability

Usability always differentiates successful technology projects. New emerging technologies require good user experience to succeed. However, getting UX right is hard. It is especially difficult with blockchains, which have so many added elements of friction in accessing services for all stakeholders: users, developers, administrators, operators, and others.

In private, permissioned blockchain systems things are easier than in full-blown permissionless networks. Usability optimizations usually revolve around block reorganization functionalities, to be covered in a future blog post, which are especially necessary in the fintech space. Banks and financial services companies needed a stable and performant architecture that also had restoration features. Flexibility in other key areas of the system also comes hand-in-hand with a permissioned system. Companies can leverage the benefits of distributed ledger technology while also controlling and tailoring the system to their price needs on-demand.

In public, permissionless blockchain systems, where many tradeoffs are made in pursuit of decentralization and security, are more challenging. Most usability optimizations, aside from performance and stability improvements, come from upper layer functionalities and enhancements. Running a testnet, making sure it represents the mainnet as closely as possible, and testing the blockchain from all stakeholder perspectives and for all anticipated major use cases help identify the functionalities and enhancements needed to make the system perform optimally.

We have a strong understanding of what enterprises, developers, and hardware providers need from blockchains. This is why our platform has a wider range of developer tools than just SDKs, APIs, CLIs, or client frameworks. We also provide software libraries for our ecosystem to make, for example, the creation of fungible tokens and good documentation straightforward; in the future, we intend to open-source deployment blueprints for many of our past and in-production use-cases like distributed storage, identity, single sign-on, and others.

Some of the more interesting features we offer are a Lua smart contract language based on SQL for both permissionless or permissioned environments and a branchable SQL engine for handling data for permissioned chains bridged to our main chain. Handling data in SQL is limited to permissioned environments because in public environments there are many challenges such as storage consumption design, static DB optimizer, and always the same results in DB access. We are researching these issues and want to release our SQL feature for a public network eventually. Other features include a smart contract package manager to speed up the development, testing, and management of dApps; an account naming system; and more. When rigorously trialing on our testnet, we also aim to make the final adjustments to our developer tools to make them as effective as possible.

However, creating easy-to-use development kits are just one part of the picture. It is also important to build services and operation or management environments tailored to real-world use.

Our testnet to mainnet transition process also involves modeling a large set of complex B2B and B2C applications and services built in our past implementations or currently running across other blockchain platforms and deploying concept versions on our testnet (this may not be done publicly). We observe where usability frictions lie in our platform by replicating real-world scenarios and address them by optimizing the service layer being built on top of Aergo. We can also see if any critical services need to be added to the service layer.

The service layer provides an automated interface that simplifies sidechain and dApp deployment and provisioning. It also allows companies building serverless applications access to purchasing real-time virtualized resources like storage space, computing power, content delivery networks and artificial intelligence algorithms from hosting providers. In essence, the development, testing, deployment, management, and upgrade scheduling processes give an experience similar to browsing a web page; this is how companies will use blockchain technology in the future. Effectively, as we move from testnet to mainnet, we plan to run various tests to understand how we can optimize the service layer and to identify the features needed for enterprise adoption as we prepare for mainnet launch.

Conclusion

Few people are familiar with how to build a base-layer blockchain protocol. As we have done this for over four years and for many major enterprise and public organizations, we have aimed here to share some of the lessons we have learned. By optimizing a testnet in certain key areas, one can truly make the transition from a beta iteration of a decentralized blockchain network to something that is ready for use by customers and organizations.

We hope this rundown of the process gives insight into the developments necessary to transition from a testnet to a mainnet. We also hope this article was easy and clear to understand. Keep an eye on the aergoio GitHub page as we share the transition of the Aergo protocol from a testnet into a fully-fleshed out, stable, secure, and high-performance blockchain protocol designed to host the next generation of business applications and services. If you have any questions, just join our Discord and ask away!