Using the Testnet
A testnet network is an almost identical copy of a blockchain that serves as an alternative specifically made for testing without affecting the operation of the original network (mainnet).
Secret Network has its own testnets which are an essential tool for the development of Dapps and mainnet blockchain upgrades. The testnet is not just a test environment(sandbox) for programmers and builders. It is available for all users and can be used to learn how to interact with the Secret Network blockchain without fear of (financial) consequences.
In this step-by-step guide I’ll show you how to connect to a testnet with Keplr and SecretCLI, get some tokens through a faucet and finally interact with secret applications.
The easy way to use a testnet is via the Keplr wallet browser extension, you can install it and set it up by following this guide or this video. For safety reasons we recommend using a separate secondary wallet for testing purposes (read this article to learn about the best practices to stay safe in Secret Defi).
Once you have saved your mnemonic phrase you can connect to the pulsar-2 chain. The pulsar chain is hosted by the Secret Network testnet team which updates it periodically to make sure it’s in parallel with the current mainnet version.
- Click “approve” once the Keplr window pops up to add the chain config
And again to connect the website, and allow it to view your balances etc
- Now you should be able to see the Secret Testnet network on Keplr wallet by selecting it from the drop down menu. (verify that your Secret mainnet and testnet addresses coincide and start with “secret”)
You have now successfully added the Secret Testnet to your wallet and you’re ready to get your first tokens and experiment!
The fastest and easiest way to get some test SCRT into your wallet is to use faucets which are tools that distribute a standard amount of tokens to a specific address.
Remember that all tokens on the Secret Testnet have no real value as they’re free to mint and they’re impossible to transfer to mainnet.
- Paste your address in the text box, verify the captcha and click on “Send me tokens”
In a matter of seconds you should be able to see 100 test SCRT on your Keplr balance, otherwise the faucet may be down and in that case you can use the backup faucet, or let the #secret-testnet channel know on the Secret Network discord, and they should be able to send some your way.
To have access to all the testnet functionalities and to develop you can connect using SecretCLI, a desktop client tool to interact with the blockchain from the console.
- Open your terminal and run the following commands to connect to pulsar-2 and add your wallet:secretcli config node https://rpc.pulsar.scrttestnet.comsecretcli config output jsonsecretcli config chain-id pulsar-2secretcli keys add <a-name> --recover
- Paste your wallet’s mnemonic phrase when asked to do so
On top of that 100 SCRT, the faucet sends you a basket of Secret Tokens that you can only view by generating a new viewing key.
- Copy the contract address
- Open your Keplr extension and click on the hamburger menu on the top left
- Select “Add Token”
- Paste the address and click “Submit” and approve the transaction (you can set high fees as it’s paid in test SCRT)
- You should now be able to see the Secret Token balance on your Keplr extension under the section “Tokens”
Once you have everything set up you can connect to protocols that have a public testnet URL available.
Here’s a table of the main ones:
Alternatively you can directly interact with their testnet secret contracts. Below are some of the main smart contract addresses available:
With Keplr you’ll need to approve a connection request for each protocol that you want to connect to. You can easily manage active website connections under “Manage Connections” in the Keplr settings.