# How to Sync and Run Testnet

If you would like to test your smart contract before deploying on main net, we recommend running on Pchain testnet first.

## Download Pchain's testnet release

```
wget https://github.com/pchain-org/pchain/releases/download/v1.0.01/testnet_config.tar.gz -P ~
cd ~
tar -zxf testnet_config.tar.gz
mkdir -p ~/pchain-testnet/.pchain/child_0 ~/pchain-testnet/bin/
cp ~/testnet_config/pchain ~/pchain-testnet/bin/
cp ~/testnet_config/*.json ~/pchain-testnet/.pchain/child_0/
cd ~/pchain-testnet
./bin/pchain --datadir .pchain  init .pchain/child_0/eth_genesis.json child_0
```

## Initialize testnet child\_0

```
cd ~/pchain-testnet
./bin/pchain --datadir=.pchain --testnet --childChain=child_0
```

## Run pchain testnet

```
./bin/pchain --datadir=.pchain --testnet --rpc --rpcapi=eth,web3,admin,tdm,miner,personal,chain,txpool,del --gcmode=archive --rpcvhosts=* --rpcaddr=0.0.0.0 --childChain=child_0 > /dev/null &
```

## Attach to child\_0's console

```
./bin/pchain attach .pchain/child_0/pchain.ipc
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pliangroup.gitbook.io/plian/master/using-the-blockchain/advanced-features/how-to-sync-and-run-testnet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
