In this post we’ll briefly explain Ethereum testnets – what they are, what they’re used for, and how they’re used.
For a better understanding of the content that follows, it’s recommended you read the following introductory articles:
When writing programs for the EVM (Ethereum Virtual Machine), i.e. the Ethereum blockchain, we need to pay for their launch and usage in gas. This cost can be prohibitive in times of network overuse and it can also be financially dangerous – a bug deployed on the live network is a bug forever open to abuse. Any change on the Ethereum blockchain is permanent and cannot be undone.
Testnets are copies of the Ethereum blockchain almost identical in every way to the Mainnet except in the fact that their Ether is worthless (and, of course, the software that’s been deployed on these testnets).
There are three types of testnets.
Public testnets are available to everyone, they’re connected to the internet. Anyone can connect to them at any time, even from popular wallet interfaces like MyEtherWallet or MetaMask.
The following public testnets are available:
In the MyEtherWallet interface, they’re marked with a yellow edge. Each has two nodes you can connect to (doesn’t matter which one you pick – both lead to the same network).
The same testnets are available through MetaMask:
Ropsten was launched in November 2016. Its Ether can be mined just like on the Mainnet. Both Geth and Parity support it – two different implementations of the Ethereum node software – so it’s possible to develop for it from two different angles.
Of all three testnets, Ropsten resembles the current Mainnet the most. Its results resemble Mainnet results because its consensus mechanism is PoW (i.e. it can be mined on) so the simulation of transaction confirmations is the most realistic.
Ropsten’s current blockchain file size is around 9 GB.
On the Ropsten network, Ether can be mined or demanded through the Ropsten Faucet – a website that exists for the sole purpose of giving away free test Ether.
Because Ether can be mined on Ropsten, it is susceptible to spam attacks – a wave of useless transactions that clog the network. If Ether is free and easy to get, it’s easy to create this flood. Such an attack happened in February 2017. when attackers mined enormous amounts of Ether and kept sending too big transactions into the network. Ethereum’s block size limit is designed to be flexible and to grow with demand, so they managed to pump it up to several billion units of gas instead of the 4 million it was at up until then. After this pumping of block size limits, they sent large computationally intensive but useless transactions into the network, clogging the gas limit in those immense blocks completely, inflating blockchain size for no reason and blocking everyone else’s work. The network collapsed and was revived a month later after resetting the blockchain data.
It’s interesting to note that Ropsten only differs from the Mainnet (on which all of us hold our “real” Ether) by agreement. We collectively decided that Ropsten’s Ether is worthless, and now it is. Ropsten has its own mining pools, its own software, etc. but we all decided that its Ether has no value, and so it doesn’t. Here we see, quite literally, how the community’s consensus dictates the value of an asset – or, to be more exact, the lack of value of said asset.
Ropsten transactions can be inspected on Etherscan.
Kovan was launched in March 2017 by the Parity team after Ropsten was attacked. Kovan only works with the Parity node, which means you’re out of luck if you use Geth. Instead of mining with PoW, Kovan uses PoA as a consensus mechanism: Proof of Authority. Simplified, in PoA certain nodes are authorized to produce new blocks and confirm transactions, and only those nodes can do this.
You can only get Kovan’s Ether by requesting it from such a node via their dedicated faucet, or by receiving it from an address which already has it.
Because of the PoA mechanism, Kovan differs somewhat from the Mainnet and thus cannot be considered a very accurate simulation. Despite this, it’s excellent for public testing, reliable and stable, and immune to spam attacks (Ether is hard to come by).
Etherscan supports Kovan as well: https://kovan.etherscan.io/
Launched in April 2017 by the Ethereum team, Rinkeby shares the advantages of Kovan with two minor alterations: it does not support Parity and only works with Geth, and it uses a slightly different PoA consensus mechanism.
Rinkeby is also supported on Etherscan: https://rinkeby.etherscan.io/
Rinkeby Ether can be requested from an authorized faucet.
Morden was the first Ethereum testnet. It was shut down in November 2016 due to a variety of attacks and a lot of junk data having been accumulated in its blockchain making it unsustainable disk-space-wise. Some differences between the Geth and Parity implementation also contributed to the shutdown. It was superseded by Ropsten.
A private test network is equivalent to one’s own personal blockchain – your own copy of Ethereum.
When booting up a private blockchain, a Genesis file needs to be generated from which a tool like Geth builds the new chain. This chain is then inspected and interacted with via tools like Mist, MetaMask, MyEtherWallet, etc.
Private testnets are excellent for teamwork and closed environments that need to simulate mining and transaction confirmations without exposing their network to the outside world and risking spam attacks.
There’s no expense involved in creating one, other than a small fraction of the CPU and disk space of the developer’s computer being occupied while the testnet is in use. After a private testnet grows enough, it can be exposed to the public through the internet and other interested parties can connect to it and extend it. This lends itself perfectly to experimentation, collaboration, cross-application interaction, and more.
Ether can be mined on even the weakest computers when running a private testnet, and during initialization some addresses can even get some Ether pre-mined for future use if needed.
Testrpc is a NodeJS package which simulates the Ethereum network on a single computer. When launching, it’ll generate several Ethereum addresses, each with some Ether already on it. Testrpc – though a cool idea in theory – usually falls flat in practice due to some bugs and makes for a particularly frustrating experience. In our experience, it’s easier and more reliable to just launch a private testnet (see above) with all the bells and whistles of a proper blockchain, than to bother with setting up Testrpc.
Testnets are an incredibly useful tool in EVM development. They make easy and painless Ethereum software testing possible and provide safety layers on which to experiment before having to launch on the Mainnet. Public testnets like Ropsten, Rinkeby, and Kovan are extremely important for decentralized apps that need to interact with one another – e.g. MetaMask communicating with Status.im, communicating with uPort, etc.
In the next post we’ll demonstrate using Ropsten with Mist.