Skip to content

How to Connect to the Testnet

Dan Perry edited this page Jun 3, 2022 · 25 revisions

Testnet 10 is the supported testnet. Testnet 7 may remain active, but is no longer officially supported by Chia.


How to join testnet

These steps assume you have Chia installed.

Step 1. Run chia init

Step 2. If you do not already have keys generated then run chia keys generate

Step 3. Run chia configure --testnet true

Run chia configure --testnet true, as this command will make your client automatically select and configure itself for the currently-active testnet. If you have previously run chia start for this installation, at this point run chia stop all -d to ensure that no mainnet processes are still running.

Step 3a. Edit ~\.chia\mainnet\config\config.yaml to include testnet10 values

If you are running a version of Chia higher than 1.2.11, ignore this step and edit your config.yaml file at your own risk. If you are running version 1.2.11 or below, you will need to manually edit the config.yaml file to include testnet10 values. You can edit this file using a simple text editor such as Notepad, Vi, Nano, etc. or the IDE of your choice. In config.yaml, add the following testnet10 sections:

...
farmer:
...
    config:
...
      testnet10:
        address_prefix: txch
        default_full_node_port: 58444
...
    constants:
...
      testnet10:
        AGG_SIG_ME_ADDITIONAL_DATA: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2
        DIFFICULTY_CONSTANT_FACTOR: 10052721566054
        DIFFICULTY_STARTING: 30
        EPOCH_BLOCKS: 768
        GENESIS_CHALLENGE: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2
        GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af
        GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc
        MEMPOOL_BLOCK_BUFFER: 10
        MIN_PLOT_SIZE: 18
        NETWORK_TYPE: 1 

After the above code has been added to your config.yaml, move further down the file and replace the existing entries with the following values:

full_node:
...
  dns_servers:
  - dns-introducer-testnet10.chia.net
...
  introducer_peer:
    host: introducer-testnet10.chia.net
...
wallet:
...
  introducer_peer:
    host: introducer-testnet10.chia.net
...

Once those replacements have been made, search the config.yaml file for all instances of the selected_network parameter, which should all show a value of mainnet (or potentially a different testnet). Change all selected_network parameters to show a value of testnet10. Save the file. If you have previously run chia start for this installation, at this point run chia stop all -d to ensure that no mainnet processes are still running.

Step 4. Create a directory named db in the Chia root directory.

Once in root directory (~/.chia/mainnet), you can run mkdir db and cd db on Linux or if using the Windows/macOS GUI you can create the folder as normal.

Step 5. Download the Official Testnet DB (optional)

This step is optional, but it will speed up syncing with the testnet

For Linux users wget https://databases.chia.net/file/chia-public-databases/blockchain_v2_testnet10.sqlite.gz while in the directory (a v1 DB is also available, but no longer updated). Windows users can download it from https://downloads.chia.net/testnet10/ and move it to the db folder you created in step 4.

Make sure to unzip the database before continuing to the next step.

Step 6. Starting Your Node and Getting Peers

Prior to starting your node, you are recommended to delete peers.dat, located in ~/.chia/mainnet/db. If you don't delete this file you might see WARNING Invalid handshake with peer in your log file. The reason for this is that peers.dat will contain mainnet peers, which are not running on the testnet. If you do see these warnings, there's no requirement to take further action -- they'll eventually stop appearing as your invalid peers are replaced with valid ones.

To start your node, run chia start farmer and wait for it to start. Once your node has started, you can connect to Chia's testnet node by using chia show -a testnet10-node.chia.net:58444. You can use chia show -s to check your sync status, and once fully synced you can run chia wallet show to see your wallet. chia wallet get_address will give you your testnet wallet address, which will differentiate itself from your mainnet wallet by beginning with txch instead of xch.

Step 7. (Optional) Getting funds

Go to Chia testnet faucet and input your testnet address from step 6. If it says you are in the queue, it has worked. Funds will not appear in your wallet until you are fully synced to the blockchain.

What to do if you are having trouble with setting up testnet

Join Our Keybase and join the #testnet channel for support

Clone this wiki locally