Stellar has two networks: the public network (Pubnet, also called Mainnet) and the test network (Testnet). The Pubnet is the main network used by applications in production. It connects to real rails and requires XLM to cover minimum balances and transaction fees. The Testnet is a smaller, free-to-use network maintained by SDF that functions like the Pubnet but doesn’t connect to real money. It has a built-in testnet XLM faucet, and it's the best place for developers to test their applications.
Stats: Testnet versus Pubnet
- SDF runs three core validator nodes
- SDF offers a free Horizon instance you can use to interact with the Testnet
- Friendbot is a faucet you can use for free Testnet XLM
- Testnet is limited to 100 operations per ledger
- Validator nodes are run by the public
- SDF offers a free Horizon instance to interact with the Pubnet, or you can run your own
- You need to fund your account with XLM from another account
- Pubnet is limited to 1,000 operations per ledger
Friendbot is a bot that funds accounts with fake XLM on Testnet. You can request XLM from friendbot using the Stellar Laboratory or with various SDKs. Requests to friendbot are rate limited, so use it wisely. Friendbot provides 10,000 fake XLM when funding a new Testnet account.
If you are creating multiple Testnet accounts, fund your first account with friendbot and then use that first account to fund your subsequent accounts using the Create Account operation.
Testnet data reset
The Testnet is reset periodically to the genesis ledger to declutter the network, remove spam, reduce the time needed to catch up on the latest ledger, and help maintain the system. Resets clear all ledger entries (accounts, trustlines, offers, etc.), transactions, and historical data from Stellar Core and Horizon- which is why developers should not rely on the persistence of accounts or the state of any balances when using Testnet.
Testnet resets happen once per quarter at 17:00 UTC and are announced at least two weeks in advance on the Stellar Dashboard and through several developer community channels. Here are the 2023 dates:
March 15, 2023
June 14, 2023
September 13, 2023 Note: this reset was skipped due to its proximity to the Protocol 20 Testnet upgrade.
December 18, 2023
If you run a Testnet Horizon instance, you need to re-join and re-sync to the network after a reset. Check out how to do that here: Testnet Reset.
Test data automation
It is recommended that you have testing infrastructure that can repopulate the Testnet with useful data after a reset. This will make testing more reliable and will help you scale your testing infrastructure to a private network if you choose to do so. For example, you may want to:
- Generate issuers of assets for testing the development of a wallet
- Generate orders on the order book (both current and historical) for testing the development of a trading client
- Recreate liquidity pools
If you maintain an application, you should think about creating a data set that is representative enough to test your primary use cases, and allow for robust testing even when Testnet is not available.
A script can automate this entire process by creating an account with friendbot and submitting a set of transactions that are predefined as a part of your testing infrastructure.
What Testnet should and should not be used for
Testnet is good for
- Creating test accounts (with funding from friendbot)
- Developing applications and exploring tutorials on Stellar without the potential to lose any assets
- Testing existing applications against new releases or release candidates of Stellar Core and Horizon
- Performing data analysis on a smaller, non-trivial data set compared to the Pubnet
Testnet is bad for
- Load and stress testing
- High availability test infrastructure- SDF does not guarantee Testnet availability
- Long-term storage of data on the network since the network resets periodically
- A testing infrastructure that requires more control over the test environment, such as:
- The ability to control the data reset frequency
- The need to secure private or sensitive data (before launching on the Pubnet) You can always run your own test network for use cases that don’t work well with SDF’s Testnet.
Moving your project from Testnet to production
The Pubnet and Testnet each have their own unique passphrase, which is used to validate signatures on a given transaction.
The current passphrases for the Stellar Pubnet and Testnet are:
Pubnet: 'Public Global Stellar Network ; September 2015'
Testnet: 'Test SDF Network ; September 2015'
For applications that don’t rely on the state of the network (such as specific accounts needing to exist), you move to production by changing the network passphrase and ensuring your Horizon instance is connected to Pubnet.
If you’ve been running a Stellar Core or Horizon instance against the Testnet and want to switch to production, changing the passphrase will require both respective databases to be completely reinitialized.
To learn more about network passphrases, see our Network Passphrase Encyclopedia Entry