Overview
Stellar operates two primary testing environments: the Testnet and the Futurenet. These networks allow developers to experiment with Stellar features without risking real assets. Periodically, these networks are reset to ensure they remain clean and manageable.What is the Testnet and Futurenet reset?
Testnet and Futurenet are 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. These resets take place approximately quarterly. Resets clear all ledger entries (accounts, trustlines, offers, smart contract data, etc.), transactions, and historical data from Stellar Core, Horizon, and the Stellar RPC, which is why developers should not rely on the persistence of accounts or the state of any balances when using Testnet or Futurenet. You can check current reset dates here.Why resets are important
- Clean Slate: Regular resets ensure that both Testnet and Futurenet provide a clean environment for testing. This helps in avoiding complications arising from old data or configurations.
- Performance: Over time, test environments can accumulate a lot of data, which can slow down performance. Resets help in maintaining optimal performance.
- Protocol Updates: Introducing new features or protocol changes often requires a reset to ensure compatibility and stability.
- Development Cycles: Aligning with development cycles allows developers to plan their testing phases and ensures they have a reliable environment for their work.
Data automation on Testnet and Futurenet
Automating blockchain state on Stellar’s Testnet and Futurenet can streamline development workflows, ensuring that you can consistently test and validate your applications in these environments.Code walkthrough
Prerequisites:
- Node.js and
npminstalled. - Stellar SDK for JavaScript and
fsinstalled - An understanding of the rudimentary, retry-enabled transaction polling function
submitTxwhich we outlined in another guide
Code
createAccount(networkURL):
issueAsset(issuerKeys, receivingKeys, customAsset):
createLiquidityPool(accountKeypair, nativeAsset, customAsset):
deployAndInvokeContract(deployer, contractWasmFilePath):
automateSetup():
sleep(ms): A utility function to introduce delays in asynchronous operations.
submitTx(tx): a retry-enabled transaction submission function submitTx outlined in another guide