Back

[**] - 使用parity 搭建eth 全节点

发布时间: 2018-07-16 05:59:00

参考:  https://github.com/paritytech/parity

wiki:  https://wiki.parity.io/Configuring-Parity

之前使用geth,  用一台2 core, 8 g ram的机器同步了3天还不行.  

参考这个著名的吐槽贴: https://github.com/ethereum/go-ethereum/issues/15822 ,  所以就转向了parity . 

2022-1-22: 对于parity, 现在叫做openethereum 了。(parity这个称呼很乱套)

可以直接来这里下载(不用重新编译,这个好麻烦) https://github.com/openethereum/openethereum/releases/tag/v3.3.3

1. 安装rust: 

$ curl https://sh.rustup.rs -sSf | sh

2. 编译安装失败了.  由于我用的是ubuntu, 所以就直接 按照下面的方式: 

ubuntu下直接安装:

$ apt-get install build-essential openssl libssl-dev libudev-dev

$ bash <(curl https://get.parity.io -L) -r stable

但是安装后不知道装到了哪里.  不要紧.

默认的命令位于:   /usr/bin/parity

如果是升级的话:  

参考:https://github.com/paritytech/parity-ethereum/issues/5720

3. 来  https://paritytech.github.io/parity-config-generator 设置配置文件.  

这里需要注意的是:    base_path 要设置成你需要的位置.默认是  ~/.local/share/io.parity.ethereum 

另外,所有的 RPC-API 都应该勾选

保存后,下载,就会得到这个配置文件.  /opt/parity/config.toml 

4. 现在,我们就可以根据  命令来运行 parity 了.  $ parity --config=/opt/parity/config.toml  (注意这里有等号)

另外,要保证 /opt/parity目录下没有其他任何文件。否则parity会报错。(说找不到文件,找不到网络啥的 。。)

5. 我们需要把 parity 做成一个 service.  这样的话就可以方便的启动和停止了. 

  sudo wget https://raw.githubusercontent.com/paritytech/parity/master/scripts/parity.service -O /etc/systemd/system/parity.service
  sudo chmod +x /etc/systemd/system/parity.service
  然后我们检查一下  parity.service , 把配置文件做修改.
  sudo systemctl enable parity
  sudo systemctl start parity

附件: 

我正在使用的配置文件全文:

# This config should be placed in following path:
#   ~/.local/share/io.parity.ethereum/config.toml

[parity]
# Parity continously syncs the chain
mode = "active"
# Blockchain and settings will be stored in /opt/parity.
base_path = "/opt/parity"
# You will be identified as 'coiex' amongst other nodes..
identity = "coiex"

[rpc]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub", "personal", "parity_accounts", "secretstore"]
# Threads for handling incoming connections for HTTP JSON-RPC server.
server_threads = 2
# JSON-RPC over HTTP will be accessible on port 8800.
port = 8800
#  JSON-RPC will be listening for connections on IP 10.146.0.2.
interface = "all"  # 使用all, 允许外部的json-rpc访问

[websockets]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub", "personal"]

[misc]
# Logs will be stored at /opt/parity/logs.
log_file = "/opt/parity/logs/parity.log"
# logging = "debug" # "info", debug, trace
logging = "info"
#logging = "debug"

[mining]
min_gas_price = 1 # 1 wei

注意: 如果你的parity  停掉了,有一段时间不用,再次启动的时候, parity 会加载 snapshot, 这个过程不能被打断, 否则下次会启动重来。 今天我让他跑了3个小时, 15xx/2030, 结果手贱重启了。 又从1开始了。

注意2: 上面的 rpc 的端口可以修改,但是IP地址只能使用内网IP , 对于阿里云不能使用外网IP , 会报错退出。 所以安装的时候要把Parity 跟coiex的主程序安装在一个局域网中。 

Back