> For the complete documentation index, see [llms.txt](https://docs.pharos.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.xyz/pharos-testnet-rebuild-node-with-preserved-node-info.md).

# Pharos Testnet: Rebuild Node with Preserved Node Info

This guide helps you **rebuild your Pharos Testnet node** while preserving your **existing validator identity** (node info). This is useful when resetting the database but retaining validator keys and configuration.

***

### **1️⃣ Stop and Backup the Existing Node**

```
docker stop pharos-testnet
mv /data/testnet /data/testnet_bak
docker rm pharos-testnet
```

***

### **2️⃣ Start a Fresh Node Container**

```
docker run -d --name pharos-testnet \\
  -v /data/testnet:/data \\
  -p 18100:18100 -p 18200:18200 -p 19000:19000 \\
  public.ecr.aws/k2g7b7g1/pharos/testnet:63b85b6b
```

***

### **3️⃣ ⏳ Wait for Initial Sync (\~3 minutes)**

**Do not run docker stop or docker-compose down during this step.**

You can check sync progress using:

```
curl 127.0.0.1:18100/ \\
  -X POST \\
  -H "Content-Type: application/json" \\
  --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

***

### **4️⃣ Stop the Node and Restore Node Identity**

```
docker stop pharos-testnet
```

Replace new config with the backup node info:

```
rm -rf /data/testnet/pharos-node/domain/light/data/
rm -rf /data/testnet/pharos-node/domain/light/certs/
rm -rf /data/testnet/resources/

mv /data/testnet_bak/pharos-node/domain/light/data/ /data/testnet/pharos-node/domain/light/data/
mv /data/testnet_bak/pharos-node/domain/light/certs/ /data/testnet/pharos-node/domain/light/certs/
mv /data/testnet_bak/resources/ /data/testnet/resources/
```

***

### **5️⃣ Restart and Finalize**

```
docker start pharos-testnet
```

Wait \~3 minutes again for sync to resume. You can check status using:

```
curl 127.0.0.1:18100/ \\
  -X POST \\
  -H "Content-Type: application/json" \\
  --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

***

### **6️⃣ Clean Up Backup**

```
rm -rf /data/testnet_bak
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pharos.xyz/pharos-testnet-rebuild-node-with-preserved-node-info.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
