Skip to content

Commit 09cc907

Browse files
katembfoustgitbook-bot
authored andcommitted
GITBOOK-150: No subject
1 parent f89bf43 commit 09cc907

File tree

4 files changed

+271
-0
lines changed

4 files changed

+271
-0
lines changed

SUMMARY.md

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
* [🐳 Docker](archive-nodes-101/starknet/firehose/docker.md)
8282
* [✖️ X Layer](archive-nodes-101/x-layer/README.md)
8383
* [🐳 Docker](archive-nodes-101/x-layer/docker.md)
84+
* [💻 Baremetal](archive-nodes-101/x-layer/baremetal/README.md)
85+
* [🦥 Erigon](archive-nodes-101/x-layer/baremetal/erigon.md)
86+
* [👽 ZK-Node](archive-nodes-101/x-layer/baremetal/zk-node.md)
8487
* [⚡ Zora](archive-nodes-101/zora/README.md)
8588
* [🐳 Docker](archive-nodes-101/zora/docker.md)
8689
* [💻 Baremetal](archive-nodes-101/zora/baremetal.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 💻 Baremetal
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# 🦥 Erigon
2+
3+
Authors: \[man4ela | catapulta.eth]
4+
5+
### System Requirements <a href="#system-requirements" id="system-requirements"></a>
6+
7+
| CPU | OS | RAM | DISK |
8+
| ------------ | ---------------------- | ------------ | ------------------- |
9+
| 8+ cores CPU | Debian 12/Ubuntu 22.04 | => 16 GB RAM | 500GB (SSD or NVMe) |
10+
11+
{% hint style="info" %}
12+
_The Erigon XLayer archive node has a size of 36GB on August 9th, 2024_
13+
{% endhint %}
14+
15+
### Setup production Erigon <a href="#setup-production-erigon" id="setup-production-erigon"></a>
16+
17+
{% hint style="success" %}
18+
This guide covers the installation of `CDK-Erigon`, a fork of Erigon, optimized for syncing with the XLayer network.
19+
{% endhint %}
20+
21+
{% hint style="danger" %}
22+
With their [Eggfruit upgrade](https://polygon.technology/blog/eggfruit-upgrade-incoming-polygon-zkevm-mainnet-beta-will-see-the-cdk-erigon-sequencer-go-live) in September 2024, the Polygon team made the official recommendation that all infra providers will need to begin running the cdk-erigon RPC Node. While zkEVm Node is still operational, it is no longer being maintained by the Polygon team.\
23+
\
24+
Additionally, we found slight POI divergence in our integration testing. Please use the test below as an initial screening when working with this chain.
25+
{% endhint %}
26+
27+
<details>
28+
29+
<summary>Initial Test for Proof of Indexing</summary>
30+
31+
Due to POI divergences found with X Layer, we created an initial test below for indexers that _may_ indicate that their setup allows them to sync other subgraphs and be in majority consensus.
32+
33+
* Sync the following subgraph: `QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS`
34+
* Query to grab the POI
35+
36+
`{ "query": "{ proofOfIndexing(subgraph: "QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS", blockNumber: 3041190, blockHash: "0xa819924ad94bcf3295826d5ad916c9ef06fac8cb46a6273d3bcc7aec822e22e7", indexer: "0x0000000000000000000000000000000000000000") }" }`
37+
38+
If there is a match for the Consensus POI provided below, it may indicate that their setup allows them to sync other subgraphs and be in the majority consensus. If they get a match for the Divergent POI, this can be an indication of a data determinism issue.
39+
40+
**Consensus** `0xa1223b5cbabf16d9896c2bd19099d08e5ce45c7ff308674b3ea7ada5367334bf`
41+
42+
**Divergent** `0x411bf0293e96a1459167ef1828aa7d70cd6c2e1f8c4210e0edf0fa8827eeed69`
43+
44+
* Shell into your index node and run this curl command
45+
46+
`curl -s -X POST -H "Content-Type: application/json"`\
47+
`--data '{"query": "{ proofOfIndexing(subgraph: "QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS", blockNumber: 3041190, blockHash: "0xa819924ad94bcf3295826d5ad916c9ef06fac8cb46a6273d3bcc7aec822e22e7", indexer: "0x0000000000000000000000000000000000000000") }"}'`\
48+
`"http://localhost:8030/graphql"`
49+
50+
</details>
51+
52+
## Pre-Requisites
53+
54+
{% code overflow="wrap" %}
55+
```bash
56+
sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y
57+
58+
sudo apt install -y libgtest-dev libomp-dev libgmp-dev git make wget aria2 gcc pkg-config libusb-1.0-0-dev libudev-dev jq g++ curl libssl-dev screen apache2-utils build-essential
59+
```
60+
{% endcode %}
61+
62+
### Setting up Firewall
63+
64+
Set explicit default UFW rules
65+
66+
```bash
67+
sudo ufw default deny incoming
68+
sudo ufw default allow outgoing
69+
```
70+
71+
Allow SSH
72+
73+
```bash
74+
sudo ufw allow 22/tcp
75+
```
76+
77+
Allow remote RPC connections with Blast Node
78+
79+
```bash
80+
sudo ufw allow from ${REMOTE.HOST.IP} to any port 8545
81+
```
82+
83+
{% hint style="warning" %}
84+
Not advised to allow all or unknown IP address to RPC port
85+
{% endhint %}
86+
87+
Enable Firewall
88+
89+
<pre class="language-bash"><code class="lang-bash"><strong>sudo ufw enable
90+
</strong></code></pre>
91+
92+
To check the status of UFW and see the current rules
93+
94+
<pre class="language-bash"><code class="lang-bash"><strong>sudo ufw status verbose
95+
</strong></code></pre>
96+
97+
### Install GO
98+
99+
{% hint style="info" %}
100+
Go version 1.20.7 is required to build cdk-rigon
101+
{% endhint %}
102+
103+
```bash
104+
sudo wget https://go.dev/dl/go1.20.7.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.7.linux-amd64.tar.gz && rm go1.20.7.linux-amd64.tar.gz
105+
106+
echo 'export PATH=$PATH:/usr/local/go/bin:/root/.local/bin' >> /root/.bashrc
107+
108+
source /root/.bashrc
109+
110+
#verify Go installation
111+
go version
112+
```
113+
114+
### Build Erigon RPC Node
115+
116+
{% hint style="warning" %}
117+
Before you start, make sure that you have your own synced Ethereum L1 RPC URL ready.
118+
{% endhint %}
119+
120+
#### Clone the Erigon repository and build cdk-erigon. Check the latest version at [releases](https://github.com/0xPolygonHermez/cdk-erigon/releases) page.
121+
122+
```bash
123+
git clone https://github.com/0xPolygonHermez/cdk-erigon.git
124+
125+
cd cdk-erigon
126+
127+
git checkout v1.2.24 #[checkout the latest release version]
128+
129+
make cdk-erigon
130+
```
131+
132+
#### Configure xLayer Mainnet Parameters
133+
134+
```bash
135+
mkdir /root/data/erigon-data/xlayer-mainnet
136+
137+
mkdir /root/xlayer
138+
139+
cd /root/xlayer
140+
141+
sudo nano xlayerconfig-mainnet.yaml
142+
```
143+
144+
#### Paste and modify parameters. Save by entering `ctrl+X` and `Y+ENTER`
145+
146+
```bash
147+
datadir: /root/data/erigon-data/xlayer-mainnet
148+
chain: xlayer-mainnet
149+
http: true
150+
private.api.addr: localhost:9091
151+
zkevm.l2-chain-id: 196
152+
zkevm.l2-sequencer-rpc-url: https://rpc.xlayer.tech
153+
zkevm.l2-datastreamer-url: stream.xlayer.tech:8800
154+
zkevm.l1-chain-id: 1
155+
zkevm.l1-rpc-url: {L1 RPC URL}
156+
157+
zkevm.address-sequencer: "0xAF9d27ffe4d51eD54AC8eEc78f2785D7E11E5ab1"
158+
zkevm.address-zkevm: "0x2B0ee28D4D51bC9aDde5E58E295873F61F4a0507"
159+
zkevm.address-admin: "0x491619874b866c3cDB7C8553877da223525ead01"
160+
zkevm.address-rollup: "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2"
161+
zkevm.address-ger-manager: "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"
162+
163+
zkevm.l1-rollup-id: 3
164+
zkevm.l1-first-block: 19218658
165+
zkevm.l1-block-range: 2000
166+
zkevm.l1-query-delay: 1000
167+
zkevm.rpc-ratelimit: 250
168+
zkevm.datastream-version: 3
169+
170+
externalcl: true
171+
http.api: [eth, debug, net, trace, web3, erigon, zkevm]
172+
http.addr: 0.0.0.0
173+
http.port: 8545
174+
```
175+
176+
{% hint style="info" %}
177+
```bash
178+
Replace {L1 RPC URL} with your synced endpoint
179+
```
180+
{% endhint %}
181+
182+
### **Launch Erigon Node**
183+
184+
#### Create systemd service for `cdk-erigon`
185+
186+
```bash
187+
sudo nano /etc/systemd/system/cdk-erigon.service
188+
```
189+
190+
Paste the configs and save by entering `ctrl+X` and `Y+ENTER`:
191+
192+
```bash
193+
[Unit]
194+
Description=cdk-erigon Service
195+
After=network.target
196+
StartLimitIntervalSec=200
197+
StartLimitBurst=5
198+
199+
[Service]
200+
Type=simple
201+
Restart=on-failure
202+
RestartSec=5
203+
TimeoutSec=900
204+
User=root
205+
Nice=0
206+
LimitNOFILE=200000
207+
WorkingDirectory=/root/cdk-erigon/build/bin/
208+
ExecStart=/root/cdk-erigon/build/bin/cdk-erigon --config="/root/xlayer/xlayerconfig-mainnet.yaml"
209+
KillSignal=SIGTERM
210+
211+
[Install]
212+
WantedBy=multi-user.target
213+
```
214+
215+
#### Start cdk-erigon
216+
217+
<pre class="language-bash"><code class="lang-bash">sudo systemctl daemon-reload #refresh systemd configuration when changes made
218+
219+
sudo systemctl enable cdk-erigon.service #enable cdk-erigon service at system startup
220+
221+
sudo systemctl start cdk-erigon.service #start cdk-erigon
222+
<strong>
223+
</strong>sudo nano /etc/systemd/system/cdk-erigon.service #make changes in cdk-erigon.service file
224+
</code></pre>
225+
226+
### Run _`curl`_ command in the terminal to check the status of your node
227+
228+
<pre class="language-bash"><code class="lang-bash"><strong>curl -H "Content-type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545
229+
</strong></code></pre>
230+
231+
When it returns `false` then your node is fully synchronized with the network
232+
233+
### Monitor the logs for errors
234+
235+
```bash
236+
sudo journalctl -fu cdk-erigon.service #follow logs of cdk-erigon.service
237+
```
238+
239+
During the synchonization, you are expected to get following log messages from `cdk-erigon`:
240+
241+
<pre class="language-bash"><code class="lang-bash">[INFO] [08-04|10:39:44.828] [1/16 L1Syncer] Starting L1 sync stage
242+
[INFO] [08-04|10:39:44.829] Starting L1 syncer thread
243+
[INFO] [08-04|10:39:54.914] [1/16 L1Syncer] L1 Blocks processed progress (amounts): 254000/1235309 (20%)
244+
[INFO] [08-04|10:40:04.915] [1/16 L1Syncer] L1 Blocks processed progress (amounts): 430000/1235309 (34%)
245+
....
246+
[INFO] [08-04|14:32:56.247] [13/16 LogIndex] Started
247+
<strong>[INFO] [08-04|14:32:56.248] [13/16 LogIndex] processing from=499948 to=3642707
248+
</strong>[INFO] [08-04|14:33:37.995] [13/16 LogIndex] Finished
249+
[INFO] [08-04|14:33:45.451] [p2p] GoodPeers
250+
[INFO] [08-04|14:33:45.700] [txpool] stat pending=0 baseFee=0 queued=0 alloc=353.1MB sys=6.2GB
251+
[INFO] [08-04|14:33:59.786] [14/16 TxLookup] Flushed buffer file name=/root/data/erigon-data/xlayer-mainnet/temp/erigon-sortable-buf-1679142578
252+
[INFO] [08-04|14:34:02.324] [14/16 TxLookup] Flushed buffer file name=/root/data/erigon-data/xlayer-mainnet/temp/erigon-sortable-buf-2496799223
253+
[INFO] [08-04|14:34:03.661] [15/16 DataStream] Starting...
254+
[INFO] [08-04|14:34:03.662] [15/16 DataStream] no streamer provided, skipping stage
255+
[INFO] [08-04|14:34:03.662] [16/16 Finish] Started
256+
[INFO] [08-04|14:34:03.662] [16/16 Finish] Finished
257+
</code></pre>
258+
259+
#### References <a href="#references" id="references"></a>
260+
261+
{% embed url="https://github.com/okx/Deploy/blob/main/mainnet/setup-erigon-rpc.md" %}
262+
263+
{% embed url="https://www.okx.com/ru/xlayer/docs/developer/build-on-xlayer/quickstart" %}
264+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 👽 ZK-Node
2+

0 commit comments

Comments
 (0)