从如下的地址找到openethereum的最新版
https://github.com/openethereum/openethereum/releases/
根据对应系统下载对应版本程序
本文以目前的最新版v3.2.6,本文已Linux的安装为例
下载与解压openethereum
wget https://github.com/openethereum/openethereum/releases/download/v3.2.6/openethereum-linux-v3.2.6.zip
unzip -x openethereum-linux-v3.2.6.zip
chmod +x openethereum
后台运行openethereum
screen -S openethereum
./openethereum --chain xdai --jsonrpc-port=8545 --jsonrpc-cors=all --jsonrpc-interface=all --jsonrpc-hosts=all --jsonrpc-apis=web3,eth,net,parity --ws-interface=all --ws-apis=web3,eth,net,parity,pubsub --ws-origins=all --ws-hosts=all --ws-max-connections=10 --max-peers=100
程序正常运行后,快速同时按下ctrl+a、d,跳出新页面即表示后台运行成功。
关闭窗口
关闭窗口即为退出当前服务器。(成功后台运行openethereum后退出服务器程序也在跑,放心退出)
同步数据
等待大约 30 GB -50GB的区块链数据被下载
开始同步后,它将如下所示:
2021-06-24 03:27:29 Syncing #1381202 0x0911…a910 292.88 blk/s 0.0 tx/s 0.0 Mgas/s 0+23292 Qed LI:#1404493 36/100 peers 9 MiB chain 34 MiB queue RPC: 0 conn, 1 req/s, 26 µs
2021-06-24 03:27:35 Syncing #1383006 0x3f4c…7b4d 360.54 blk/s 1.6 tx/s 0.2 Mgas/s 0+53614 Qed LI:#1439037 35/100 peers 5 MiB chain 79 MiB queue RPC: 0 conn, 2 req/s, 26 µs
2021-06-24 03:27:39 Syncing #1385305 0xdb1a…702a 460.40 blk/s 3.6 tx/s 0.3 Mgas/s 0+53732 Qed LI:#1439037 37/100 peers 9 MiB chain 79 MiB queue RPC: 0 conn, 1 req/s, 26 µs

一旦你完全同步,它看起来像这样:
Imported #14892107 0x7963…1c14 (7 txs, 2.59 Mgas, 48 ms, 3.73 KiB)
4/25 peers 6 MiB chain 131 MiB db 0 bytes queue 7 MiB sync RPC: 0 conn, 2 req/s, 278 µs```
连接到 Metamask
现在您已准备好切换到全新的 RPC。启动 Metamask,转到设置网络,然后添加网络。



像这样填写表格:
本地填写方案
Local xDai
http://localhost:8545
100
xDai
https://blockscout.com/poa/xdai/
服务器填写方案
My xDai
http://你的远程服务器IP:8545
100
xDai
https://blockscout.com/poa/xdai/
点击保存。
确保在“网络”下拉列表中选择了新网络。
看到它在运行
您的下一笔交易将通过您的节点,如下所示:
Transaction mined (hash 0x0000000000000000000000000000000000000000000000000000000000000000)
- 按 Ctrl+C 退出 openethereum 进程。
- 在使用之前保持节点同步。在自己的机器上运行它的主要缺点是链状态需要在例如系统休眠后重新同步。RPC 仍然可以工作,但它只会显示上次同步的状态。
RPC连接端口
swap-endpoint ws://你的服务器IP:8546
或者
swap-endpoint http://你的服务器IP:8545
原创文章,作者:朋远方,如若转载,请注明出处:https://bitchina.info/zailinuxfuwuqizijidajianxdaijiedianjiaocheng/.html