首页 > 其他分享 >polygon部署 mainnet 0.3.x

polygon部署 mainnet 0.3.x

时间:2023-01-23 13:31:31浏览次数:48  
标签:01 20 polygon mainnet 19 0.3 2023 heimdalld

环境要求

  • 内存:16-32 GB
  • CPU:4-8核CPU(t3 xLarge)
  • 存储:至少 650GB SSD(确保它是可扩展的)

安装环境依赖

安装编译环境

~# sudo apt-get install build-essential -y

安装go

~# wget https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz
~# tar xf go1.17.5.linux-amd64.tar.gz -C /usr/local/
~# echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile
~# . /etc/profile
~# go version
go version go1.19 linux/amd64

heimdall

安装heimdall

~# git clone https://github.com/maticnetwork/heimdall
~# cd heimdall/
~/heimdall# git checkout v0.3.0
~/heimdall# make install
# ls -l go/bin/
total 107752
-rwxr-xr-x 1 root root 45106296 Jan 20 16:50 heimdallcli
-rwxr-xr-x 1 root root 65221904 Jan 20 16:50 heimdalld
# cp /root/go/bin/heimdall* /usr/bin/

创建heimdall数据目录

# mkdir /data/polygon/heimdall -pv

Initialize Heimdall configs

# heimdalld init --chain=mainnet --home /data/polygon/heimdall/
# ls -l /data/polygon/heimdall/
total 0
drwx------ 2 root root 169 Jan 20 16:04 config
drwx------ 2 root root 47 Jan 20 16:04 data
# ls -l /data/polygon/heimdall/config/
total 52
-rw-r--r-- 1 root root 957 Jan 20 16:04 app.toml
-rw-r--r-- 1 root root 10558 Jan 20 16:04 config.toml
-rw-r--r-- 1 root root 21417 Jan 20 16:04 genesis.json
-rw-r--r-- 1 root root 1033 Jan 20 16:04 heimdall-config.toml
-rw------- 1 root root 148 Jan 20 16:04 node_key.json
-rw------- 1 root root 349 Jan 20 16:04 priv_validator_key.json
# ls -l /data/polygon/heimdall/data/
total 4
-rw------- 1 root root 48 Jan 20 16:04 priv_validator_state.json

修改配置文件

moniker

# grep moniker /data/polygon/heimdall/config/config.toml
moniker = "polygon-01"

prometheus

# sed -i 's@prometheus = false@prometheus = true@g' /data/polygon/heimdall/config/config.toml

seeds

# sed -i 's/seeds = ""/seeds="[email protected]:26656,[email protected]:26656"/g' /data/polygon/heimdall/config/config.toml

heimdalld.service

[Unit]
Description=heimdalld
StartLimitIntervalSec=500
StartLimitBurst=5
[Service]
Restart=on-failure
RestartSec=5s
WorkingDirectory=/data/polygon/heimdall
ExecStart=/usr/bin/heimdalld start --home "/data/polygon/heimdall" --chain=mainnet --rest-server
Type=simple
LimitNOFILE=65536
# User=heimdall
[Install]
WantedBy=multi-user.target

bor

安装bor

~# git clone https://github.com/maticnetwork/bor
~# cd bor
~# git checkout v0.3.3
~# make bor
~# cp bor/build/bin/bor /usr/bin/

创建bor数据目录

# mkdir -pv /data/polygon/bor/data/bor/chaindata

bor.service

[Unit]
Description=bor
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/bor server -config "/data/polygon/bor/config.toml"
Type=simple
KillSignal=SIGINT
# User=bor
TimeoutStopSec=120

[Install]
WantedBy=multi-user.target

config.toml

旧版本升级新版本可以使用scripts/getconfig.sh脚本将start.sh参数转换为config.toml文件

chain = "mainnet"
# identity = "node_name"
# log-level = "INFO"
datadir = "/data/polygon/bor/data"
# ancient = ""
# keystore = ""
syncmode = "full"
# gcmode = "full"
gcmode "archive"
# snapshot = true
# ethstats = ""

# ["eth.requiredblocks"]

[p2p]
maxpeers = 50
port = 30303
# maxpendpeers = 50
# bind = "0.0.0.0"
# nodiscover = false
# nat = "any"
# [p2p.discovery]
# v5disc = false
bootnodes = ["enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303", "enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"]
# bootnodesv4 = []
# bootnodesv5 = []
# static-nodes = []
# trusted-nodes = []
# dns = []

# [heimdall]
# url = "http://localhost:1317"
# "bor.without" = false
# grpc-address = ""

[txpool]
nolocals = true
pricelimit = 30000000000
accountslots = 16
globalslots = 32768
accountqueue = 16
globalqueue = 32768
lifetime = "1h30m0s"
# locals = []
# journal = ""
# rejournal = "1h0m0s"
# pricebump = 10

[miner]
gaslimit = 30000000
gasprice = "30000000000"
# mine = false
# etherbase = ""
# extradata = ""

[jsonrpc]
ipcpath = "/data/polygon/bor/bor.ipc"
# ipcdisable = false
# gascap = 50000000
# txfeecap = 5.0
[jsonrpc.http]
enabled = true
port = 8545
host = "0.0.0.0"
api = ["eth", "net", "web3", "txpool", "bor"]
vhosts = ["*"]
corsdomain = ["*"]
# prefix = ""
[jsonrpc.ws]
enabled = false
port = 8546
corsdomain = ["*"]
# prefix = ""
host = "0.0.0.0"
# api = ["web3", "net"]
origins = ["*"]
# [jsonrpc.graphql]
# enabled = false
# port = 0
# prefix = ""
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.timeouts]
# read = "30s"
# write = "30s"
# idle = "2m0s"

[gpo]
# blocks = 20
# percentile = 60
# maxprice = "5000000000000"
ignoreprice = "30000000000"

[telemetry]
metrics = true
# expensive = false
# prometheus-addr = ""
# opencollector-endpoint = ""
# [telemetry.influx]
# influxdb = false
# endpoint = ""
# database = ""
# username = ""
# password = ""
# influxdbv2 = false
# token = ""
# bucket = ""
# organization = ""
# [telemetry.influx.tags]

[cache]
cache = 4096
# gc = 25
# snapshot = 10
# database = 50
# trie = 15
# journal = "triecache"
# rejournal = "1h0m0s"
# noprefetch = false
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"

# [accounts]
# unlock = []
# password = ""
# allow-insecure-unlock = false
# lightkdf = false
# disable-bor-wallet = false

# [grpc]
# addr = ":3131"

# [developer]
# dev = false
# period = 0

Polygon Chains Snapshots

Chains Snapshots 下载

https://snapshots.matic.today/

Heimdall Snapshots

# wget -c https://matic-blockchain-snapshots.s3-accelerate.amazonaws.com/matic-mainnet/heimdall-snapshot-2023-01-17.tar.gz -O - | tar -xzf - -C /data/polygon/heimdalld/data/

bor Snapshots

# wget -c https://matic-blockchain-snapshots.s3-accelerate.amazonaws.com/matic-mainnet/bor-fullnode-snapshot-2023-01-17.tar.gz -O - | tar -xzf - -C /data/polygon/bor/data/bor/chaindata

Start services

启动heimdall

# systemctl enable heimdalld && systemctl start heimdalld

启动bor

# systemctl enable bor && systemctl start bor

查看服务日志

heimdall服务日志

# journalctl -u heimdalld.service -f
Jan 20 18:37:37 polygon-01 systemd[1]: Started heimdalld.
Jan 20 18:37:37 polygon-01 heimdalld[191353]: INFO [2023-01-20|18:37:37.460] starting ABCI with Tendermint module=main
Jan 20 18:37:37 polygon-01 heimdalld[191353]: DEBUG[2023-01-20|18:37:37.482] Invalid ETH RPC timeout provided, falling back to default value timeout=5s
Jan 20 18:37:37 polygon-01 heimdalld[191353]: DEBUG[2023-01-20|18:37:37.482] Invalid BOR RPC timeout provided, falling back to default value timeout=5s
Jan 20 18:37:38 polygon-01 heimdalld[191353]: INFO [2023-01-20|18:37:38.267] Starting application REST service (chain-id: "")... module=rest-server
Jan 20 18:37:38 polygon-01 heimdalld[191353]: INFO [2023-01-20|18:37:38.268] GRPC Server started module=gRPC-server addr=0.0.0.0:3132
Jan 20 18:37:38 polygon-01 heimdalld[191353]: INFO [2023-01-20|18:37:38.268] Starting RPC HTTP server on [::]:1317 module=rest-server
Jan 20 18:37:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:37:38.488] Stopping peer for error module=p2p peer="Peer{MConn{35.230.116.151:26656} 25f5f65a09c56e9f1d2d90618aa70cd358aa68da out}" err=EOF
Jan 20 18:38:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:38:08.950] Stopping peer for error module=p2p peer="Peer{MConn{159.203.9.164:26656} f4f605d60b8ffaaf15240564e58a81103510631c out}" err=EOF
Jan 20 18:38:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:38:38.783] Stopping peer for error module=p2p peer="Peer{MConn{44.232.55.71:26656} 4fb1bc820088764a564d4f66bba1963d47d82329 out}" err=EOF
Jan 20 18:39:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:39:08.965] Stopping peer for error module=p2p peer="Peer{MConn{35.221.13.28:26656} 3b23b20017a6f348d329c102ddc0088f0a10a444 out}" err=EOF
Jan 20 18:39:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:39:38.764] Stopping peer for error module=p2p peer="Peer{MConn{35.230.116.151:26656} 25f5f65a09c56e9f1d2d90618aa70cd358aa68da out}" err=EOF
Jan 20 18:40:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|18:40:08.970] Stopping peer for error module=p2p peer="Peer{MConn{159.203.9.164:26656} f4f605d60b8ffaaf15240564e58a81103510631c out}" err=EOF
....
Jan 20 19:01:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:38.773] dialing failed (attempts: 1): auth failure: conn.ID (e1ca3b2c6f21d9f6553e0c4203243966875a5ccf) dialed ID (3513660507481b865c7153dea08d87ab04d2221d) mismatch module=pex [email protected]:26656
Jan 20 19:01:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:38.904] Stopping peer for error module=p2p peer="Peer{MConn{66.18.13.143:26656} 08837fa7466717f47dd84f66c20a5b1f628c301a out}" err=EOF
Jan 20 19:01:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:38.958] Stopping peer for error module=p2p peer="Peer{MConn{185.8.106.242:26656} 09244c6ba589271a7f38fc67df6d020e8a423e10 out}" err=EOF
Jan 20 19:01:38 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:38.977] dialing failed (attempts: 1): auth failure: conn.ID (b26adff7b8be5e1a062b3d5b18ac283e5d1e1245) dialed ID (840e53266910bef0d31c9ae4c32f2837cd0877d3) mismatch module=pex [email protected]:26656
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.018] Stopping peer for error module=p2p peer="Peer{MConn{142.4.219.184:26656} 71a6f7d0ab0c7a17f88d9ba197cd4da94c64c366 out}" err=EOF
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.214] Stopping peer for error module=p2p peer="Peer{MConn{176.9.38.172:26656} bb15a8858348ce49a87ff3b2e8c13a5441d58d4b out}" err=EOF
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.218] Stopping peer for error module=p2p peer="Peer{MConn{157.90.95.104:15608} fcbffe7d6209a25f2f9bbb5f63112594af4c46c2 out}" err=EOF
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.282] Stopping peer for error module=p2p peer="Peer{MConn{65.21.123.215:26101} 7faa28bcee5d37eebb255abca36f859f93495b23 out}" err=EOF
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.489] dialing failed (attempts: 1): dial tcp 44.207.124.58:26656: i/o timeout module=pex [email protected]:26656
Jan 20 19:01:39 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:01:39.489] dialing failed (attempts: 1): dial tcp 23.21.117.162:26656: i/o timeout module=pex [email protected]:26656
Jan 20 19:02:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:08.586] dialing failed (attempts: 1): dial tcp 54.203.39.40:26656: connect: connection refused module=pex [email protected]:26656
Jan 20 19:02:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:08.700] Stopping peer for error module=p2p peer="Peer{MConn{54.255.193.107:26656} 9d086e0c82815357a046bae1b458c804d4044137 out}" err=EOF
Jan 20 19:02:08 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:08.905] Stopping peer for error module=p2p peer="Peer{MConn{172.105.136.215:26656} ca5f860ef09f94a5dd525eb7b90e718af432f8e7 out}" err=EOF
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.018] Stopping peer for error module=p2p peer="Peer{MConn{142.4.219.184:26656} 71a6f7d0ab0c7a17f88d9ba197cd4da94c64c366 out}" err=EOF
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.022] dialing failed (attempts: 1): auth failure: conn.ID (b8a256f4db3ea2aa2b0c475600392a39c6d57309) dialed ID (c1ad4a3138c0e2f87c061dc93968c719731dd018) mismatch module=pex [email protected]:26656
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.031] Stopping peer for error module=p2p peer="Peer{MConn{185.8.106.244:26656} 64ba364912a0ed6fd2b8f80b6a242789a5a23e99 out}" err=EOF
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.242] Stopping peer for error module=p2p peer="Peer{MConn{51.79.17.235:26656} bc16f84c9278ff9003fb5ea13f75e755f971357d out}" err=EOF
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.488] dialing failed (attempts: 1): dial tcp 52.0.198.17:26656: i/o timeout module=pex [email protected]:26656
Jan 20 19:02:09 polygon-01 heimdalld[191353]: ERROR[2023-01-20|19:02:09.488] dialing failed (attempts: 1): dial tcp 154.53.52.176:26656: i/o timeout module=pex [email protected]:26656
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.404] Executed block module=state height=12374141 validTxs=0 invalidTxs=0
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.447] Committed state module=state height=12374141 txs=0 appHash=FF298CAD0931B3F885A6F649FE47CB38441EBBFC2ADDE8678FD69D50AFB5597C
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.467] Executed block module=state height=12374142 validTxs=0 invalidTxs=0
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.477] Committed state module=state height=12374142 txs=0 appHash=FF298CAD0931B3F885A6F649FE47CB38441EBBFC2ADDE8678FD69D50AFB5597C
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.496] Executed block module=state height=12374143 validTxs=0 invalidTxs=0
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.510] Committed state module=state height=12374143 txs=0 appHash=FF298CAD0931B3F885A6F649FE47CB38441EBBFC2ADDE8678FD69D50AFB5597C
Jan 20 19:02:18 polygon-01 heimdalld[191353]: INFO [2023-01-20|19:02:18.531] Executed block module=state height=12374144 validTxs=0 invalidTxs=0
...

bor服务日志

# journalctl -u bor.service -f

查看Heimdall区块同步状态

使用以下命令检查节点的同步状态:

# curl localhost:26657/status
{
"jsonrpc": "2.0",
"id": "",
"result": {
"node_info": {
"protocol_version": {
"p2p": "7",
"block": "10",
"app": "0"
},
"id": "61b569a6f9e7388f284a206e7697d2a61d45cce4",
"listen_addr": "tcp://0.0.0.0:26656",
"network": "heimdall-137",
"version": "0.32.7",
"channels": "4020212223303800",
"moniker": "polygon-01",
"other": {
"tx_index": "on",
"rpc_address": "tcp://127.0.0.1:26657"
}
},
"sync_info": {
"latest_block_hash": "698EBD73E8657C73536300A0AA9A4069BA26FD443A726CB7369EBA939D4B04C7",
"latest_app_hash": "4D5D958B2A24FC733ED21960BF78EC9A9B85C8D98EDFC8936C93FC2EE2CAC131",
"latest_block_height": "12374140",
"latest_block_time": "2023-01-10T08:47:45.884437096Z",
"catching_up": true
},
"validator_info": {
"address": "0BD932BBE0163C970E018CB96F84B084B01B404E",
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "BB8HJrdtg0bARcscXknkc9wBlCyMO3yo9U4D9iLvm/WDHDYCTpYjikJNm1gfYl/RaKOJzLP7mYeBpr0xE7T9BVo="
},
"voting_power": "0"
}
}
}

如果节点已完成同步,将看到响应:

"catching_up": false

参考文档

snapshot: https://snapshot.polygon.technology/

polygon:     https://wiki.polygon.technology/docs/develop/network-details/full-node-binaries

配置文档:  https://github.com/maticnetwork/bor/tree/develop/builder/files



标签:01,20,polygon,mainnet,19,0.3,2023,heimdalld
From: https://blog.51cto.com/wangguishe/6021914

相关文章

  • 部署prysm mainnet
    部署prysm下载prysmmkdir-pv/data/prysm&&cd/data/prysmcurlhttps://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh--outputprysm.sh&&chmod+......
  • polygon部署 mainnet 0.3.x
    环境要求内存:16-32GBCPU:4-8核CPU(t3xLarge)存储:至少650GBSSD(确保它是可扩展的)安装环境依赖安装编译环境~#sudoapt-getinstallbuild-essential-y安装go~#......
  • win10下python3.9的代理报错问题解决(附web3的polygon爬虫源码)
    背景因为工作中经常需要代理访问,而开了代理,request就会报错SSLError,如下:requests.exceptions.SSLError:HTTPSConnectionPool(host='test-admin.xxx.cn',port=443):Ma......
  • MySQL8.0.21升级8.0.31
    一、停止systemctlstopmysqld.service二、下载8.0.31版本rpm包cd/tmpwgethttps://cdn.mysql.com/archives/mysql-8.0/mysql-community-common-8.0.31-1.el8.x86_64......
  • 部署prysm mainnet
    部署prysm下载prysmmkdir-pv/data/prysm&&cd/data/prysmcurlhttps://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh--outputprysm.sh&&chm......
  • Microsoft 365 开发篇:New Microsoft Graph Developer Proxy preview v0.3
    Blog链接:https://blog.51cto.com/13969817使用MicrosoftGraphDeveloperProxy的最新预览版本构建弹性和高性能的应用程序。在这个新版本中,我将介绍对MicrosoftGraph和其......
  • mysql8.0.30主从配置
    安装包下载地址:https://downloads.mysql.com/archives/community/1、解压介质包:#tarxfmysql-8.0.30-linux-glibc2.12-x86_64.tar.xz#mvmysql-8.0.30-linux-glib......
  • 和菜鸟一起学android4.0.3源码之wifi direct的简单分析
    关于wifidirectWifidirect的连接 下面的图表示的是wifidirect的发现过程。 整个过程可以见下图。关于android上的wifidirect首先上层通过调用p2pmanager的接口来实现......
  • 和菜鸟一起学android4.0.3源码之wifi的简单分析
     关于wlan的组成 关于wifi应用层的接口的调用    首先从上层androidwifi的应用开始,首先会根据android的wifimanager的类,实例化一个mwifimanager的对象,这个对象处......
  • AIDA64 v5.00.3300
    AIDA64是一款测试软硬件系统信息的工具可以详细的显示出PC的每一个方面的信息下载:​​​http://download.aida64.com/aida64extreme500.zip​​​http://download.aida64.co......