# 迁移测试网 (Migrating testnets)

本指南将帮助您将验证节点从一个测试网迁移到另一个测试网。这些步骤是可选的，对于大多数测试网，这些步骤不是必需的。

***

## 重置您的验证节点 (Resetting your validator node) (可选)

{% hint style="info" %}
在 `v0.19.0` 的发布中，我们为验证节点引入了强制性的密钥。这些键是用于以太坊桥接目的的 `eth_hot_key` 和 `eth_cold_key`。
{% endhint %}

### 定位 namada 基本目录 (Locate the namada base directory)

根据您要迁移的测试网的不同，基本目录将位于不同的地方。出于这个原因，我们将把基本目录路径保存到一个变量中。

### `v0.15.3` 之前 (Before `v0.15.3`)

如果您是从 `v0.15.3` 之前的测试网迁移，那么您的主目录和相关文件将位于 `.namada` 中。该目录的位置取决于您最初在哪里运行了命令 `namadac utils join-network --chain-id <CHAIN_ID> --genesis-validator <ALIAS>`。它将位于执行该命令的目录中。

找到后，您可以将基本目录路径保存到一个变量中。例如，如果 join-network 命令是从您的主目录运行的，您可以运行：

```
export BASE_DIR=$HOME/.namada
```

### `v0.15.3` 之后 (After `v0.15.3`)

如果您是从 `v0.15.3` 之后的测试网迁移，那么您的基本目录和相关文件将位于 Linux 上的 `.local/share/namada` 和 MacOS 上的 `Library/Application Support/Namada`。您可以通过运行以下命令来验证您机器上的默认目录：

```
export BASE_DIR=$(namadac utils default-base-dir)
```

{% hint style="info" %}
技术上，正确的目录将是分配给 $XDG\_DATA\_HOME 的目录，但如果您没有设置该变量，它将默认为上述目录。
{% endhint %}

<br>

### 1.重要！在账本基本目录中保存您的 pre-genesis 文件夹 (IMPORTANT! Save your pre-genesis folder in the ledger base directory)

在我们删除任何文件夹之前，我们想确保保存了我们的 pre-genesis 文件夹。此文件夹包含您的验证器密钥，我们要确保不会丢失它们。

```
mkdir $HOME/backup-pregenesis && cp -r $BASE_DIR/pre-genesis $HOME/backup-pregenesis/
```

### 2.确保密钥已保存 (Ensure keys are saved)

`ls backup-pregenesis` 应该输出保存 `wallet.toml`

### 3.删除基本目录 (Delete the base directory)

```
rm -rf $BASE_DIR/*
```

### 4.检查 namada 和 cometbft 的二进制文件是否正确 (Check that namada and cometbft binaries are correct.)

`namada --version` 应该输出 `v0.22.0` 并且 `cometbft` 版本应该输出 `0.37.2`

### 5.创建一个 pre-genesis 目录 (Create a pre-genesis directory)

```
mkdir $BASE_DIR/pre-genesis
```

<br>

### 6.将备份的文件复制回 $BASE\_DIR/pre-genesis 文件夹 (Copy the backuped file back to $BASE\_DIR/pre-genesis folder)

```
cp -r backup-pregenesis/* $BASE_DIR/pre-genesis/
```

现在，您应该准备好了！


---

# 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://tantalum666.gitbook.io/namada-docs-chinese/ji-cheng-zhi-nan-integration-guide/wang-luo-networks/ce-shi-wang-testnets/qian-yi-ce-shi-wang-migrating-testnets.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.
