本文转自:http://ethfans.org/wikis/%E6%98%9F%E7%81%AB%E8%8A%82%E7%82%B9%E8%AE%A1%E5%88%92-Windows-%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3
由于Windows坑太多,复盘太痛苦,下面的步骤是根据我回忆配置节点的过程整理出来的,如果您想尝试在Windows系统下运行节点,最好保持与我的环境一样 * 系统环境:Windows 2008 R2, 64bit * 假设你的用户名是ethfans(根据实际情况替换成自己的windows登录名)
1. 安装node
下载并安装最新的nodejs:https://nodejs.org/en/download/ 选择windows 64-bit
2. 安装git
下载并安装最新的git:https://git-scm.com/(点击网站上的下载链接,会自动为你选择64-bit版本,如果不是,请手动选择64-bit版本)
安装过程基本都是默认选项,安装完成后,确认应用程序文件夹下面有:Git Bash
3. 下载最新的Geth或Parity
Geth:https://github.com/ethereum/go-ethereum/releases
Parity:https://github.com/ethcore/parity/releases/download/v1.3.1/parity-1.3.1-install-win64.exe
Parity 下载下来后是一个windows安装程序,直接默认安装即可,安装完成后,Parity应该在 “C:\Program Files\Ethcore\Parity”下面
4. 下载ethstate-client
https://github.com/cubedro/eth-net-intelligence-api/archive/master.zip
下载完成后,将下载的文件解压到 “C:\Users\ethfans\ethstats-client"文件夹下
***注意解压时,默认会嵌套一个eth-net-intelligence-api文件夹,将所有文件从这个文件夹下面移到 ethstats-client文件夹下
5. 将geth.exe和parity.exe移到 “C:\Users\ethfans\"文件夹下面(如果你不想运行parity,只需要移动geth)
6. 启动Git Bash
执行下列安装
npm install pm2 -g
npm install xmlhttprequest
npm install utf8
npm install crypto-js
npm install bignumber.js
npm install socket.io
npm install socketio
7. 安装完成以后检查一下
pm2 -v
node -v
npm -v
确保都能看到反馈的版本号
8. 安装 ethstats-client
cd ethstats-client
npm install
cd
9. 准备Json文件
[ { "name" : "ethstats-client", "cwd" : "ethstats-client", "script" : "app.js", "logdateformat" : "YYYY-MM-DD HH:mm Z", "logfile" : "node-app-log.log", "outfile" : "node-app-out.log", "errorfile" : "node-app-err.log", "mergelogs" : true, "watch" : false, "maxrestarts" : 10, "execinterpreter" : "node", "execmode" : "forkmode", "env": { "NODEENV" : "production", "RPCHOST" : "localhost", "RPCPORT" : "8545", "LISTENINGPORT" : "30303", "INSTANCENAME" : "", //<-双引号内填写您的节点名称信息。如果是公司运行的节点,建议写成【贵公司网站】+公司名字,如果是个人运行的节点,建议写成【Ethfans】+个人名字。 "CONTACTDETAILS" : "", //<-双引号内填写您的联系信息,如网址或邮箱地址。 "WSSERVER" : "wss://stats.ethfans.org", "WSSECRET" : "ethfans4you", "VERBOSITY" : 2 } }, { "name" : "geth", "script" : "geth.exe", "args" : "--rpc --fast --maxpeers 100 --cache 512", "logdateformat" : "YYYY-MM-DD HH:mm Z", "mergelogs" : false, "watch" : false, "maxrestarts" : 10, "execinterpreter" : "none", "execmode" : "forkmode" } ]
将上面的代码保存为 processesForGeth.json (注意选择utf-8,否则不能再星火节点上显示中文名称)
[ { "name" : "ethstats-client", "cwd" : "ethstats-client", "script" : "app.js", "log_date_format" : "YYYY-MM-DD HH:mm Z", "log_file" : "node-app-log.log", "out_file" : "node-app-out.log", "error_file" : "node-app-err.log", "merge_logs" : true, "watch" : false, "max_restarts" : 10, "exec_interpreter" : "node", "exec_mode" : "fork_mode", "env": { "NODE_ENV" : "production", "RPC_HOST" : "localhost", "RPC_PORT" : "8545", "LISTENING_PORT" : "30303", "INSTANCE_NAME" : "", //<-双引号内填写您的节点名称信息。如果是公司运行的节点,建议写成【贵公司网站】+公司名字,如果是个人运行的节点,建议写成【Ethfans】+个人名字。 "CONTACT_DETAILS" : "", //<-双引号内填写您的联系信息,如网址或邮箱地址。 "WS_SERVER" : "wss://stats.ethfans.org", "WS_SECRET" : "ethfans4you", "VERBOSITY" : 2 } }, { "name" : "parity", "script" : "parity.exe", "ARGS" : "--max-peers 100 --fast-and-loose", "log_date_format" : "YYYY-MM-DD HH:mm Z", "merge_logs" : false, "watch" : false, "max_restarts" : 10, "exec_interpreter" : "none", "exec_mode" : "fork_mode" } ]
将上面的代码保存为 processesForParity.json (注意选择utf-8,否则不能再星火节点上显示中文名称)
10. 配置windows防火墙
允许geth和parity通过防火墙
![](http://upyun-assets.ethfans.org/uploads/photo/image/92dc7bee4cec4eb1bfae1a176ed0a4f0.png)
注意这里的geth.exe 和parity.exe 是位于 "C:\Users\ethfans\"下面的那两个文件
11. 到这里全部完成了
如果你要启动geth节点:
pm2 start processesForGeth.json
如果要启动parity节点:
pm2 kill
pm2 start processesForParity.json
pm2 status 查看一下是否两个进程都正确启动了