Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protomainnet documentation #62

Merged
merged 6 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions zq2/docs/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords:
description: Endpoints, Block Explorer & Faucet
---

# Endpoints, Block Explorer & Faucet
# [Endpoints, Block Explorer & Faucet](#endpoints-block-explorer-faucet)

As we introduce additional test networks for Zilliqa 2.0, their public RPC node URLs and chain IDs will be published on [ChainList](https://chainlist.org/?search=zilliqa&testnets=true) alongside existing chain information for Zilliqa 1.0.
<br>
Expand All @@ -25,27 +25,28 @@ Add Zilliqa 2 EVM proto-mainnet
</span>
<br>
<br>
## Networks
## [Networks](#networks)

Details for the current network versions of Zilliqa 2.0 are listed below.

<div class="table" markdown>
| Name | Version | ChainId | API | Otterscan | Faucet |
| ------ | ------- | ------- | --- | --------- | ------ |
| proto-testnet | v0.1.0 | 33103 | https://api.zq2-prototestnet.zilliqa.com | https://explorer.zq2-prototestnet.zilliqa.com | https://faucet.zq2-prototestnet.zilliqa.com |
| proto-mainnet | v0.1.0 | 32770 | https://api.zq2-protomainnet.zilliqa.com | https://explorer.zq2-protomainnet.zilliqa.com | https://faucet.zq2-protomainnet.zilliqa.com |
| Name | Version | ChainId | API | Otterscan | Faucet | Checkpoint Bucket |
| ------ | ------- | ------- | --- | --------- | ------ | ----------------- |
| proto-testnet | v0.1.0 | 33103 | https://api.zq2-prototestnet.zilliqa.com | https://explorer.zq2-prototestnet.zilliqa.com | https://faucet.zq2-prototestnet.zilliqa.com | https://checkpoints.zq2-prototestnet.zilliqa.com |
| proto-mainnet | v0.1.0 | 32770 | https://api.zq2-protomainnet.zilliqa.com | https://explorer.zq2-protomainnet.zilliqa.com | https://faucet.zq2-protomainnet.zilliqa.com | https://checkpoints.zq2-protomainnet.zilliqa.com |
</div>

_**Note** that this is currently a proto-testnet and proto-mainnet versions of Zilliqa 2.0 designed primarily for testing purposes, and therefore its state and uptime are not guaranteed_

## Block Explorer
## [Block Explorer](#block-explorer)

The current version of Zilliqa 2.0 is compatible with the Otterscan block explorer and does not support Devex.

The block explorer for the Zilliqa 2.0 proto-testnet is [available here](https://explorer.zq2-prototestnet.zilliqa.com/).
The block explorer for the Zilliqa 2.0 proto-mainnet is [available here](https://explorer.zq2-protomainnet.zilliqa.com/).
- Proto-testnet: [Prototestnet Explorer URL](https://explorer.zq2-prototestnet.zilliqa.com).

## Faucet
- Proto-mainnet: [Protomainnet Explorer URL](https://explorer.zq2-protomainnet.zilliqa.com).

## [Faucet](#faucet)

The faucet sends an amount of 100 ZIL to the supplied address for use in testing the network.

Expand Down
119 changes: 64 additions & 55 deletions zq2/docs/nodes/checkpoint.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,71 @@
---
id: nodes/checkpoint
title: Checkpoint
title: Checkpoint
---

Checkpoints in nodes serve as specific reference points within the blockchain,
allowing nodes to synchronize more efficiently when joining or rejoining the network.
Instead of processing the entire blockchain from the genesis block, nodes can start from
a known, validated state. Below is a detailed guide on how to set up checkpoints.

## [Syncing a node from a checkpoint](#checkpoint-sync)
Assuming that you have already completed
[setup node](../nodes/prototestnetnodes.md#setting-up-your-environment-and-building-zq2-node) section.

For prototestnet network, you should have `zq2-prototestnet.toml` and the `start_node.sh`
script, which is generated by the [setup node](../nodes/prototestnetnodes.md#setting-up-your-environment-and-building-zq2-node) guide.

### Step by step guide to do checkpoint configuration

1. Ensure that you are in directory `/my/dir/zq2` that you created before during the setup.
2. **Download the checkpoints file:**
Here are the steps for downloading the latest checkpoint file.
- Visit the public [checkpoint url](https://checkpoints.zq2-prototestnet.zilliqa.com/) , where you will see an XML file.
- Look for the `<key>` tag, which indicates the checkpoint file's name. The checkpoint file follows `block_num.dat` format. For eg `000291600.dat`.
- Copy the file name from the topmost <block_num.dat> key. This file contains the latest checkpoint data.
- If you prefer to sync from an older checkpoint, copy the desired file from the `previous/` directory. You can skip this step if you have already decided to sync from the latest checkpoint.
- To download, replace <block_num.dat> in the URL with the appropriate block number:
- For the latest checkpoint file: `https://checkpoints.zq2-prototestnet.zilliqa.com/<block_num.dat>`
- For an older file: `https://checkpoints.zq2-prototestnet.zilliqa.com/previous/<block_num.dat>`
- Use `wget` or paste the link in your browser to download the file to the `/my/dir/zq2` directory:
# Checkpoints in Nodes

Checkpoints in nodes serve as specific reference points within the blockchain, allowing nodes to synchronize more efficiently when joining or rejoining the network. Instead of processing the entire blockchain from the genesis block, nodes can start from a known, validated state. Below is a detailed guide on how to set up checkpoints.

## Syncing a Node from a Checkpoint

Before proceeding, ensure you have completed the [Node Setup](../nodes/nodes.md#setting-up-your-environment-and-building-zq2-node) section.

For **prototestnet**, you will need the `zq2-prototestnet.toml` configuration file and the `start_node.sh` script, both generated during the setup process. Similarly, for **protomainnet**, you will use the `zq2-protomainnet.toml` configuration file.

The following steps apply to both networks.

### Step-by-Step Guide to Configure Checkpoints

1. **Ensure Proper Directory**
Navigate to the directory you created during the setup process, e.g., `/my/dir/zq2`.

2. **Download the Checkpoint File**
Follow these steps to download the latest checkpoint file for your chosen network:

- **Prototestnet**:
Visit the public [checkpoint URL](https://checkpoints.zq2-prototestnet.zilliqa.com/).

- **Protomainnet**:
Visit the public [checkpoint URL](https://checkpoints.zq2-protomainnet.zilliqa.com/).

From the XML file at the respective URL:
- Look for the `<key>` tag, which contains the checkpoint file's name. The file follows the `block_num.dat` format (e.g., `000291600.dat`).
- Copy the file name of the latest checkpoint from the topmost `<key>` tag. For older checkpoints, explore the `previous/` directory.
- Download the checkpoint file using the `wget` command or paste the link in your browser:
```bash
wget https://checkpoints.zq2-<network>.zilliqa.com/<block_num.dat>
```
Replace `<network>` with `prototestnet` or `protomainnet` based on your selected network.

**Note**: It is recommended to use the latest checkpoint file to speed up synchronization.

3. **Configure Checkpoints in the Configuration File**
Open the respective configuration file (`zq2-prototestnet.toml` or `zq2-protomainnet.toml`) and add the following lines to enable checkpoint settings:
```toml
[nodes.load_checkpoint]
file = "xxxxx..." # File name of the checkpoint block. for eg: 3000.dat
hash = "xxxxx..." # Block hash corresponding to the file block (Remove '0x' prefix from hash if present)
```

`file` : This parameter specifies the name of the checkpoint or block number file, which
can be obtained from the public GCS bucket. It’s recommended to download the latest checkpoint
file from this source.

`hash` : The hash is used to verify the validity of the state data and ensure that no
tampering has occurred. You can obtain the block hash corresponding to the checkpoint height from the
public explorer of your chosen network. For example, if the downloaded
checkpoint file is 3000, you can use the `eth_getBlockByNumber` API to query the block hash:

```bash
wget https://checkpoints.zq2-prototestnet.zilliqa.com/<block_num.dat>
curl --request POST --url https://api.zq2-prototestnet.zilliqa.com/ \
--header 'Content-Type: application/json' \
--data '{"method":"eth_getBlockByNumber","params":["0xBB8",false],"id":1,"jsonrpc":"2.0"}' \
| grep -o '"hash":"[^"]*"' | awk -F':' '{print $2}' | tr -d '"'
```
_NOTE : We recommend that node operators use the latest checkpoint file to speed up the syncing process._

3. **Configure Checkpoints in zq2-prototestnet.toml file:**
Open the `zq2-prototestnet.toml` file and add the following lines to enable
checkpoint settings:
```toml
[nodes.load_checkpoint]
file = "xxxxx..." # File name of the checkpoint block. for eg: 3000.dat
hash = "xxxxx..." # Block hash corresponding to the file block (Remove '0x' prefix from hash if present)
```
`file` : This parameter specifies the name of the checkpoint or block number file, which
can be obtained from the public GCS bucket. It’s recommended to download the latest checkpoint
file from this source.
`hash` : The hash is used to verify the validity of the state data and ensure that no
tampering has occurred. You can obtain the block hash corresponding to the checkpoint height from the
public [explorer](https://explorer.zq2-prototestnet.zilliqa.com/). For example, if the downloaded
checkpoint file is 3000, you can use the `eth_getBlockByNumber` API to query the block hash:
```bash
curl --request POST --url https://api.zq2-prototestnet.zilliqa.com/ \
--header 'Content-Type: application/json' \
--data '{"method":"eth_getBlockByNumber","params":["0xBB8",false],"id":1,"jsonrpc":"2.0"}' \
| grep -o '"hash":"[^"]*"' | awk -F':' '{print $2}' | tr -d '"'
```
Alternatively, you can retrieve the block hash directly from the public
[explorer](https://explorer.zq2-prototestnet.zilliqa.com/) by searching
for the block number.
By this stage, your checkpoints configuration should be set up in the `zq2-prototestnet.toml` file.
Alternatively, you can retrieve the block hash directly from the public explorer of your chosen network by searching for the block number.
Refer to [block explorers](../endpoints.md#block-explorer) section for public explorer.
By this stage, your checkpoints configuration should be set up in the `zq2-prototestnet.toml` or `zq2-protomainnet.toml` file.

4. **Launch the node**
Now the node is ready to launch. Follow the instructions in the [Start the Node](../nodes/prototestnetnodes.md#start-the-node) section to start your node.
Now the node is ready to launch. Follow the instructions in the [Start the Node](../nodes/node.md#start-the-node) section to start your node.
6 changes: 5 additions & 1 deletion zq2/docs/nodes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ title: Overview of Nodes & Validators
---

# Zilliqa nodes and validator documentation
This section provides documentation on nodes and outlines the process of becoming a validator in the Zilliqa Proof of Stake network.
This section serves as a comprehensive guide to Zilliqa nodes and explains the process of becoming a validator in the Zilliqa Proof of Stake network.

The documentation provides a step-by-step guide to setting up a node in the ZQ2 network and joining as a validator node in both the Zilliqa prototestnet and protomainnet networks. While prototestnet is used as the reference network throughout this guide, the instructions are equally applicable to the protomainnet network.

For more details, please refer to the [Networks section](../endpoints.md#networks).
18 changes: 15 additions & 3 deletions zq2/docs/nodes/prototestnetnodes.md → zq2/docs/nodes/node.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
id: nodes/prototestnetnodes
id: nodes/nodes
title: Prototestnet nodes
---

# Prototestnet Nodes
# Nodes

The current proto-testnet version of Zilliqa 2.0 allows users to setup a node
and join the network.

## Zilliqa 2.0 (proto-testnet) node Prerequisites

### [Hardware requirements](#hardware-requirements)
### [Hardware requirements](#hardware-requirements-prototestnet)

- **CPU**:
- 1 Core / 2 threads or more
Expand All @@ -19,6 +19,17 @@ and join the network.
- **Disk**:
- 100 GB or more

## Zilliqa 2.0 (proto-mainnet) node Prerequisites

### [Hardware requirements](#hardware-requirements-protomainnet)

- **CPU**:
- 4 Core / 8 threads or more
- **RAM**:
- 16 GB or more
- **Disk**:
- 300 GB or more

We are running our Zilliqa 2.0 Nodes on Google Cloud Platform, GCP,
GCE VM `e2-standard-2` instance with 256 GB SSD (`pd-ssd`).

Expand Down Expand Up @@ -123,6 +134,7 @@ There are two methods for setting the synchronization rules for the node.
chmod +x start_node.sh && \
./start_node.sh -k $PRIVATE_KEY -p <checkpoint_block_num.dat>
```

_NOTE: The `<checkpoint_block_num.dat>` file is the one you previously downloaded. Refer to [syncing-from-checkpoint](../nodes/checkpoint.md#syncing-a-node-from-a-checkpoint)_

Great! The node should now be syncing with the network. It may
Expand Down
2 changes: 1 addition & 1 deletion zq2/docs/nodes/nodefaq.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you see the following error message in the logs.
The workaround at present is as follows.

In the `zq2-prototestnet.toml` file, append following settings in the `[nodes.consensus]` section and
[start the node](../nodes/prototestnetnodes.md#start-the-node).
[start the node](../nodes/node.md#start-the-node).
```bash
... # some content
[nodes.consensus]
Expand Down
2 changes: 1 addition & 1 deletion zq2/mkdocs.in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nav:
- Endpoints, Block Explorer & Faucet: endpoints.md
- Nodes & Validators:
- Overview: nodes/index.md
- Prototestnet Nodes: nodes/prototestnetnodes.md
- Nodes: nodes/node.md
- Checkpoints: nodes/checkpoint.md
- Node FAQ: nodes/nodefaq.md
- Tools and SDKs: sdk.md
Expand Down
Loading