# 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: 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://docs.pharos.xyz/pharos-testnet-rebuild-node-with-preserved-node-info.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.
