The world of decentralized finance (DeFi) runs on blockchains: decentralized public digital ledger systems, where transactions are recorded in blocks and verified by nodes. Every day, billions of USD exchange hands in the form of digital coins and tokens on platforms run on these blockchains. Currently, there is over $90 billion USD locked up in DeFi alone. Money and assets are exchanged, and new platforms, DApps, and blockchains are launched daily. Imagine, then, if these products were launched based without having ever been tested under realistic conditions? When the issues inevitably arise, millions of individuals could lose money and the whole DeFi sphere could fall into disrepute. For these reasons, there exist testnets and mainnets.
What Is a Testnet?
A testnet is a test blockchain network that works to run and test blockchains or blockchain projects before they are ready to be launched. It is a simple way for programmers and developers to create, modify, and test the functionalities of their project, as well as monitor its performance before making it accessible to the public. Here, developers can troubleshoot any issues and fix any bugs.
In a testnet environment, multiple tests can be run repeatedly, which allows for a performance comparison and means that consistency can be checked. By running independently to the mainnet, testnets allow for the full testing of a blockchain project without interfering with the transactions on the mainnet. This sandbox model allows developers to take risks, experiment, and thus create the best possible model to launch.
As a prototype, a testnet should never be used to transfer anything of value, and thus testnets use fake money, or tokens without value, to run their protocols. Developers will often also use a testnet to build and trial their own blockchain, and once satisfied will then go and launch them on their own. Testnets allow for a faster and safer launching of the mainnet.
What Is a Mainnet?
A mainnet is the “main” “net,” or network, that a blockchain or blockchain project is run on. This is the stage that logically comes after the completion of all the necessary trials on the testnet. A mainnet consists of a fully launched net where cryptocurrency transactions can be processed efficiently, verified accurately, and recorded securely. By deploying a mainnet, its developers are stating that they have full trust in their blockchain’s capacity. As a fully functioning blockchain, mainnets can be used to send and receive any transaction, in the form of cryptocurrency or non-fungible tokens (NFTs), among others, or transfer information. Additionally, a mainnet can run a project that requires that specific blockchain’s protocol, for example DApps on the Ethereum mainnet.
Testnet vs. Mainnet: The Key Differences
- Purpose:A testnet is a testing blockchain, a sandpit where failures are protected, while the mainnet is the released functioning blockchain.
- Cost of operations:Tokens in testnets do not hold any value, as opposed to mainnet tokens which use real assets and cryptocurrencies. The cost of operations in a mainnet is therefore higher. This is because every operation performed on the blockchain requires a fee, paid in tokens of a certain value — something that the testnet does not possess.
- Network ID:Testnets and mainnets have different Network IDs to each other, which are used to help developers identify the network. For example, the Network ID of the Ethereum mainnet is 1, while the common Ethereum testnets Ropsten, Rinkeby, and Kovan use 3, 4, and 42, respectively.
- Genesis Block:Testnet and mainnets both have their own independent genesis block, i.e., the first block in their blockchain.
- Nodes:A testnet will have fewer nodes than a mainnet since there is less information to verify.
- Transaction frequency:Testnets have a lower transaction frequency than mainnets, which makes sense as they will not have the large pool of users that a mainnet has.
- Published code:Mainnets will have their underlying code made public once published, as this fortifies user confidence in the chain. Testnets will not publish the code as it is constantly undergoing changes.
Why the Difference Between a Testnet and a Mainnet Matters
Since 2017, with the explosion of cryptocurrency onto the financial scene, many individuals have rushed to invest in new blockchains, platforms, DApps, and coins. With a lack of knowledge and fear of missing out on the opportunity, many individuals invested based on a whitepaper alone. These whitepapers claimed fantastic speeds, high outputs, and excellent results, however, these results had been seen at the very beginning stages and only in a testnet environment.
As a result, projects that had made such bold claims never actually progressed to the mainnet stage and instead crashed and burned, taking their investors’ money with them. It is therefore of paramount importance to research the projects that one is looking to invest in and to understand at what stage they are at. Whether a project is tried and tested should be one of the very first indicators to look for, and thus whether the project currently operates a live mainnet or only a testnet is of the utmost importance to any serious investor.
Why Are Testnets Important?
Everyone can agree that running checks on any system, especially a financial system, is of paramount importance before its launch, but why can’t these simply be run on the mainnet?
First, running tests on a mainnet can be very expensive:
- Blockchain fees will need to be paid for every transaction made, every change, and each time a project is launched — which during a trial phase are multiple and repeated. This would mean that in order to test a project efficiently and explore its possible options, incredibly high fees would be incurred.
- If an issue occurs during a trial phase on the mainnet, it could disrupt the entire network, its users’ assets, and transactions, meaning that users could lose their money. This could be very expensive, both for developers and the reputation of cryptocurrency as a whole.
Secondly, there is an issue with compatibility:
- Testnets do not use anything of real value, and instead use “fake money” in the form of valueless tokens.
- Testnet coins are not compatible with mainnets, and vice-versa, meaning that new coins or methods would need to be minted, resulting in a much longer, complicated, and expensive process.
For this reason, all new projects should first be tested on an independent blockchain with its very own genesis block — such as a testnet. In this way, those operating in the cryptocurrency market can remain absolutely separate from any “trial and error” operations, and developers can be free to test all aspects of the blockchain before its launch.
Who Are Testnets For?
Testnets can be used by anybody with a project in development and in need of testing. They are simply a way of testing a product closer to scale, without fees, and without the risk of interfering with the mainnet. Many mainnets offer a testnet service, as different testnets will more closely resemble different mainnets and so developers can choose the one best suited to their needs. For example, Symbol runs both a mainnet and a testnet, with the testnet being a copy of its own mainnet structure, while Ethereum’s mainnet is closely resembled by Ropsten.
Additionally, if a developer is looking to build their own blockchain and test it, as opposed to simply building a DApp or platform, they can also use testnets for this. Symbol offers its Symbol bootstrap, and if building a blockchain similar to Ethereum, developers often use Ganache on trufflesuite.com.
What Is a Sidechain?
Another interesting way to experiment with new ideas or software updates without interfering with the mainnet is by using sidechains, or as the blockchain platform Ardor refers to them, childchains. These blockchains, as the name would suggest, are chains that run on the side of the main blockchain, or parentchain. They are connected to the mainnet via a two-way peg. They are completely independent and in charge of their own security, meaning that if there is not enough mining power to secure the sidechain, it can be hacked. However, as it is independent, the damage will be contained within that chain, and not the mainnet. In this way, it creates a similar space to a testnet. The main difference, however, is that real assets can be locked and used within a sidechain, whereas in a testnet they cannot. This gives way to more real-life scenarios and can add an extra layer of testing to a developer’s project.
Though sidechains have this testing functionality with added risk (due to the possibility of losing capital), their main purpose is to add additional functionality to their parent blockchains. For example, Rootstock (RSK) is a sidechain that has been developed with the aim to give Bitcoin smart capabilities and the ability to make faster payments. Ardor’s blockchain, meanwhile, employs its childchains to add an added layer of security, driving verifications through them instead of through the mainnet.
Sidechains allow for cryptocurrencies to interact with one another, allowing for flexibility and a contained environment where developers can experiment without creating too much of an impact.
Conclusion
Any serious cryptocurrency investor or blockchain developer should understand the difference between a mainnet and a testnet, and when to use each one. Not understanding them, or using them incorrectly, could result in losses of capital or damage to a cryptocurrency’s reputation.
In addition, other possibilities such as sidechains can prove a good option to explore performance or add functionality to a project. It is therefore important to not only understand the basics, but also explore the new technologies that are continuously evolving in the crypto space.