Skip to content

Commit b2b7e77

Browse files
committed
update adding missing PoS docs
1 parent 6c61b44 commit b2b7e77

34 files changed

+4746
-2
lines changed

docs/img/pos/heimdall-tree.png

23.8 KB
Loading

docs/img/pos/heimdall-version.png

42.7 KB
Loading

docs/img/pos/hello-world.png

70.3 KB
Loading

docs/img/pos/space.png

24.3 KB
Loading

docs/img/pos/term-access.png

44.7 KB
Loading

docs/pos/how-to/snapshots.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
When setting up a new sentry, validator, or full node server, it is recommended that you use snapshots for faster syncing without having to sync over the network. Using snapshots will save you several days for both Heimdall and Bor.
22

3-
For the latest snapshot, please visit [Polygon Chains Snapshots](https://snapshot.polygon.technology/).
3+
For the latest snapshot, please visit [Polygon Chains Snapshots](https://snapshots.polygon.technology/).
44

55
!!! warning "Bor snapshots no longer supported"
66
We no longer support bor archive snapshots due to unsustainable data growth.

docs/pos/operate-node/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Guide to operating a full node.
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
2+
An [Ansible playbook](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) is used to
3+
configure and manage a full node.
4+
5+
## Prerequisites
6+
7+
- Install Ansible on your local machine with Python3.x. The setup will not work if you have Python2.x.
8+
- To install Ansible with Python 3.x, you can use pip. If you do not have pip on your machine,
9+
follow the steps outlined [here](https://pip.pypa.io/en/stable/). Run `pip3 install ansible` to install
10+
Ansible.
11+
- Check the [Polygon PoS Ansible repository](https://github.com/maticnetwork/node-ansible#requirements) for
12+
requirements.
13+
- You will also need to ensure that Go is **not installed** in your environment. You will run into issues if you attempt to set up your full node through Ansible with Go installed as Ansible requires specific packages of Go to be installed.
14+
- You will also need to make sure that your VM / Machine does not have any previous setups for Polygon Validator or Heimdall or Bor. You will need to delete them as your setup will run into issues.
15+
16+
!!!info
17+
Heimdall source enhancements
18+
19+
The latest Heimdall version, **[v1.0.3](https://github.com/maticnetwork/heimdall/releases/tag/v1.0.3)**, contains a few enhancements.
20+
The delay time between the contract events of different validators **has been increased** to ensure that the mempool doesn't get filled quickly in case of a burst of events that could hamper the chain's progress.
21+
22+
Additionally, the data size **has been restricted in state sync txs to 30Kb (when represented in bytes) and 60Kb (when defined as string)**.
23+
24+
For example:
25+
26+
```bash
27+
Data - "abcd1234"
28+
Length in string format - 8
29+
Hex Byte representation - [171 205 18 52]
30+
Length in byte format - 4
31+
```
32+
33+
34+
## Full node setup
35+
36+
- Ensure you have access to the remote machine or VM on which the full node is being set up.
37+
> Refer to [https://github.com/maticnetwork/node-ansible#setup](https://github.com/maticnetwork/node-ansible#setup) for more details.
38+
- Clone the [https://github.com/maticnetwork/node-ansible](https://github.com/maticnetwork/node-ansible) repository.
39+
- Navigate into the node-ansible folder: `cd node-ansible`
40+
- Edit the `inventory.yml` file and insert your IP(s) in the `sentry->hosts` section.
41+
> Refer to [https://github.com/maticnetwork/node-ansible#inventory](https://github.com/maticnetwork/node-ansible#inventory) for more details.
42+
- Check if the remote machine is reachable by running: `ansible sentry -m ping`
43+
- To test if the correct machine is configured, run the following command:
44+
45+
```bash
46+
# Mainnet:
47+
ansible-playbook playbooks/network.yml --extra-var="bor_version=v1.0.0 heimdall_version=v1.0.3 network=mainnet node_type=sentry" --list-hosts
48+
49+
# Testnet:
50+
ansible-playbook playbooks/network.yml --extra-var="bor_version=v1.1.0 heimdall_version=v1.0.3 network=mumbai node_type=sentry" --list-hosts
51+
```
52+
53+
<img src={useBaseUrl("img/network/full-node-mumbai.png")} />
54+
55+
- Next, set up the full node with this command:
56+
57+
```bash
58+
# Mainnet:
59+
ansible-playbook playbooks/network.yml --extra-var="bor_version=v1.1.0 heimdall_version=v1.0.3 network=mainnet node_type=sentry"
60+
61+
# Testnet:
62+
ansible-playbook playbooks/network.yml --extra-var="bor_version=v1.0.0 heimdall_version=v1.0.3 network=mumbai node_type=sentry"
63+
```
64+
65+
- In case you run into any issues, delete and clean the whole setup using:
66+
```
67+
ansible-playbook playbooks/clean.yml
68+
```
69+
70+
- Once you initiate the Ansible playbook, log in to the remote machine.
71+
72+
- Please **ensure that the value of seeds and bootnodes mentioned below is the same value as mentioned in Heimdall and Bor `config.toml` files**. If not, change the values accordingly.
73+
74+
- Heimdall seed nodes:
75+
76+
```bash
77+
moniker=<enter unique identifier>
78+
79+
# Mainnet:
80+
seeds="1500161dd491b67fb1ac81868952be49e2509c9f@52.78.36.216:26656,dd4a3f1750af5765266231b9d8ac764599921736@3.36.224.80:26656,8ea4f592ad6cc38d7532aff418d1fb97052463af@34.240.245.39:26656,e772e1fb8c3492a9570a377a5eafdb1dc53cd778@54.194.245.5:26656,6726b826df45ac8e9afb4bdb2469c7771bd797f1@52.209.21.164:26656"
81+
82+
# Testnet:
83+
seeds="9df7ae4bf9b996c0e3436ed4cd3050dbc5742a28@43.200.206.40:26656,d9275750bc877b0276c374307f0fd7eae1d71e35@54.216.248.9:26656,1a3258eb2b69b235d4749cf9266a94567d6c0199@52.214.83.78:26656"
84+
```
85+
- Bootnodes:
86+
87+
```bash
88+
# Mainnet:
89+
bootnode ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
90+
91+
# Testnet:
92+
bootnodes ["enode://bdcd4786a616a853b8a041f53496d853c68d99d54ff305615cd91c03cd56895e0a7f6e9f35dbf89131044e2114a9a782b792b5661e3aff07faf125a98606a071@43.200.206.40:30303", "enode://209aaf7ed549cf4a5700fd833da25413f80a1248bd3aa7fe2a87203e3f7b236dd729579e5c8df61c97bf508281bae4969d6de76a7393bcbd04a0af70270333b3@54.216.248.9:30303"]
93+
```
94+
95+
- To check if Heimdall is synced
96+
- On the remote machine/VM, run `curl localhost:26657/status`
97+
- In the output, `catching_up` value should be `false`
98+
99+
- Once Heimdall is synced, run
100+
- `sudo service bor start`
101+
102+
You have successfully set up a full node with Ansible.
103+
104+
!!!note
105+
106+
If Bor presents an error of permission to data, run this command to make the Bor user the owner of the Bor files:
107+
108+
```bash
109+
sudo chown bor /var/lib/bor
110+
```
111+
112+
## Logs
113+
114+
Logs can be managed by the `journalctl` linux tool. Here is a tutorial for advanced usage: [How To Use Journalctl to View and Manipulate Systemd Logs](https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs).
115+
116+
**Check Heimdall node logs**
117+
118+
```bash
119+
journalctl -u heimdalld.service -f
120+
```
121+
122+
**Check Bor Rest-server logs**
123+
124+
```bash
125+
journalctl -u bor.service -f
126+
```
127+
128+
## Ports and Firewall Setup
129+
130+
Open ports 22, 26656 and 30303 to world (0.0.0.0/0) on sentry node firewall.
131+
132+
You can use VPN to restrict access for port 22 as per your requirement and security guidelines.
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
2+
This deployment guide walks you through starting and running a full node through various methods. For the system requirements, see the [Minimum Technical Requirements](../validator/validator-node-system-requirements.md) guide.
3+
4+
!!!tip Snapshots
5+
6+
Steps in these guide involve waiting for the Heimdall and Bor services to fully sync. This process takes several days to complete.
7+
8+
Please use snapshots for faster syncing without having to sync over the network. For detailed instructions, see [<ins>Snapshot Instructions for Heimdall and Bor</ins>](../../how-to/snapshots.md).
9+
10+
For snapshot download links, see the [<ins>Polygon Chains Snapshots</ins>](https://snapshots.polygon.technology/) page.
11+
12+
13+
## Overview
14+
15+
- Prepare the machine
16+
- Install Heimdall and Bor binaries on the full node machine
17+
- Set up Heimdall and Bor services on the full node machine
18+
- Configure the full node machine
19+
- Start the full node machine
20+
- Check node health with the community
21+
22+
!!!note
23+
24+
You have to follow the exact outlined sequence of actions, otherwise you will run into issues.
25+
26+
27+
### Install `build-essential`
28+
29+
This is **required** for your full node. In order to install, run the below command:
30+
31+
```bash
32+
sudo apt-get update
33+
sudo apt-get install build-essential
34+
```
35+
36+
## Install Binaries
37+
38+
Polygon node consists of 2 layers: Heimdall and Bor. Heimdall is a tendermint fork that monitors contracts in parallel with the Ethereum network. Bor is basically a Geth fork that generates blocks shuffled by Heimdall nodes.
39+
40+
Both binaries must be installed and run in the correct order to function properly.
41+
42+
### Heimdall
43+
44+
Install the latest version of Heimdall and related services. Make sure you checkout to the correct [release version](https://github.com/maticnetwork/heimdall/releases). Note that the latest version, [Heimdall v1.0.3](https://github.com/maticnetwork/heimdall/releases/tag/v1.0.3), contains enhancements such as:
45+
1. Restricting data size in state sync txs to:
46+
* **30Kb** when represented in **bytes**
47+
* **60Kb** when represented as **string**
48+
2. Increasing the **delay time** between the contract events of different validators to ensure that the mempool doesn't get filled very quickly in case of a burst of events which can hamper the progress of the chain.
49+
50+
The following example shows how the data size is restricted:
51+
52+
```
53+
Data - "abcd1234"
54+
Length in string format - 8
55+
Hex Byte representation - [171 205 18 52]
56+
Length in byte format - 4
57+
```
58+
59+
To install **Heimdall**, run the below commands:
60+
61+
```bash
62+
curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | bash -s -- <heimdall_version> <network_type> <node_type>
63+
```
64+
65+
**heimdall_version**: `valid v1.0+ release tag from https://github.com/maticnetwork/heimdall/releases`
66+
**network_type**: `mainnet` and `mumbai`
67+
**node_type**: `sentry`
68+
69+
That will install the `heimdalld` and `heimdallcli` binaries. Verify the installation by checking the Heimdall version on your machine:
70+
71+
```bash
72+
heimdalld version --long
73+
```
74+
75+
### Configure heimdall seeds (Mainnet)
76+
77+
```bash
78+
sed -i 's|^seeds =.*|seeds = "1500161dd491b67fb1ac81868952be49e2509c9f@52.78.36.216:26656,dd4a3f1750af5765266231b9d8ac764599921736@3.36.224.80:26656,8ea4f592ad6cc38d7532aff418d1fb97052463af@34.240.245.39:26656,e772e1fb8c3492a9570a377a5eafdb1dc53cd778@54.194.245.5:26656,6726b826df45ac8e9afb4bdb2469c7771bd797f1@52.209.21.164:26656"|g' /var/lib/heimdall/config/config.toml
79+
chown heimdall /var/lib/heimdall
80+
```
81+
82+
### Configure heimdall seeds (Mumbai)
83+
84+
```bash
85+
sed -i 's|^seeds =.*|seeds = "9df7ae4bf9b996c0e3436ed4cd3050dbc5742a28@43.200.206.40:26656,d9275750bc877b0276c374307f0fd7eae1d71e35@54.216.248.9:26656,1a3258eb2b69b235d4749cf9266a94567d6c0199@52.214.83.78:26656"|g' /var/lib/heimdall/config/config.toml
86+
chown heimdall /var/lib/heimdall
87+
```
88+
89+
### Bor install
90+
91+
Install the latest version of Bor, based on valid v1.0+ [released version](https://github.com/maticnetwork/bor/releases).
92+
93+
```bash
94+
curl -L https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s -- <bor_version> <network_type> <node_type>
95+
```
96+
97+
**bor_version**: `valid v1.0+ release tag from https://github.com/maticnetwork/bor/releases`
98+
**network_type**: `mainnet` and `mumbai`
99+
**node_type**: `sentry`
100+
101+
That will install the `bor` binary. Verify the installation by checking the Bor version on your machine:
102+
103+
```bash
104+
bor version
105+
```
106+
107+
### Configure bor seeds (mainnet)
108+
109+
```bash
110+
sed -i 's|.*\[p2p.discovery\]| \[p2p.discovery\] |g' /var/lib/bor/config.toml
111+
sed -i 's|.*bootnodes =.*| bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]|g' /var/lib/bor/config.toml
112+
chown bor /var/lib/bor
113+
```
114+
115+
### Configure bor seeds (mumbai)
116+
117+
```bash
118+
sed -i 's|.*\[p2p.discovery\]| \[p2p.discovery\] |g' /var/lib/bor/config.toml
119+
sed -i 's|.*bootnodes =.*| bootnodes = ["enode://bdcd4786a616a853b8a041f53496d853c68d99d54ff305615cd91c03cd56895e0a7f6e9f35dbf89131044e2114a9a782b792b5661e3aff07faf125a98606a071@43.200.206.40:30303", "enode://209aaf7ed549cf4a5700fd833da25413f80a1248bd3aa7fe2a87203e3f7b236dd729579e5c8df61c97bf508281bae4969d6de76a7393bcbd04a0af70270333b3@54.216.248.9:30303"]|g' /var/lib/bor/config.toml
120+
chown bor /var/lib/bor
121+
```
122+
123+
### Update service config user permission
124+
125+
```bash
126+
sed -i 's/User=heimdall/User=root/g' /lib/systemd/system/heimdalld.service
127+
sed -i 's/User=bor/User=root/g' /lib/systemd/system/bor.service
128+
```
129+
130+
## Start Services
131+
132+
Run the full Heimdall node with these commands on your Sentry Node:
133+
134+
```bash
135+
sudo service heimdalld start
136+
```
137+
138+
Now, you need to make sure that **Heimdall is synced** completely, and then only start Bor. If you start Bor without Heimdall syncing completely, you will run into issues frequently.
139+
140+
**To check if Heimdall is synced**
141+
1. On the remote machine/VM, run `curl localhost:26657/status`
142+
2. In the output, `catching_up` value should be `false`
143+
144+
Once Heimdall is synced, run the below command:
145+
146+
```bash
147+
sudo service bor start
148+
```
149+
150+
## Logs
151+
152+
Logs can be managed by the `journalctl` linux tool. Here is a tutorial for advanced usage: [How To Use Journalctl to View and Manipulate Systemd Logs](https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs).
153+
154+
**Check Heimdall node logs**
155+
156+
```bash
157+
journalctl -u heimdalld.service -f
158+
```
159+
160+
**Check Heimdall Rest-server logs**
161+
162+
```bash
163+
journalctl -u heimdalld-rest-server.service -f
164+
```
165+
166+
**Check Bor Rest-server logs**
167+
168+
```bash
169+
journalctl -u bor.service -f
170+
```
171+
172+
## Ports and Firewall Setup
173+
174+
Open ports 22, 26656 and 30303 to world (0.0.0.0/0) on sentry node firewall.
175+
176+
You can use VPN to restrict access for port 22 as per your requirement and security guidelines.

0 commit comments

Comments
 (0)