Ethereum 2.0 POS Mining Tutorial: Step-by-step Guide to Staking on Topaz Testnet (Monitoring)

Ethereum 2.0 POS Mining Tutorial: Step-by-step Guide to Staking on Topaz Testnet (Monitoring)

The method of enabling Staking has been introduced in the previous tutorial: Ethereum 2.0 POS Mining (ETH2 Staking) Tutorial (I) Topaz Test Network

Since Staking requires validators to stay online 24/7 to continue to earn income, if a validator is offline for a short period of time, there will be a small penalty; if it is offline for a long time, the penalty amount will increase significantly over time. For a brief introduction to this mechanism, see the "Validator Incentives" section of this article.

Therefore, it is necessary to monitor Staking in real time so that when problems occur, alarms can be received and handled in a timely manner to avoid further losses.

This article will introduce several monitoring methods from simple to complex.

Preparation - Get the certifier public key

1. Obtained from deposit transaction

Open metamask, find the deposit transaction of 32ETH, and click "Browse via etherscan". You can see the validator public key corresponding to that transaction.

2. View from the validator key directory

After entering the key directory, check the validatorprivate**** file and find the "publickey" part.

 # Enter the directory cd ~/.eth2validators
# Open the file starting with validatorprivate vim validatorprivatekey*****
# Open it and find the "publickey" part

Blockchain browser to view the validator status

The easiest way is to monitor the validator status by visiting the blockchain browser website: https://beaconcha.in or https://beacon.etherscan.io, and enter the Public Key to view the current status and historical earnings.

Validator status — beaconcha.in example

Use the cloud hosting provider’s monitoring dashboard

Most cloud hosting service providers provide host performance monitoring and alarm functions. If you are staking on a cloud host, you can use the resource monitoring and alarm functions provided by the cloud service. The beacon chain client occupies approximately 2.5GB-3.5GB of memory. If the process is terminated, the memory will drop sharply. You can monitor it from the side through abnormal memory usage/usage. At the same time, you can set up more dimensional monitoring of network traffic and whether the machine is running normally.

Monitoring via prometheus

Prometheus is a popular real-time monitoring tool. After developing the service and setting the listening port as required, you can obtain data through the prometheus access port for monitoring. prysm has built-in listening services for prometheus, so you only need to configure prometheus to monitor the beacon chain and validator clients. If you want to study it yourself, you can refer to the official tutorial. Here are the brief steps:

  • Download the corresponding prometheus installation package to your local computer: Download the latest release

  • Unzip and enter the directory:

 tar xvfz prometheus-*.tar.gz
cd prometheus-*
  • Create a new session with screen and start prometheus:

 # Create a new session
screen -S prometheusETH2
# Start prometheus
./prometheus --config.file=prometheus.yml
# After the startup is complete, press CTRL+A+D to exit the session
  • Modify the configuration file prometheus.yml. At the bottom of the default configuration file, you can see - targets: ['localhost:9090'], which means that the process will scrape data from port 9090 of the local machine. 9090 is the port provided by prometheus to monitor its own running indicators. The indicator ports of prysm's beacon chain and validator are 8080 and 8081 respectively. Just add the two ports to the targets of the configuration file. The scrape_configs part of the completed prometheus.yml is as follows:

 scrape_configs:
  # The job name is added as a label `job=` to any timeseries scraped from this config.
  - job_name: 'prometheus'# metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.static_configs:
- targets: ['localhost:9090']# Add the following targets to monitor the beacon chain and validators - job_name: 'beacon-chain'
static_configs:
    - targets: ['localhost:8080'] - job_name: 'validator'
static_configs:
    - targets: ['localhost:8081']

After the modification is complete, use promtool to check the correctness of the configuration file:

 ./promtool check config prometheus.yml

After verification, you can see the following information:

 Checking prometheus.yml
SUCCESS: 0 rule files found
  • Make prometheus reload the configuration file through ps -aux | grep prometheus to find the process number (PID) of prometheus running, and notify the process to reload the configuration document through the following command:

 kill -HUP PID
  • To view monitoring indicators, visit http://localhost:9090 on your local machine to see the prometheus graphical monitoring page. If you use a Linux cloud host, you need to open three ports 9090, 8080, and 8081 and access the server through a browser. Click Status >> Targets in the menu bar to see the targets set in the configuration file:

    Click the link in the Endpoint to see all the metrics in the target. Enter the validator's Endpoint (http://localhost:8081/metrics) and you can see the validator-related metrics at the bottom of the page:

    Select the indicator and enter it into the Graph page. For example, if you want to observe the growth of the validator's ETH balance, just click Graph in the menu, enter validator_balance, click Execute, and switch to the Graph tab below to view the trend (I have 2 validators here, so there are 2 curves):

    Click Add Graph below to add any number of graphs to create a dashboard with multiple graphs.

Pros and Cons

The above different monitoring methods have their own advantages and disadvantages. The comparison is as follows:

Blockchain Explorer Cloud host monitoring alarm Prometheus
Monitoring Dimensions Validator node status and balance changes Host performance indicators fluctuate Beacon Chain and Validator Metrics
Indicator richness few generally Rich
Difficulty Simple medium More complex
Is it necessary to trust blockchain information from a third party? yes - no
Do you monitor validators directly? yes no yes
Does it work when the host is powered off or the network is disconnected? yes yes no
Risk Points Cannot monitor when website data is incorrect or the website is inaccessible The process is running but cannot be monitored when it executes abnormally Monitoring is not possible when the host is powered off or the network is disconnected; the monitoring function fails when the Prometheus process is terminated or an exception occurs.

In summary, the safer approach is to monitor host performance indicators + prometheus. In addition, prometheus can be deployed on another machine, so that abnormal indicators can be observed when the host is down or the network is disconnected.

We have monitoring, but what about alarms?

Having said so much, does it mean that a person needs to do nothing but stare at the indicators all day? Of course not. The next article will introduce how to alert for abnormalities. Don't miss it.

Link to this article: https://www.8btc.com/media/594563
Please indicate the source of the article when reprinting

<<:  Bitcoin price key indicator shows: investor panic has decreased after halving

>>:  After the halving, the hashrate of the entire network continued to decline. The mining machine market is mainly on the sidelines as the flood season is approaching.

Recommend

What do the marks on the palms and fingerprints on the fingers mean?

Various marks will appear on the palm lines. This...

How to predict marriage from eyebrows?

Marriage is very important for women. It can be s...

What kind of people have peach blossom disasters?

Peach blossom luck is not always good. Some peach...

Judging a person's personality from the length of his little finger

The length of a person's fingers can reveal h...

Bikan offline salon: Digital asset investment becomes an inevitable trend

On June 27, the 21st meeting of the Standing Comm...

The overall shape of a man's palm

The overall shape of a man's palm Round Hands...

What is a dragon nose? A detailed explanation of dragon nose physiognomy

From the perspective of physiognomy, people with ...

Beginner's Guide to Mining

Suitable for people with 5 machines or less 1. Wh...

Career Line in Palmistry Palmistry can tell when your career will reach its peak

Career line in palmistry, palmistry can tell when...

Can a mole on the chin be removed?

Dear readers, you should all know that moles on t...

Zhuge's Divine Numbers Detailed Explanation of the 21st Sign - The Best Sign

Zhuge Shensuan, also known as Zhuge Divine Number...

Wu Jihan uses three tricks, can Bitmain return to glory?

Text | Zheng Yi Editor | Bi Tongtong Source | PAN...