# 备份和恢复您的钱包

### 备份：&#x20;

本文档介绍如何安全备份钱包文件，以确保在电脑或笔记本电脑损坏或丢失的情况下仍然能安全存储。 TWINS Core将所有控制TWINS地址所需的文件存储在名为 *wallet.dat* 的单个文件中。此钱包采用Berkeley DB格式，并存储用于管理您TWINS区块链余额的私钥/公钥密钥对。

#### 从TWINS Core备份：

首先，永远不要在TWINS Core运行时复制wallet.dat文件。如果钱包已打开，请使用**文件>备份钱包**菜单。

![](/files/-LZ8gURGpWlcIiVhtric)

选择此菜单选项时，将出现一个对话框，指定文件的保存位置。输入文件名称，选择一个位置，然后单击**保存**。

#### 通过复制wallet.dat进行备份

**如果TWINS Core不在运行中**，您还可以通过将*wallet.dat*文件复制到另一个位置来备份您的钱包。此文件位于*twins*数据文件夹中。您可以安装期间选择指定此文件夹的位置，但默认情况下，该文件夹在不同操作系统上的以下位置：

* **Windows**\
  `C:\Users\YourUserName\Appdata\Roaming\twins`\
  \
  您可以通过Windows Key + R并键入`%APPDATA%\twins` 直接访问此文件夹
* **Linux**\
  `/home/YourUserName/.twins`

  \
  您可以直接在终端输入 `cd ~/ .twins`或使用文件中的**Go> Enter Location** **（前往>输入位置）**&#x83DC;单项在路径栏中输入 `~/.twins`来访问此文件夹
* **macOS**\
  `/Users/YourUserName/Library/Application`\
  \
  您可以通过在终端输入

  `cd ~/Library/Application Support/twins`或在Finder中的**Go> Go To Folder（前往>前往文件夹）**&#x83DC;单项的对话框中输入`~/Library/Application Support/twins`来访问此文件夹

确保TWINS Core不在运行中，然后只需以您操作系统的正常方式将*wallet.dat*文件从此文件夹复制到另一位置即可。

{% hint style="warning" %}
**如果您有主节点，还必须备份*****masternode.conf*****文件。**

**最好也备份*****twins.conf*****文件，因为它包含您钱包的个性化设置。**

**上述两个文件都和wallet.dat文件在同一目录下。**
{% endhint %}

{% hint style="warning" %}
**将钱包文件备份到USB设备上，并将该设备放置到远离电脑的位置。**
{% endhint %}

### 恢复：

要恢复备份，请在目标系统上安装TWINS Core（如果已安装则将钱包关闭），并将*twins*文件夹中的现有*wallet.dat*文件重命名为*wallet.old*

然后将备份钱包文件复制到*twins*数据文件夹，并确保它名为*wallet.dat*。现在，当你再次启动TWINS Core时，它将加载新钱包。不要在TWINS Core运行时替换*wallet.dat*，因为这会导致数据损坏。

如果还备份了*masternode.conf* 和*twins.conf* 文件，则将这两个文件也复制过来。


---

# 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.win.win/twins/zhong-wen/twins-qian-bao/bei-fen-he-hui-fu-ni-de-qian-bao.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.
