# 在Windows上使用1个钱包设置Masternode

在之前的文章中－<https://docs.win.win/twins/zhong-wen/twins-masternodes/shi-yong-liang-ge-qian-bao-zai-windows-xi-tong-shang-she-zhi-zhu-jie-dian>，我们介绍了如何在Windows上使用2个钱包来设置masternode ；在本指南，我们将仅使用一个TWINS钱包在Windows上设置masternode。

我们打算使用一个TWINS钱包同时作为**远程钱包**和**本地钱包**，我们先解释一下，将一个钱包用于两个目的的缺点和限制；如果我们将TWINS硬币存储在其中，使用它来发送和接收付款以及赌注staking，我们称之为本地钱包；如果它是空的，且目的是存储masternode私钥和使用静态IP地址并始终在线，我们将此钱包称为远程钱包。 \
当我们将钱包同时作为本地和远程钱包时，这会带来安全风险，因为你的钱包始终在线，并且有已知的主节点IP地址，有些人会使用这些信息来试图进入你的TWINS钱包并窃取硬币。 \
因为每个远程钱包只能作为一个masternode使用，如果你不打算启动多个masternode，你可以考虑使用此方法，即使用这个钱包作为MN并进行赌注staking。

所有**本地钱包**的主要设置都在masternode.conf文件中，**远程钱包**的设置位于twins.conf文件中。

这里我们不会介绍TWINS钱包设置过程，请参考其他篇指南：\
<https://docs.win.win/twins/zhong-wen/twins-qian-bao/windows-qian-bao-an-zhuang>\
我们假设你的PC或笔记本电脑上已经安装了TWINS钱包。

* 首先需要生成一个masternode私钥，打开**本地钱包**，然后转到«工具 > 调试控制台»，然後输入

`masternode genkey`

* 将结果复制到记事本，例：3F4WMMcWdx8pMTeXoDpiXk8adqaLrPPUWSmU9FRCKmy3hhbJXyZ

![](/files/-LiCY4cHb7G6A7Zpex0u)

* 在VPS上的*twins.conf*中输入下列信息，你可以在\~/.twins数据目录中访问它，或单击«工具 > 打开钱包配置文件»；如果系统询问用何种程序打开，可以选择**记事本**。

![](/files/-LiCY9_8S7c8a-lZ1jVs)

输入以下配置：

{% code title="twins.conf" %}

```
 rpcuser=输入用户名
 rpcpassword=输入密码
 rpcallowip=127.0.0.1
 server=1
 daemon=1
 logtimestamps=1
 maxconnections=256
 masternode=1
 externalip=你的ip地址:37817
 masternodeprivkey= 输入在本地钱包用masternode genkey生成的masternode私钥
```

{% endcode %}

{% hint style="info" %}
确保将rpcuser和rpcpassword替换为你自己的。

Externalip= 是你的ip地址，使用IPv4或IPv6，若使用IPv6，必须将地址放在方括号中，例：\[2a03:7777:2222:12:1111:dddd:aaaa:37817]
{% endhint %}

* 更改twins.conf文件后，必须重新启动TWINS钱包，使**远程钱包**设定生效。&#x20;
* 回到**本地钱包**，新增一个自己的钱包地址并发送1,000,000 TWINS。可以在创建过程中命名此地址，如何执行此操作在手册«使用钱包» 中有介绍 ：<https://docs.win.win/twins/zhong-wen/twins-qian-bao/shi-yong-qian-bao>&#x20;
* 或者在«工具 > 调试控制台» 输入

  `getaccountaddress chooseAnyNameForYourMasternode`
* 现在这个地址已有别名（例如MN），向地址发送1,000,000 TWINS作为抵押。
* 交易有一个确认后，我们能输出它的TXID，转到 «工具 > 调试控制台»并输入

`masternode outputs`

* 你会看到跟下图类似的输出，有2个字段 － “txhash”和“outputidx” ，将这这段信息复制到masternode.conf文件中。

![](/files/-LiCYqSzRdgaTGB1075r)

* 直接在钱包的data文件夹中打开masternode.conf文件，或者通过«工具 > 打开主节点配置文件»，并像以下示例一样填写它：

```
<Masternode 别名> <VPS IP 地址>:37817 <Masternode 私钥> <Transaction ID> <Output Index索引>
```

```
#按上述格式示例：mn1 67.156.12.34:37817 3F4WMMcWdx8pMTeXoDpiXk8adqaLrPPUWSmU9FRCKmy3hhbJXyZ b7f6e50d405e3cbccb0e165cf9ce2b4b6d3c621ef26b281c43fc5bffcbdb14ce 0
```

![](/files/-LiCZ6v_fr7zYxTfAY9b)

* 重新启动你的**本地钱包**并等待MN抵押品的交易获得16次确认。
* 转到«Masternodes»选项卡，你将看到带有MISSING状态的新MN和IP地址、别名等；这是正常的，现在我们必须启动它，只需右键单击MN并单击«Start Alias，“MISSING”状态将立即变为“ENABLED”。

![](/files/-LiCZB0QdqidM18bTePT)

* 现在你可以检查VPS上**远程钱包**中的MN状态，打开远程钱包中调试控制台：«工具 > 调试控制台» 并输入

`masternode status`

* 你会看到类似下面的輸出：

```
{
  "txhash": "b7f6e50d405e3cbccb0e165cf9ce2b4b6d3c621ef26b281c43fc5bffcbdb14ce",
  "outputidx": 0,
  "netaddr": "67.156.12.34:37817",
  "addr": "WYHXL4hsosW3nWTs6AFwQxdhsKEGcEWVaz",
  "status": 4,
  "message": "Masternode successfully started"
}
```

![](/files/-LiCZJeJ0bio1ydFAXZj)

可以在TWINS区块浏览器上检查你的MN状态： <https://explorer.win.win/masternodes> 通过地址找到你的MN，你的MN状态必须为“Active”。

{% hint style="info" %}
启动masternode后，其状态将按以下顺序更改：

"ACTIVE" --> 启动后约2-3小时

"EXPIRED" --> 只需几分钟

"REMOVE" --> 只需几分钟

"ENABLED" --> 最终masternode将保持此状态， "Active" 时间将开始增加

注意：若你的本地钱包中的masternode状态为“MISSING”，请检查其在[区块浏览器](https://explorer.win.win/masternodes)中masternode的状态，它可能是EXPIRED / REMOVE。
{% endhint %}

{% hint style="warning" %}
使用此公式来计算第一个奖励需要多长时间 \
\&#xNAN;***MN总数\*2.6\60*** \
\&#xNAN;*在撰写本文时，MN的总数为465，因此465\**&#x32;.6\60 = 20.15小时，约20小时9分钟。
{% endhint %}


---

# 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-masternodes/shi-yong-yi-ge-qian-bao-zai-windows-xi-tong-shang-she-zhi-zhu-jie-dian.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.
