Skip to content

Commit

Permalink
WIP: add Lodestar config to Interactive Guide gnosischain#241
Browse files Browse the repository at this point in the history
  • Loading branch information
zengzengzenghuy committed Jan 27, 2023
1 parent c8a5382 commit 8bb12f8
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 0 deletions.
237 changes: 237 additions & 0 deletions docs/node/guide/beacon/_partials/_install_cl_lodestar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


<Tabs className="tabgroup-with-label network-tabgroup" groupId="network" defaultValue="gnosis" values={[
{label: 'Gnosis', value: 'gnosis'},
{label: 'Chiado', value: 'chiado'}
]}>
<TabItem value="gnosis">

<Tabs className="tabgroup-with-label os-tabgroup" groupId="os" defaultValue="others" values={[
{label: 'Linux, MacOS, Arm64', value: 'others'},
{label: 'Windows', value: 'win'}
]}>
<TabItem value="others">

- Go to the [lodestar releases page](https://github.com/ChainSafe/lodestar/releases/tag/v1.2.2) and copy the url of the latest release, currently v1.2.2.

- Download the lodestar VERSION-ARQ.tar.gz binary.
```bash
wget [URL_FROM_PREVIOUS_STEP]
```

- Extract the downloaded file and move under consensus directory
```bash
tar -xvf VERSION-ARQ.tar.gz --directory consensus
```
Your repo will look like this
```
📂gnosis
├── 📂 jwtsecret/
├── 📂 execution/
└── 📂 consensus/
├── 📂 lodestar-${version}/
├── 📂 data/
├── 📂 keystores/
└── 📂 validators/
```
- Get into the lodestar folder
```bash
cd consensus/lodestar-${version} #cd consensus/lodestar-1.2.2
```
- Install and build across all packages
```bash
yarn install --ignore-optional
yarn run build
```

:::tip
Check that you are install correctly by running `./lodestar --help'
:::
- Execute Lodestar Beacon Chain
```bash
./lodestar \
--network=gnosis
--dataDir=/data
--preset=gnosis
--eth1=true
--execution.urls=http://execution:8551
--jwt-secret=/jwt.hex
--logFile=/data/logs/beacon.log
--logFileLevel=info
--port=9000
--rest=true
--rest.address=0.0.0.0
--rest.port=4000
--rest.cors=*
--discv5=true
--targetPeers=50
--metrics=true
--metrics.port=5054
--checkpointSyncUrl=https://checkpoint.gnosischain.com/
```
</TabItem>
<TabItem value="win">
Lodestar only runs on Linux. To run it on Windows, [Install Linux on Windows with WSL](https://learn.microsoft.com/en-us/windows/wsl/install), and follow the instructions on the WSL terminal.
- Go to the [lighhouse releases page](https://github.com/sigp/lighthouse/releases) and copy the url of the latest release based on your OS version.
- Download the lighthouse-VERSION-ARQ.tar.gz binary.
```bash
wget [URL_FROM_PREVIOUS_STEP]
```
- Extract the downloaded file
```bash
tar -xvf lighthouse-VERSION-ARQ.tar.gz --directory consensus
```
- Get into the folder
```bash
cd consensus
```
- Execute Lighthouse
```bash
./lighthouse \
--network gnosis beacon_node \
--datadir=data \
--http \
--execution-endpoint http://localhost:8551 \
--execution-jwt ../jwtsecret/jwt.hex \
--checkpoint-sync-url "https://checkpoint.gnosischain.com"
```
</TabItem>
</Tabs>
</TabItem>
<TabItem value="chiado">
<Tabs className="tabgroup-with-label os-tabgroup" groupId="os" defaultValue="others" values={[
{label: 'Linux, MacOS, Arm64', value: 'others'},
{label: 'Windows', value: 'win'}
]}>
<TabItem value="others">
- Go to the [lighhouse releases page](https://github.com/sigp/lighthouse/releases) and copy the url of the latest release based on your OS version.
- Download the lighthouse-VERSION-ARQ.tar.gz binary.
```bash
wget [URL_FROM_PREVIOUS_STEP]
```
- Extract the downloaded file
```bash
tar -xvf lighthouse-VERSION-ARQ.tar.gz --directory consensus
```
- Get into the folder
```bash
cd consensus
```
- Create a new folder `network_config` and download Chiado config files:
```bash
mkdir network_config &&
cd network_config &&
wget https://github.com/gnosischain/configs/raw/main/chiado/config.yaml &&
wget https://github.com/gnosischain/configs/raw/main/chiado/genesis.ssz &&
wget https://github.com/gnosischain/configs/raw/main/chiado/deploy_block.txt
```
- Execute Lighthouse, replace `[BOOTNODES]` with a comma-separated bootnodes from [this file](https://github.com/gnosischain/configs/blob/main/chiado/bootnodes.yaml); and `[YOUR_ADDRESS]` with your fee recipient address.
```bash
./lighthouse \
--testnet-dir=./network_config bn \
--datadir=data \
--disable-upnp \
--port=9000 \
--http \
--http-address=0.0.0.0 \
--http-port=4000 \
--target-peers=50 \
--boot-nodes=enr:[BOOTNODES] \
--execution-endpoints=http://localhost:8551 \
--execution-jwt=../jwtsecret/jwt.hex \
--eth1-endpoints=http://localhost:8545 \
--debug-level=info \
--suggested-fee-recipient=[YOUR_ADDRESS] \
--validator-monitor-auto \
--subscribe-all-subnets \
--import-all-attestations \
--metrics \
--metrics-port=5054 \
--metrics-address=0.0.0.0 \
--checkpoint-sync-url https://checkpoint.chiadochain.net
```
</TabItem>
<TabItem value="win">
Lighthouse only runs on Linux. To run it on Windows, [Install Linux on Windows with WSL](https://learn.microsoft.com/en-us/windows/wsl/install), and follow the instructions on the WSL terminal.
- Go to the [lighhouse releases page](https://github.com/sigp/lighthouse/releases) and copy the url of the latest release based on your OS version.
- Download the lighthouse-VERSION-ARQ.tar.gz binary.
```bash
wget [URL_FROM_PREVIOUS_STEP]
```
- Extract the downloaded file
```bash
tar -xvf lighthouse-VERSION-ARQ.tar.gz --directory consensus
```
- Get into the folder
```bash
cd consensus
```
- Create a new folder `network_config` and download Chiado config files:
```bash
mkdir network_config &&
cd network_config &&
wget https://github.com/gnosischain/configs/raw/main/chiado/config.yaml &&
wget https://github.com/gnosischain/configs/raw/main/chiado/genesis.ssz &&
wget https://github.com/gnosischain/configs/raw/main/chiado/deploy_block.txt
```
- Execute Lighthouse, replace `[BOOTNODES]` with a comma-separated bootnodes from [this file](https://github.com/gnosischain/configs/blob/main/chiado/bootnodes.yaml); and `[YOUR_ADDRESS]` with your fee recipient address.
```bash
./lighthouse \
--testnet-dir=./network_config bn \
--datadir=data \
--disable-upnp \
--port=9000 \
--http \
--http-address=0.0.0.0 \
--http-port=4000 \
--target-peers=50 \
--boot-nodes=enr:[BOOTNODES] \
--execution-endpoints=http://localhost:8551 \
--execution-jwt=../jwtsecret/jwt.hex \
--eth1-endpoints=http://localhost:8545 \
--debug-level=info \
--suggested-fee-recipient=[YOUR_ADDRESS] \
--validator-monitor-auto \
--subscribe-all-subnets \
--import-all-attestations \
--metrics \
--metrics-port=5054 \
--metrics-address=0.0.0.0 \
--checkpoint-sync-url https://checkpoint.chiadochain.net
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
3 changes: 3 additions & 0 deletions docs/node/guide/beacon/_partials/_run-consensus-client.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import InstallLighthousePartial from '@site/docs/node/guide/beacon/_partials/_install_cl_lighthouse.md';
import InstallLodestarPartial from '@site/docs/node/guide/beacon/_partials/_install_cl_lodestar.md';

```mdx-code-block
Expand All @@ -27,6 +28,8 @@ Please refer to [Run a Beacon Node: Lodestar](../lodestar.md)

:::

<InstallLodestarPartial/>

```mdx-code-block
</TabItem>
Expand Down
8 changes: 8 additions & 0 deletions docs/node/guide/validator/_partials/_install-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ import TabItem from '@theme/TabItem';
import InstallLighthouseValidatorPartial from '@site/docs/node/guide/validator/_partials/clients/_install_validator_lighthouse.md';
<InstallLighthouseValidatorPartial />
</TabItem>
<TabItem value="lodestar">
```

import InstallLodestarValidatorPartial from '@site/docs/node/guide/validator/_partials/clients/_install_validator_lodestar.md';


:::info


Please refer to [Run a Beacon Node: Lodestar](../../beacon/lodestar.md)


:::

<InstallLodestarValidatorPartial />

```mdx-code-block
</TabItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


<Tabs className="tabgroup-with-label os-tabgroup" groupId="os" defaultValue="others" values={[
{label: 'Linux, MacOS, Arm64', value: 'others'},
{label: 'Windows', value: 'win'}
]}>
<TabItem value="win">

:::info
Lighthouse only runs on Linux. To run it on Windows, [Install Linux on Windows with WSL](https://learn.microsoft.com/en-us/windows/wsl/install), and follow the instructions on the WSL terminal.
:::

</TabItem>
</Tabs>

<Tabs className="tabgroup-with-label network-tabgroup" groupId="network" defaultValue="gnosis" values={[
{label: 'Gnosis', value: 'gnosis'},
{label: 'Chiado', value: 'chiado'}
]}>
<TabItem value="gnosis">

To run a validator, we need to first import the keys generated in the previous step.

* In a new command line window, navigate to the `consensus` folder and execute Lighthouse validator client
* To ease the import process, we will create a `password.txt` file containing the password used to encrypt the validator keys.

```shell
echo 'PLACE_HERE_YOUR_PASSWORD' > keystores/password.txt
```

* Import the validator keys using lighthouse:

```shell
./lighthouse account_manager validator import \
--network gnosis \
--password-file keystores/password.txt \
--reuse-password \
--directory keystores \
--datadir validators
```

* Start your lighhouse validator:

```shell
./lighthouse validator_client \
--network gnosis \
--datadir validators \
--enable-doppelganger-protection \
# highlight-start
--suggested-fee-recipient="0x0" \ # Change this value
# highlight-end
--metrics \
--metrics-address=0.0.0.0 \
--metrics-port=5064 \
# highlight-start
--graffiti "gnosis-docs-graffiti" # Change this value
# highlight-end
```

Replace `gnosis-docs-graffiti` with your [graffiti](https://lighthouse-book.sigmaprime.io/graffiti.html). Make sure to delete `# Change this value` before running this command. Learn more about the [`enable-doppelganger-protection`](https://lighthouse-book.sigmaprime.io/validator-doppelganger.html) flag in Lighthouse docs.



</TabItem>
<TabItem value="chiado">
<div data-comment="TODO: document chiado validation process"></div>
</TabItem>
</Tabs>

0 comments on commit 8bb12f8

Please sign in to comment.