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 0900 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
December 13, 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